query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
sequencelengths
19
20
metadata
dict
Optional function for comparing current guess with previous guess
function previousGuess(former, current, realNum) { if (realNum - current < realNum - former) { feedback.text("You are getting warmer."); } else if (realNum - current > realNum - former) { feedback.text("You are getting colder."); } else { feedback.text("You are at the same temperature."); } }
[ "function correctGuess (guess) {\n return guess === winningNumber\n }", "function compareGuesses(humanGuess, puterGuess, targetGuess)\n{\n //figure out the difference between the humanGuess and targetGuess, puterGuess and targetGuess and if it's a tie \n if(Math.abs(humanGuess - targetGuess) < Math.abs(puterGuess - targetGuess))\n {\n return true; \n }else if(Math.abs(puterGuess - targetGuess) < Math.abs(humanGuess - targetGuess)){\n return false;\n }else{\n return true; //it was a tie I win\n }\n}", "function prevGuess(){\n\t\tvar previousGuess = $(\"#guessList\").find(\"li\").first().next();\n\t\tpreviousGuess = $(previousGuess[0]).text();\n\t\t// console.log(\"your previous guess is\" + previousGuess);\n\t\tguess = $(\"#guessList\").children().first().text();\n\t\tif (guess == secretnumber) {\n\t\t\t$(\"#feedback\").text(\"You guessed the correct number!\");\n\t\t} else if (previousGuess == guess) {\n\t\t\t\t$(\"#feedback\").text(\"Your most recent and previous guesses are the same number and distance from the secret number\");\n\t\t} else if (guess > secretnumber && previousGuess > secretnumber && guess > previousGuess) {\n\t\t\t$(\"#feedback\").text(\"You're getting colder!\");\n\t\t} else if (guess > secretnumber && previousGuess > secretnumber && guess < previousGuess) {\n\t\t\t$(\"#feedback\").text(\"You're getting hotter!\");\n\t\t} else if (guess > secretnumber && previousGuess < secretnumber) {\n\t\t\tvar differencePrevious = secretnumber - previousGuess;\n\t\t\tvar differenceRecent = guess - secretnumber;\n\t\t\tif (differencePrevious < differenceRecent) {\n\t\t\t\t$(\"#feedback\").text(\"You're getting colder!\");\n\t\t\t} else if (differencePrevious > differenceRecent) {\n\t\t\t\t$(\"#feedback\").text(\"You're getting hotter!\");\n\t\t\t} else {\n\t\t\t\t$(\"#feedback\").text(\"Your most recent and previous guesses are the same distance from the secret number\");\n\t\t\t}\n\t\t} else if (guess < secretnumber && previousGuess > secretnumber) {\n\t\t\tvar differencePrevious = previousGuess - secretnumber;\n\t\t\tvar differenceRecent = secretnumber - guess;\n\t\t\tif (differencePrevious < differenceRecent) {\n\t\t\t\t$(\"#feedback\").text(\"You're getting colder!\");\n\t\t\t}\n\t\t\telse if (differencePrevious > differenceRecent) {\n\t\t\t\t$(\"#feedback\").text(\"You're getting hotter!\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$(\"#feedback\").text(\"Your most recent and previous guesses are the same distance from the secret number\");\n\t\t\t}\n\t\t} else if (guess < secretnumber && previousGuess < secretnumber && guess > previousGuess) {\n\t\t\t$(\"#feedback\").text(\"You're getting hotter!\");\n\t\t} else if (guess < secretnumber && previousGuess < secretnumber && guess < previousGuess) {\n\t\t\t$(\"#feedback\").text(\"You're getting colder!\");\n\t\t}\n\t}", "function evaluateGuess(){ // Begin evaluateGuess\n // a) Compare the guess to the current number. If the guess is correct, return true, otherwise return false.\n if(Number(input.value) == currentNumber )\n {\n return true;\n }\n else\n {\n return false;\n }\n} // End of evaluateGuess", "function compareGuesses(humanGuess,computerGuess,target){\n if (getAbsoluteDistance(humanGuess,target) < getAbsoluteDistance(computerGuess,target)){\n return true;\n }else {\n return false;\n }\n}", "function compareGuesses(human, computer, target){\n //absolute difference of guess\n const humanDiff = Math.abs(target - human);\n const computerDiff = Math.abs(target - computer);\n\n if (computerDiff < humanDiff){\n return false;\n }else{\n return true;\n }\n}", "checkGuess(guess) {\n if (guess === this.letter) {\n this.guessed = true;\n }\n return this.returnLetter();\n }", "function checkGuess(){\n if (isAColumnEmpty()) {return;}\n var guessCopy = [];\n var answerCopy = [] ;\n var nBlack = 0;\n var nGrey = 0;\n // Make copies of the guesses and answers;\n // it's easiest to do this counting by erasing ones we've counted.\n for (var c=0; c<nColumns; c++){\n guessCopy[c] = lastGuess[c];\n answerCopy[c] = hiddenAnswer[c];\n }\n // count number of black markers.\n for (var c=0; c<nColumns; c++){\n if ( answerCopy[c] == guessCopy[c] ){\n nBlack++;\n answerCopy[c] = -10; // don't match this again\n guessCopy[c] = -11; // or this again.\n }\n }\n // count number of grey markers\n for (var ca=0; ca<nColumns; ca++){\n for (var cg=0; cg<nColumns; cg++){\n if ( answerCopy[ca] == guessCopy[cg] ){\n nGrey++;\n answerCopy[ca] = -10; // don't match this again\n guessCopy[cg] = -11; // or this again.\n }\n }\n }\n drawAndPopGuessResult(nBlack, nGrey);\n for (var c=0; c<nColumns; c++){\n lastGuess[c] = -1;\n }\n if (nBlack == nColumns){ // was this guess correct?\n showMessage(\"<b>Correct.</b><p>\" + \n \"Number of guesses = \"+ oldGuesses.length + \"<br>\" );\n\t\t\t\t\t\n\t\t\t\t\tif(curBot ==1){\n\t\t\t\t\tbot1score = oldGuesses.length;\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\tbot2score = oldGuesses.length;\n\t\t\t\t\t}\n\t\t\t\t\t\n }\n else {\n createOrClearGuessTr();\n\t\treturn [nBlack, nGrey];\n } \n\n\t\t\n}", "function compareGuesses(humanGuess, computerGuess, targetNumber) {\n if (Math.abs(humanGuess - targetNumber) < Math.abs(computerGuess - targetNumber) || humanGuess === computerGuess) {\n return true;\n } else {\n return false;\n }\n}", "function isValidGuess(new_guess) {\n for (var i=0; i < game.guesses.length; i++) {\n if (!matchHistoryGuess(game.guesses[i], new_guess)) {\n return false;\n }\n }\n return true;\n}", "function checkCorrectGuess(player_guess) {\n if (mynum == player_guess) {\n return true;\n } else {\n return false;\n }\n}", "function relativeFeedback(secretNumber, oldGuess, newGuess) {\n var oldDiff = parseInt(Math.abs(secretNumber - oldGuess));\n var newDiff = parseInt(Math.abs(secretNumber - newGuess));\n if (newDiff > oldDiff) {\n $('#relative-feedback').text('You must love the snow, you are colder than the last guess!');\n } else if (newDiff === oldDiff) {\n $('#relative-feedback').text('You are as far as your previous guess!');\n } else {\n $('#relative-feedback').text('You must love the beach, you are hotter than the last guess!');\n }\n }", "function checkGuess() {\n if (playersGuess === winningNumber) onWin();\n else if (guessesRemaining === 0) onLose();\n else onTryAgain();\n}", "function checkGuess () {\n var isItRepeated = $guessed.includes($guess);\n if (isItRepeated === true) {\n alreadyGuessed = true;\n } else {\n alreadyGuessed = false;\n }\n }", "function getDifference(target, guess) {\n return(Math.abs(target - guess));\n }", "function compareGuesses(humanGuess, computerGuess, targetNumber) {\n\tif (humanGuess < 0 || humanGuess > 9) {\n\t\talert(`Your number must be between 0 and 9! Your number: ${humanGuess}`);\n\t\treturn false;\n\t}\n\tlet humanDistance = getAbsoluteDistance(humanGuess, targetNumber);\n\tlet computerDistance = getAbsoluteDistance(computerGuess, targetNumber);\n\t//console.log(`Human distance: ${humanDistance}, computer distance: ${computerDistance}`);\n\treturn humanDistance <= computerDistance;\n\t}", "function evaluateGuess(guessNum) {\n\t\n\t\t// compare to secret number\n\t\tvar guessDifference = Math.abs(secretNum - guessNum);\n\t\t//console.log(\"Guess diff = \" + guessDifference);\n\n\t\tvar feedbackColor = \"none\";\n\n\t\t// Provide feedback:\n\t\t// If this is the first guess, then give absolute feedback (as in hot or cold).\n\t\t// \n\t\t// If this is not the first guess, compare the new guess to the old guess and\n\t\t// tell them if they are getting warmer or colder. \n\t\tif ( guessDifference === 0) {\n\t\t\tfeedbackColor = \"very-hot\";\n\t\t\tprovideFeedback(\"You guessed it!\", feedbackColor);\n\t\t\t$('#guessButton').hide();\n\t\t\t$('#newGameButton').show();\n\t\t\t$('#userGuess').css(\"visibility\", \"hidden\");\n\t\t\t$('body').addClass('success');\n\n\t\t}\n\t\telse if ( guessDifference >= 1 && guessDifference <= 10 ) {\n\t\t\tfeedbackColor = \"very-hot\";\n\t\t\tif ( previousGuessDiff !== 0 ) {\n\t\t\t\tif ( guessDifference <= previousGuessDiff ) {\n\t\t\t\t\tprovideFeedback(\"Getting hotter!\", feedbackColor);\n\t\t\t\t}\n\t\t\t\telse provideFeedback(\"Getting less hot\", feedbackColor);\n\t\t\t}\n\t\t\telse provideFeedback(\"Very hot!\", feedbackColor);\n\t\t}\n\t\telse if ( guessDifference >= 11 && guessDifference <= 20 ) {\n\t\t\tfeedbackColor = \"hot\";\n\t\t\tif ( previousGuessDiff !== 0 ) {\n\t\t\t\tif ( guessDifference <= previousGuessDiff ) {\n\t\t\t\t\tprovideFeedback(\"Getting warmer\", feedbackColor);\n\t\t\t\t}\n\t\t\t\telse provideFeedback(\"Getting less warm\", feedbackColor);\n\t\t\t}\n\t\t\telse provideFeedback(\"Hot\", feedbackColor);\n\t\t}\n\t\telse if ( guessDifference >= 21 && guessDifference <= 30 ) {\n\t\t\tfeedbackColor = \"lukewarm\";\n\t\t\tif ( previousGuessDiff !== 0 ) {\n\t\t\t\tif ( guessDifference <= previousGuessDiff ) {\n\t\t\t\t\tprovideFeedback(\"Getting warmer\", feedbackColor);\n\t\t\t\t}\n\t\t\t\telse provideFeedback(\"Getting colder\", feedbackColor);\n\t\t\t}\n\t\t\telse provideFeedback(\"Lukewarm\", feedbackColor);\n\t\t}\n\t\telse if ( guessDifference >= 31 && guessDifference <= 50 ) {\n\t\t\tfeedbackColor = \"cold\";\n\t\t\tif ( previousGuessDiff !== 0 ) {\n\t\t\t\tif ( guessDifference <= previousGuessDiff ) {\n\t\t\t\t\tprovideFeedback(\"Getting a little warmer\", feedbackColor);\n\t\t\t\t}\n\t\t\t\telse provideFeedback(\"Getting colder\", feedbackColor);\n\t\t\t}\n\t\t\telse provideFeedback(\"Cold\", feedbackColor);\n\t\t}\n\t\telse if ( guessDifference >= 51 && guessDifference <= 100 ) {\n\t\t\tfeedbackColor = \"very-cold\";\n\t\t\tif ( previousGuessDiff !== 0 ) {\n\t\t\t\tif ( guessDifference <= previousGuessDiff ) {\n\t\t\t\t\tprovideFeedback(\"Getting a little warmer\", feedbackColor);\n\t\t\t\t}\n\t\t\t\telse provideFeedback(\"Getting even colder!\", feedbackColor);\n\t\t\t}\n\t\t\telse provideFeedback(\"Very Cold!\", feedbackColor);\n\t\t}\n\n\t\tpreviousGuessDiff = guessDifference;\n\t\tlogGuess(guessNum, feedbackColor);\n\t}", "function checkGuess(userGuess) {\n if (isNaN(userGuess)) {\n alert('Come on yooo ENTER a number');\n } else if (userGuess % 1 !== 0) { //avoid decimal num\n alert('Decimal number are NOT allowed');\n } else if (userGuess < 1 || userGuess > 100) {\n alert('you must type a number between 1 - 100');\n } else {\n\n guessHistory(userGuess);\n counter++;\n showGuessCounter(counter);\n console.log(userGuess);\n console.log(secretNumber);\n // feedback based on user guess\n if (userGuess == secretNumber) {\n $('#feedback').text('You nailed it! click New Game to play again');\n $('#guessButton').hide(); // guess button when user win which forces them to click new btn\n } else if (userGuess >= secretNumber - 10 && userGuess <= secretNumber + 10) {\n $('#feedback').text('Very hot!');\n } else if (userGuess >= secretNumber - 20 && userGuess <= secretNumber + 20) {\n $('#feedback').text('Hot!');\n } else if (userGuess >= secretNumber - 30 && userGuess <= secretNumber + 30) {\n $('#feedback').text('warm!');\n } else if (userGuess >= secretNumber - 50 && userGuess <= secretNumber + 50) {\n $('#feedback').text('Cold!');\n } else {\n $('#feedback').text('Ice Cold!');\n }\n\n }\n\n //function to tell whether user previous guess is closer or farther than current guess\n function closeOrfarFeedback(secretNumber, oldGuess, userGuess) {\n var oldDiff = Math.abs(parseInt(secretNumber) - parseInt(oldGuess));\n var newDiff = Math.abs(parseInt(secretNumber) - parseInt(userGuess));\n if (newDiff > oldDiff) {\n $('#closeOrfarFeedback').text('your colder than the last guess');\n } else if (newDiff === oldDiff) {\n $('#closeOrfarFeedback').text('Your are as far as your previous guess');\n } else {\n $('#closeOrfarFeedback').text('You are hotter than your previous guess ', ' keep on');\n }\n }\n // console.log('hey');\n }", "function validateGuess(guess) {\n if(guess == '') {\n $('#result').text('');\n $('#desc').text('You are not guessing');\n return;\n }else if (guess > 100 || guess != Math.floor(guess) || guess < 1) {\n $('#desc').text(\"Error: Must be between 1 and 100\");\n $('body').css('background', colors[12]);\n return;\n }\n\n\n if (guess == answer) {\n $('#result').text(guess);\n $('#desc').text(\"You are Correct, # of Guess: \" + attempt);\n $('body').css('background', colors[9]);\n }\n else if (last_distance == null) {\n initialGuess(guess, answer);\n } else {\n getDistance(last_distance, distance);\n }\n last_distance = distance;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Memoize the Buffer representation of name We need this to sort the links, otherwise we will reallocate new buffers every time
get nameAsBuffer() { if (this._nameBuf !== null) { return this._nameBuf; } this._nameBuf = Buffer.from(this._name); return this._nameBuf; }
[ "get nameAsBuffer () {\n if (this._nameBuf !== null) {\n return this._nameBuf\n }\n\n this._nameBuf = Buffer.from(this._name)\n return this._nameBuf\n }", "function getBufferName(name,buffers,it){\n\n var tmpName = \"\";\n\n if(it < 1){\n\n\ttmpName = name;\n }else\n\ttmpName = name + \" <\"+it+\">\";\n\n for(var i=0;i<buffers.length;i++){\n\n\tif(buffers[i].name == tmpName){\n\n\t return getBufferName(name,buffers,it+1);\n\t}\n }\n\n return tmpName;\n}", "function createBuffer(name){\n\n var buffer = new Buffer(name,undefined);\n buffers.push(buffer);\n return buffer;\n}", "function getBufferByName(name){\n\n return getBufferByProperty('name',name);\n}", "get nameAsBuffer () {\n if (this._nameBuf !== null) {\n return this._nameBuf\n }\n\n this._nameBuf = uint8ArrayFromString(this.Name)\n return this._nameBuf\n }", "get nameAsBuffer () {\n if (this._nameBuf != null) {\n return this._nameBuf\n }\n\n this._nameBuf = uint8ArrayFromString(this.Name)\n return this._nameBuf\n }", "function Buffer(name,file){\n\n //Name of the buffer (should be unique)\n this.name = getBufferName(name,buffers,0);\n //File from the buffer (can be undifined for no file)\n this.file = file;\n //The current content of the buffer\n this.content = \"\";\n //Used to create deltas when using differential synchronization\n this.shadow = [];\n}", "function getBuffersLike(name){\n\n var eName = RegExp.escape(name);\n\n var ret = [];\n for(var i = 0;i<buffers.length;i++)\n\tif(buffers[i].name.search(eName) == 0)\n\t ret.push(buffers[i]);\n\n return ret;\n}", "_createNewBuffer(name, opts) {\n const buffer = new Buffer(this.gl, opts);\n if (this.resources[name]) {\n this.resources[name].delete();\n }\n this.resources[name] = buffer;\n return buffer;\n }", "function update_buffer_names() {\r\n d3.json(buffer_list_url).then(function(names) {\r\n // Remove old options\r\n d3.select(\"#buffer_names\")\r\n .selectAll(\"option\")\r\n .remove()\r\n\r\n // Add '----' entry\r\n names = [\"----\"].concat(names)\r\n\r\n // Add names into options\r\n d3.select(\"#buffer_names\")\r\n .on(\"change\", function() {\r\n name_selection(this.value);\r\n })\r\n .selectAll()\r\n .data(names)\r\n .enter()\r\n .append(\"option\")\r\n .attr(\"value\", function(d) { return d; })\r\n .text(function(d) { return d; });\r\n\r\n // Update #pdf_iframe\r\n // TODO: Make it more pretty, now it is ugly.\r\n d3.select(\"#pdf_iframe\")\r\n .attr(\"src\", buffer_list_url)\r\n\r\n console.log(\"Buffered file names updated.\")\r\n })\r\n}", "getByName(name) {\n const listing = this._listings.get(name);\n const buffers = this._macros.get(name);\n return Object.assign({}, listing, { buffers: buffers.map(rehydrate_1.rehydrateBuffer) });\n }", "function updateLinkName(newlinkname) {\r\n\tchrome.storage.sync.get(null, function(item) {\r\n\t\tvar linknamelist = item.linknames;\r\n\t\tlinknamelist.push(newlinkname);\r\n\t\tchrome.storage.sync.set({'linknames':linknamelist}, renderLinks);\r\n\t});\r\n}", "setImageBuffer (name, data, size, queueName, path) {\n\n if(Object.keys(this.imageBuffer).indexOf(name) == -1){\n this.imageBuffer[name] = data;\n this.imageBufferPath[name] = path;\n }\n\n if(Object.keys(this.sizeBuffer).indexOf(name) == -1){\n this.sizeBuffer[name] = size;\n }\n\n //this.checkoutOfQueue(queueName);\n }", "static generateHashMNameByMName(name) {\n return `yrv_${YrvUtil.getHashCode(name)}`\n }", "function makeCacheLink(href, text, title) {\r\n var link = document.createElement(\"a\");\r\n if (href != null) { link.href = href; }\r\n if (title != null) { link.title = title; }\r\n link.appendChild(document.createTextNode(text));\r\n var cache = document.createElement(\"span\");\r\n cache.appendChild(document.createTextNode(\" - \"));\r\n cache.appendChild(link);\r\n return cache;\r\n}", "function hashBlankNodes(unnamed){var nextUnnamed=[];var duplicates={};var unique={};// TODO: instead of N calls to setImmediate, run\n// atomic normalization parts for a specified\n// slice of time (perhaps configurable) as this\n// will better utilize CPU and improve performance\n// as JS processing speed improves\n// hash quads for each unnamed bnode\nreturn hashUnnamed(0);function hashUnnamed(i){if(i===unnamed.length){// done, name blank nodes\nreturn nameBlankNodes(unique,duplicates,nextUnnamed);}// hash unnamed bnode\nvar bnode=unnamed[i];var hash=_hashQuads(bnode,bnodes);// store hash as unique or a duplicate\nif(hash in duplicates){duplicates[hash].push(bnode);nextUnnamed.push(bnode);}else if(hash in unique){duplicates[hash]=[unique[hash],bnode];nextUnnamed.push(unique[hash]);nextUnnamed.push(bnode);delete unique[hash];}else{unique[hash]=bnode;}// hash next unnamed bnode\nreturn hashUnnamed(i+1);}}// names unique hash bnodes", "get(name = null) {\n if (this.context.scope != null) {\n if (name != null) {\n return this.context.ports[name].scopedBuffer[this.context.scope];\n }\n return this.context.port.scopedBuffer[this.context.scope];\n }\n\n if (name != null) {\n return this.context.ports[name].buffer;\n }\n return this.context.port.buffer;\n }", "function resetBufferForTraces() {\n console.log(Names);\n var newBuffer = Names.map(function () { return []; });\n newBuffer.pop(); // we do not output the data for trace 0 which is time/frequency\n\n return newBuffer;\n }", "getLinkedObjects(name) {\r\n var linked = [name]\r\n var populating = true\r\n while (populating) {\r\n populating = false\r\n for (var i = 0; i < this.links.length; i ++) {\r\n for (var i2 = 0; i2 < linked.length; i2 ++) {\r\n if (this.links[i].master == linked[i2]) {\r\n if (!linked.includes(this.links[i].slave)) {\r\n populating = true\r\n linked.push(this.links[i].slave)\r\n }\r\n } else if (this.links[i].slave == linked[i2]) {\r\n if (!linked.includes(this.links[i].master)) {\r\n populating = true\r\n linked.push(this.links[i].master)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n linked.shift()\r\n return linked\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Fetch jobs from Github
async function fetchGithub () { let resultCount = 1, page = 1; const allJobs = []; // Fetch all pages while (resultCount > 0) { const res = await fetch(`${baseURL}?page=${page}`); const jobs = await res.json(); console.log("OUTPUT: fetched", jobs.length, 'jobs'); resultCount = jobs.length; allJobs.push(...jobs); page++; } console.log('got total', allJobs.length); const jrJobs = allJobs.filter(job => { let isJunior = true; const jobTitle = job.title.toLowerCase(); if ( jobTitle.includes('senior') || jobTitle.includes('manager') || jobTitle.includes('sr.') || jobTitle.includes('architect') ) { isJunior = false; } return isJunior; }); console.log('filtered out', jrJobs.length, 'jr jobs'); // Save to redis const success = await setAsync(githubJobRedisKey, JSON.stringify(jrJobs)); console.log({success}); }
[ "function pullGitHubJobs() {\n // var one = \"https://jobs.github.com/positions.json?search=887cd2b2-8245-11e8-9ecb-449d24e3b102\";\n $.ajax({\n url: url_gitHub,\n method: 'GET',\n dataType: 'jsonp'\n }).then(function(response) {\n console.log(response)\n for (var i = 0; i < response.length; i++) {\n datePosted = response[i].created_at;\n var location = response[i].location;\n var title = response[i].title;\n var description = response[i].description;\n var type = response[i].type;\n var link = response[i].how_to_apply;\n // link = (link.split(\"URL:\").pop());\n jobId = response[i].id;\n\n counter = i;\n if(isSaved == \"true\"){\n displaySavedListingInTable(datePosted, location, title, type, description, link);\n }else{\n displayInTable(datePosted, location, title, type, description, link);\n }\n }\n });\n}", "async function fetchGithubJobs() {\n \n let resultLength = 1;\n let page = 0;\n const allJobs = [];\n\n while(resultLength > 0) {\n const res = await fetch(`${baseURL}?page=${page}`);\n const jobs = await res.json();\n resultLength = jobs.length;\n allJobs.push(...jobs);\n console.log('got jobs', resultLength);\n page++;\n }\n\n \n\n const successResult = await setAsync('githubJobs', JSON.stringify(allJobs));\n console.log('allJobs', {successResult});\n}", "function fetchGithubData(full_name) {\n let gitHub = 'https://api.github.com/repos/' + full_name;\n // actions.push();\n fetch(gitHub)\n .then(res => res.json())\n .then(res => updateTable(res))\n // Update the chart too!\n .then(res => updateChart())\n}", "function gh_fetch_commits(ri, head_sha, ghcache, k) {\n $.ajax({\n url: 'https://api.github.com/repos/' +\n ri.owner + '/' + ri.repo + '/commits?sha=' + head_sha,\n dataType: 'json',\n success: function(data) {\n console.log(\"github: fetched commits: \", repo_key(ri.owner, ri.repo), head_sha);\n data = $.map(data, function(ci) { return gh_trim_commit_info(ci); });\n add_to_commits_map(ghcache, data);\n k();\n }});\n}", "async function doFetchBranches() {\n const args = ['fetch', '-pq'];\n\n await execGit(args);\n}", "async getLatestJobs({ commit, dispatch }) {\n try {\n const result = await fetch(\n `https://cors-anywhere.herokuapp.com/https://www.kalibrr.id/api/job_board/search?limit=4`\n )\n .then((res) => res.json())\n .then((data) => {\n return data.jobs.sort((first, second) => {\n return first.activation_date > second.activation_date\n ? -1\n : first.activation_date < second.activation_date\n ? 1\n : 0\n })\n })\n\n if (result) {\n commit('SET_LATEST_JOBS', result)\n } else {\n commit('SET_LATEST_JOBS', [])\n }\n } catch (error) {\n return error\n }\n }", "function getCommitInfo(host, buildNr, jobsList) {\n var i= 0;\n var fullLink;\n\n jobsList.forEach(function(job) {\n fullLink = host + '/job/' + job.name + '/' + buildNr + '/api/json?pretty=true';\n\n var options = {\n url: fullLink,\n headers: {\n 'User-Agent': 'request'\n },\n 'auth': {\n 'user': 'admin1',\n 'pass': 'admin1',\n 'sendImmediately': true\n },\n json: true\n };\n\n request.get(options, function(error, response, body){\n var gitUser = '-';\n var author = '-';\n var gitUrl = '-';\n var date = \"1900-01-01 00:00:00 +0100\";\n var comment = \"-\";\n var commitId = \"-\";\n\n if(typeof body.changeSet.items[0] !== 'undefined') {\n for(var n = 0; n < body.changeSet.items.length; n++) {\n var date = body.changeSet.items[n].date;\n var comment = body.changeSet.items[n].comment;\n var commitId = body.changeSet.items[n].commitId;\n author = body.changeSet.items[n].author.fullName;\n }\n\n for(var o = 0; o < body.actions.length; o++) {\n if(typeof body.actions[o].remoteUrls !== 'undefined') {\n gitUrl = body.actions[3].remoteUrls[0] + '/commit/' + commitId;\n var gitUrlSplit = gitUrl.split('.com/');\n var gitUrlSplit2 = gitUrlSplit[1].split('/');\n gitUser = gitUrlSplit2[0];\n }\n }\n }\n\n // For loop is to deal with data returning in random order because of varying request times\n for(var j = 0; j < jobsList.length; j++) {\n if(jobsList[j].name === job.name) {\n jobsList[j].commitId = commitId;\n jobsList[j].gitUser = gitUser;\n jobsList[j].author = author;\n jobsList[j].pushDate = date;\n jobsList[j].commitComment = comment;\n jobsList[j].commitUrl = gitUrl;\n }\n }\n i++;\n if(i === jobsList.length)\n index.loadJobs(jobsList); //Send for building results table with jobsList\n });\n });\n}", "function getGitHubData() {\n // \"https://api.github.com/users/Jurecki07\"\n // fetch or axios request using this url\n // populate them html with the correct data from github\n \n}", "async getBuilds() {\n const options = {\n // uri: apiBaseUrl + `/recent-builds?circle-token=${this.authorization.apiKey}&limit=1`,\n uri: apiBaseUrl + `/project/${this.config.vcs}/${this.config.username}/${this.config.project}?circle-token=${this.authorization.apiKey}&limit=1&filter=completed`,\n json: true\n }\n return request.get(options);\n }", "async loadRepo(id) {\n let res = await ax.get(\n `repo/${id}/builds`,\n {\n params: {\n include: 'job.started_at,job.finished_at,job.queue,job.state', limit: 100\n }\n }\n );\n\n let working = 0;\n let queued = 0;\n for (let build of res.data.builds) {\n if (build.finished_at) {\n continue;\n }\n for (let job of build.jobs) {\n if (job.finished_at === null) {\n if (job.started_at === null) {\n queued++;\n } else {\n working++;\n }\n }\n }\n let update = {};\n update[id] = {working: working, queued: queued};\n this.setState(update);\n }\n }", "function fetchRepos() {\n Repo.find().sort('index').exec(function(err, response) {\n // In case of error, populate repos with an empty array (if necessary) and go on our way.\n if (err) {\n if (!repos) {\n repos = [];\n compileGithubActivity();\n }\n return;\n }\n repos = response;\n compileGithubActivity();\n });\n}", "static async getJobs(query = \"\") {\n let res;\n \n if (query) {\n res = await this.request(`jobs`, { title: query });\n } else {\n res = await this.request(`jobs`);\n }\n \n return res.jobs;\n }", "static async getJobs(title = \"\") {\n let res = await this.request(`jobs/`, title !== \"\" ? { title } : {});\n return res.jobs;\n }", "function fetchJobs() {\n if (window.jobsFetched) {\n // Whoa there cowboy, only hit their API once per page\n return Promise.resolve(window.jobsCache);\n }\n\n return fetch(API_URL)\n .then(async (response) => {\n const departments = await response.json();\n /*\n * Since this is the tech blog, we're only pulling a couple of\n * departments\n */\n departments\n .filter(d => ['Engineering', 'Data Science', 'Design', 'Business Analytics', 'Product'].includes(d.title))\n .forEach((department) => {\n department.postings.forEach((posting) => {\n const team = posting.categories.team;\n if (!window.jobsCache[team]) {\n window.jobsCache[team] = [];\n }\n window.jobsCache[team].push(posting);\n });\n });\n window.jobsFetched = true;\n return window.jobsCache;\n })\n .catch((err) => {\n console.error(`Failed to fetch the jobs from Lever, ruh roh ${err}`);\n });\n}", "function jobNumbers(opts) {\n const url = 'https://circleci.com/api/v1.1/project/' + encodeURIComponent(opts.vcs) + '/' + encodeURIComponent(opts.user) + '/' + encodeURIComponent(opts.repo) + '?filter=running';\n return fetch(url + '&circle-token=' + encodeURIComponent(opts.apiKey))\n .then(res => res.json())\n .then(function(jobs) {\n jobs = jobs.map(j => j.build_num);\n jobs.sort();\n return jobs;\n });\n}", "fetchCommitList() {\n // Git URL to fetch for commits\n const url = `https://api.github.com/repos/${this.props.repo}/commits`;\n\n fetch(url, {\n method: \"GET\"\n }).then(response => {\n if (!response.ok) {\n throw Error(response);\n }\n return response.json();\n }).then((data) => {\n this.setState({\n commitList: data\n });\n }).catch((response) => {\n this.setState({\n commitList: []\n });\n });\n }", "function fetchJobs () {\n JobsAPI.list().then(function(data){\n $scope.jobsList = data.jobs;\n })\n .catch(function(error){\n Notify.error(error);\n });\n }", "async fetch() {\r\n const remote = await spawnGit([\"config\", \"--get\", \"remote.origin.url\"]);\r\n if (!remote.length) return this.sendMessage({ type: \"remoteNotConfigured\" });\r\n\r\n await spawnGit([\"fetch\", remote[0]]);\r\n }", "static async getJobs(search) {\n const res = await this.request(`jobs`, { search });\n return res.jobs;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve the carts items from the cookie.
getCartItems() { let cart = Cookie.get(this.settings.cookie_name); return (cart) ? cart.items : []; }
[ "function getCart(){\n\tif($.cookie('cart') !== undefined){\n\t\treturn JSON.parse($.cookie('cart'));\n\t} else {\n\t\treturn [];\n\t}\n}", "static getCartItems() {\n let cartItems = JSON.parse(localStorage.getItem('cart')) ? JSON.parse(localStorage.getItem('cart')) : [];\n return cartItems;\n }", "get cartItems () {\n return JSON.parse(this.storage.getItem(this.CART_KEY));\n }", "function storeCartItems() {\n document.cookie = CART_COOKIE_PREFIX + cartItems.join(',');\n }", "get cartItems () {\n return JSON.parse(this.storage.getItem(this.CART_KEY));\n }", "function getItemsInCart(){\n\t\t\treturn items;\n\t\t}", "get cartItems() {\n //return store.cartItems; //added*\n return JSON.parse(this.storage.getItem(this.CART_KEY));\n }", "function getCartFromCookie(){\n var cookieRaw = getCookie(\"cartItem\");\n\n if (cookieRaw.length){\n return JSON.parse(getCookie(\"cartItem\"));\n }else {\n var jsonCart = {};\n jsonCart[\"totalAmount\"] = parseInt($(\"#lblCartCount\").text().trim(),10);\n var price = parseInt($(\"#cartPrice\").text().trim(),10);\n jsonCart[\"totalPrice\"] = ((isNaN(price) || price == null) ? 0 : price) ;\n jsonCart[\"cartItem\"] = {};\n jsonCart[\"cartItemArr\"] = [];\n createCookie(\"cartItem\", JSON.stringify(jsonCart), 28);\n return jsonCart;\n }\n}", "function getCartFromCookie(){\n var cookieRaw = getCookie(\"cartItem\");\n\n if (cookieRaw.length){\n return JSON.parse(getCookie(\"cartItem\"));\n }else {\n var jsonCart = {};\n var amount = parseInt($(\"#lblCartCount\").text().trim(),10);\n jsonCart[\"totalAmount\"] = ((isNaN(amount) || amount == null) ? 0 : amount);\n var price = parseInt($(\"#cartPrice\").text().trim(),10);\n jsonCart[\"totalPrice\"] = ((isNaN(price) || price == null) ? 0 : price) ;\n jsonCart[\"cartItem\"] = {};\n jsonCart[\"cartItemArr\"] = [];\n createCookie(\"cartItem\", JSON.stringify(jsonCart), 28);\n return jsonCart;\n }\n}", "get items() {\n\t\treturn this._cart.data\n\t}", "async get_cartlist(payload) {\n var data = {\n url: `/cart/list`,\n method: 'GET',\n // Cookie: localStorage.getItem(\"currentCookie\")\n }\n\n try {\n const response = await Repository.get(`${baseUrl}/cart/list`)\n return response.data;\n } catch (error) {\n console.log(error)\n }\n }", "static getCart(){\n let data = localStorage.getItem('cart');\n return data ? JSON.parse(data) : [];\n }", "function getCart(){\n\treturn JSON.parse(sessionStorage.getItem(\"cart\"));\n}", "function getCartItems(){\n return cart_items;\n}", "function retrieveCart() {\n\n\tvar cart =[];\n\n\t// Retrieves the cart from localStorage.\n\tvar localCart = localStorage.getItem(\"cart\");\n\n\t// If there are items, parses the items retrieved.\n\tif (localCart && localCart != \"[]\") {\n\t\tconsole.log(\"There are items in the cart\");\n\t\tcart = JSON.parse(localCart);\n\t}\n\telse {\n\t\tconsole.log(\"There are no items in the cart\");\n\t}\n\n\treturn cart;\n}", "cartItems (state) {\n return Object.keys(state.cart).map(k => state.cart[k])\n }", "function getCartData() {\n const pizzaFromCartLS = JSON.parse(localStorage.getItem('cart'));\n if (pizzaFromCartLS) {\n pizzaFromCartLS.forEach((pizza, i) => cart[i] = pizza);\n }\n}", "function getCartJson() {\n\n let data = getCookie(COOKIE_NAME);\n\n return data;\n}", "static savedItemsInCart(){\r\n return localStorage.getItem(\"cart\")?JSON.parse(localStorage.getItem(\"cart\")):[];\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks the answer through an options regexp
function checkRegExp(answer) { if (options.exec(answer)) { return Promise.resolve(answer); } else { console.warn(`Answer "${answer}" is invalid.${optionsText}`); return ask(txt, def, options); } }
[ "function processOptions(answer) {\n if (typeof options === 'function') {\n return checkFunction(answer);\n } else if (options instanceof RegExp) {\n return checkRegExp(answer);\n } else if (options.includes(answer)) {\n return Promise.resolve(answer);\n } else {\n console.warn(`Answer \"${answer}\" is invalid. Valid options are ${optionsText}`);\n // Note: this function never rejects so we don't need to add a rejection handler.\n return ask(txt, def, options);\n }\n }", "function check_options() {\r\n let error, cfg, regex, current_value;\r\n\r\n for (let opt in config_obj) {\r\n cfg = config_obj[opt];\r\n regex = cfg[REGEX];\r\n current_value = cfg[CURRENT_VALUE];\r\n // We do not validate an option if it does not have any value. In other\r\n // words, if an option is niether provided at the command line, nor in\r\n // any of the config files, nor can have a default value, then regex\r\n // validation is skipped. MAC id is an example.\r\n if (current_value && regex) {\r\n if (!regex.test(current_value)) {\r\n error = new Error(\r\n \"Regular expression: \" +\r\n regex +\r\n \" failing for option: \" +\r\n opt +\r\n \" with value: \" +\r\n current_value\r\n );\r\n break;\r\n }\r\n }\r\n }\r\n return error;\r\n}", "function validation(opts, answer, optsMode) {\n\t\tvar answerLitteralMode1;\n\t\tvar answerLitteralMode2;\n\t\tvar validation = false;\n\t\tvar optsConverted;\n\t\tif (delimStringLength > 0) {\n\t\t\tif ((optsMode === 3 || optsMode === 2) && stateDelim) {\n\t\t\t\tanswerLitteralMode1 = new RegExp(`[1-${opts}]$`, 'i');\n\n\t\t\t\tvalidation = answerLitteralMode1.test(answer);\n\t\t\t}\n\t\t\tif (optsMode === 1 && stateDelim) {\n\t\t\t\toptsConverted = lettersConverterValue[opts - 1];\n\t\t\t\tanswerLitteralMode2 = new RegExp(`[a-${optsConverted}]$`, 'i');\n\n\t\t\t\tvalidation = answerLitteralMode2.test(answer);\n\t\t\t}\n\t\t}\n\t\tif (delimStringLength === 0) {\n\t\t\tif (optsMode === 3 || optsMode === 2) {\n\t\t\t\tanswerLitteralMode1 = new RegExp(`[1-${opts}]$`, 'i');\n\n\t\t\t\tvalidation = answerLitteralMode1.test(answer);\n\t\t\t}\n\t\t\tif (optsMode === 1) {\n\t\t\t\toptsConverted = lettersConverterValue[opts - 1];\n\t\t\t\tanswerLitteralMode2 = new RegExp(`[a-${optsConverted}]$`, 'i');\n\n\t\t\t\tvalidation = answerLitteralMode2.test(answer);\n\t\t\t}\n\t\t}\n\t\treturn validation;\n\t}", "verifyAnswer() {\n if (!this.answerGiven ||\n !this.questionString ||\n !this.questionSubject\n ) {\n return false;\n }\n let optionsString = this.questionString.split('(').pop().split(')')[0];\n let optionsArray = optionsString.split('/');\n if (optionsArray.indexOf(this.answerGiven) === -1) {\n return false;\n }\n return true;\n }", "function EZcheckOptions( pOptions, pChoices )\n{\n\n\tvar inputOpts = \",\" + pOptions + \",\";\n\tinputOpts = inputOpts.toLowerCase();\n\n\tvar searchOpts = pChoices.toLowerCase();\n\tvar str;\n\tvar pos;\n\n\t//----- For each desired choice ...\n\twhile ( !searchOpts == \"\" )\n\t{\n\t\tstr = searchOpts;\n\t\tpos = str.indexOf(\",\");\n\t\tif (pos == 0)\n\t\t{\n\t\t\tsearchOpts = str.substring(pos+1);\t//strip comma\n\t\t\tcontinue;\n\t\t} else if (pos > 0)\n\t\t{\n\t\t\tsearchOpts = str.substring(pos+1);\n\t\t\tstr = str.substring(0,pos);\n\t\t} else\n\t\t{// no comma\n\t\t\tsearchOpts = \"\";\n\t\t}\n\t\t// check for this choice\n\t\tif (inputOpts.indexOf(\",\" + str + \",\") >= 0) return true;\n\t\tif (inputOpts.indexOf(\",\" + str + \"=\") >= 0) return true;\n\t}\n\treturn false;\n}", "function EZcheckOptions(pOptions, pChoices)\n{\n\tif (!pOptions || !pChoices) return false;\n\tvar inputOpts = \",\" + pOptions + \",\";\n\tinputOpts = inputOpts.toLowerCase();\n\n\tvar searchOpts = pChoices.toLowerCase();\n\tvar str;\n\tvar pos;\n\n\t//----- For each desired choice ...\n\twhile ( !searchOpts == \"\" )\n\t{\n\t\tstr = searchOpts;\n\t\tpos = str.indexOf(\",\");\n\t\tif (pos == 0)\n\t\t{\n\t\t\tsearchOpts = str.substring(pos+1);\t//strip comma\n\t\t\tcontinue;\n\t\t} else if (pos > 0)\n\t\t{\n\t\t\tsearchOpts = str.substring(pos+1);\n\t\t\tstr = str.substring(0,pos);\n\t\t} else\n\t\t{// no commaa\n\t\t\tsearchOpts = \"\";\n\t\t}\n\t\t// check for this choice\n\t\tif (inputOpts.indexOf(\",\" + str + \",\") >= 0) return true;\n\t\tif (inputOpts.indexOf(\",\" + str + \"=\") >= 0) return true;\n\t}\n\treturn false;\n}", "function checkOption(r) {\n\tselopt = defenseSelector.selectedIndex;\n\tif (selopt < 1) return false;\n\tseltext = defenseSelector.options[selopt].text.trim();\n\tfor (var i = 1; i < r.length; i++) {\n\t\tif (seltext == r[i].trim()) return true;\n\t}\n\treturn false;\n}", "function sp_CheckOptionMatchValue(mykey, myurl)\n{\n var my_parts_array;\n var my_values_array;\n var i;\n \n // Wenn der Anwender Werte fuer die Option hinterlegt hat ...\n if ( (myOptionsStorage[mykey] != undefined) && (myOptionsStorage[mykey].length > 0) ) {\n\n\t// ... Den Wert in seine Bestandteile zerlegen ...\n\tmy_parts_array = myOptionsStorage[mykey].split(\"\\n\");\n\t\n\t// ... die Bestandteile nacheinander testen ...\n\tfor (i=0; i< my_parts_array.length; i++) {\n\n\t // Den Bestandteil in \"match string\" und \"Wert\" zerlegen\n\t my_values_array = my_parts_array[i].split(\" \");\n\t \n\t // ... wenn der Bestandteil irgendwo in der URL vorkommt ...\n\t if ( myurl.indexOf(my_values_array[0]) >= 0 ) {\n\n\t\tvar retval = \"\";\n\t\tvar m;\n\n\t\t// die uebrigen Bestandteile von my_values_array[] wieder zu einer Zeichenkette zusammenfuegen\n\t\tfor (m = 1; m < my_values_array.length; m++) {\n\t\t retval = retval + my_values_array[m];\n\t\t if ( m < my_values_array.length - 1 ) \n\t\t\tretval = retval + \" \";\n\t\t}\n\t\t\n\t\t// Ergebnis zurueckgeben\n\t\treturn {value : true, matched_string : my_values_array[0], option_value : retval };\n\t }\n\t}\n }\n \n return {value : false};\n}", "function matchOption(argument, matchers) {\n\tfor (const [name, matcher] of Object.entries(matchers)) {\n\t\tif (name.endsWith('=')) {\n\t\t\tconst match = new RegExp(`^(?:-{0,2})(?:${name})(.+)`, 'i').exec(\n\t\t\t\targument\n\t\t\t);\n\n\t\t\tif (match) {\n\t\t\t\tmatcher(match[1]);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconst match = new RegExp(`^(?:-{0,2})(no-)?(?:${name})$`, 'i').exec(\n\t\t\t\targument\n\t\t\t);\n\n\t\t\tif (match) {\n\t\t\t\tmatcher(!match[1]);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\terror(\n\t\t`Unrecognized argument ${argument}; see --help for available options`\n\t);\n\n\treturn false;\n}", "function validate_answer(answer){\r\n\tswitch(answer.toLowerCase()){\r\n\t\tcase 'yes':\r\n\t\t\treturn true;\r\n\t\t\tbreak;\r\n\t\tcase 'no':\r\n\t\t\treturn true;\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\treturn false;\r\n\t\t\tbreak;\r\n\r\n\t}\r\n}", "function validateOptions(options){\n\n\t}", "function validateOptions(options){\n\n }", "function countComplies(option, text, regex) {\n var passes = true;\n if (option != -1) {\n var matches = text.match(regex);\n passes = (matches && (matches.length >= option));\n }\n return passes;\n }", "function parse_options(tokens, opt_result){\n //\n //Pattern to match.\n //OPTIONS = lsbracket SYMBOLS rsbracket.\n //SYMBOLS = symbol(LABEL)+ comma separator\n //\n //Parse the options of the\n if(!parse_symbols(tokens,optn_result = {})) return false; \n //\n //Deconstruct the outpu result to obtain value.\n const {options, ...rtokens} = optn_result;\n //\n //Apped the reuslt to the output result.\n opt_result.options = options;\n //\n //Set the tail tokens of the output result.\n opt_result.tail = rtokens;\n //\n //Process was succefull.\n return true;\n}", "match(str, delims, options) {\n\t\treturn this.lex(delims, options).matches;\n\t}", "function ValidateQuestionOne(input){\n const chef = B();\n const regexAnswer1 = new RegExp(\"(dynamic)\",\"gi\");\n const regexAnswer2 = new RegExp(\"(insertion)|(deletion)\",\"gi\");\n if (regexAnswer1.test(input) || regexAnswer2.test(input)){\n chef.set(\"challenge-1-question-1\",\"true\");\n return true;\n }\n else {\n return false;\n }\n}", "function isInputValid(answer) {\n if(answer[0].toUpperCase() === \"H\" || \"L\"){\n return true;\n }\n}", "function isOptionValid(option){\n for( var i = 0; i < validOptions.length; i++){\n if(validOptions[i] === option){\n return true;\n }\n }\n return false;\n }", "function countComplies(option, text, regex) {\n if (option !== -1) {\n var matches = text.match(regex);\n return (matches && (matches.length >= option));\n }\n return true;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Format dateString to display as HH:MM AM/PM
function getDisplayTimeString(dateString) { var fullDate = new Date(dateString); var hour = fullDate.getHours(); var minute = fullDate.getMinutes(); var AMPM = "AM"; if(hour == 12) { AMPM = "PM"; } else if(12 < hour && hour < 24) { hour = hour - 12; AMPM = "PM"; } else if(hour == 0) { hour = 12; } if(minute < 10) { minute = "0" + minute; } return hour + ":" + minute + " " + AMPM; }
[ "function formattingTime(str) {\n let formattedTime = str.replace(/:00/g, \"\").replace(/ PM/g, \"pm\").replace(/ AM/g, \"am\")\n\n //check and replace duplicate in row\n if (formattedTime.match(/am.*am/)) { // Check if there are 2 'am'\n formattedTime = formattedTime.replace('am', ''); // Remove the first one\n } else if (formattedTime.match(/pm.*pm/)) { // Check if there are 2 'pm'\n formattedTime = formattedTime.replace('pm', ''); // Remove the first one\n }\n return formattedTime\n}", "function formattingTime(str) {\n let formattedTime = str.replace(/:00/g, \"\").replace(/ PM/g, \"pm\").replace(/ AM/g, \"am\")\n\n //check and replace duplicate in row\n if (formattedTime.match(/am.*am/)) { // Check if there are 2 'am'\n formattedTime = formattedTime.replace('am', '') // Remove the first one\n } else if (formattedTime.match(/pm.*pm/)) { // Check if there are 2 'pm'\n formattedTime = formattedTime.replace('pm', '') // Remove the first one\n }\n return formattedTime\n}", "function formatTime3(string) {\n let newStr = \"\";\n\n let strArr = string.split(\" \");\n // strArr = [\"1:00\", \"AM\"]\n\n newStr += strArr[0];\n\n let isAM = strArr[1][0] === \"A\";\n\n if (isAM) {\n newStr += \"a\";\n\n } else {\n newStr += \"p\";\n }\n\n return newStr;\n }", "function formatTimeStamp(timestamp)\n{\n timestamp = timestamp.split(\":\");\n timestamp[0] = parseInt(timestamp[0]);\n\n var daytimeLabel = \"am\";\n if (timestamp[0] >= 12)\n daytimeLabel = \"pm\";\n if (timestamp[0] > 12) // convert from 24 hr to 12 hr\n timestamp[0] -= 12;\n\n return timestamp[0] + \":\" + timestamp[1] + daytimeLabel;\n}", "function get24HrFormat(str) {\n let _t = str.split(/[^0-9]/g);\n _t[0] =+_t[0] + (str.indexOf(\"pm\")>-1 && +_t[0]!==12 ? 12: 0);\n return _t.join(\"\");\n }", "function formatTime (date) {\n var mm = '' + date.getMinutes();\n return `${date.getHours()}:${!mm[1] ? '0':''}${mm}`;\n }", "function formatTime(date) {\n var hours = String(date.getHours());\n var minutes = String(date.getMinutes());\n\n if (hours.length === 1) {\n hours = '0' + hours;\n }\n\n if (minutes.length === 1) {\n minutes = '0' + minutes;\n }\n\n console.log(hours + ':' + minutes);\n}", "function formatTime(date) {\n var hour = date.getHours();\n var minute = date.getMinutes();\n\n hour = (hour < 10 ? '0' : '') + hour.toString();\n minute = (minute < 10 ? '0' : '') + minute.toString();\n\n return hour + ':' + minute;\n}", "function fmtDate(date){\n var res = \"\";\n res = date.substring(0,4)+\"/\"+date.substring(4,6)+\"/\"+date.substring(6,8);\n res = res + \" 06:00:00\";\n return res;\n }", "getAMorPM(timeString) {\n return timeString.substring(6, 8);\n }", "function formatTime(time) {\n var hour = time.substr(0, 2);\n var minute = time.substr(3, 2);\n var ret;\n\n if (hour == 0) {\n ret = \"12:\" + minute + \"am\";\n }\n else if (hour == 12) {\n ret = hour + \":\" + minute + \"pm\";\n }\n else if (hour > 12) {\n hour -= 12;\n ret = hour + \":\" + minute + \"pm\";\n } else {\n ret = hour * 1 + \":\" + minute + \"am\";\n }\n if (hour < 10) {\n ret = \"&nbsp;\" + ret;\n }\n return ret;\n }", "function formatTimeToAMPM(date) {\n let hours = date.getHours();\n let minutes = date.getMinutes();\n let ampm = hours >= 12 ? 'PM' : 'AM';\n\n hours = hours % 12;\n hours = hours ? hours : 12;\n minutes = minutes < 10 ? '0' + minutes : minutes;\n\n let timeInAMPM = hours + \":\" + minutes + \" \" + ampm\n return timeInAMPM\n }", "function timeToString(t) {\n var s = t.hours + \":\" + t.mins + \" \";\n s += t.isAM ? \"AM\" : \"PM\";\n return s;\n }", "function formatDate(date) {\n var year = date.getFullYear(),\n month = date.getMonth() + 1, // months are zero indexed\n day = date.getDate(),\n hour = date.getHours(),\n minute = date.getMinutes(),\n second = date.getSeconds(),\n hourFormatted = hour % 12 || 12, // hour returned in 24 hour format\n minuteFormatted = minute < 10 ? \"0\" + minute : minute,\n morning = hour < 12 ? \"am\" : \"pm\";\n\n return year + \"-\" + month + \"-\" + day + \" \" + hourFormatted + \":\" +\n minuteFormatted + morning;\n}", "function formatDate(when) {\n if (when !== \"\") {\n const monthNames = [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\"\n ];\n\n // Splits 2018-06-15T18:00:00-05:00 or 2018-12-20 into an array\n // of numbers\n let dateArray = when.split(/(?:-|T)+/);\n const year = dateArray[0];\n\n let month;\n if (dateArray[1].indexOf(\"10\") === -1) {\n month = dateArray[1].replace(\"0\", \"\"); //Replace the 05:00 with 5:00\n } else {\n month = dateArray[1]; //Replace the 05:00 with 5:00\n }\n const day = dateArray[2];\n\n // If only date given return just the date else return time as well\n if (dateArray.length <= 3) {\n return `${monthNames[month - 1]} ${day}, ${year}`;\n } else {\n // Get the time array from 2018-06-15T18:00:00-05:00\n // splits time into [hh, mm, ss] ie [18,00,00]\n const time = dateArray[3].split(\":\");\n let hour = parseInt(time[0], 10);\n // if the time is after noon 12pm subtract 12 from it 18 becomes 6pm\n if (hour > 12) {\n hour = hour - 12;\n }\n\n let ampm = \"pm\";\n // if the 24 hour time doesn't contain a 0 as the first element ie 17:00\n // it it pm\n dateArray[3][0] == \"0\" ? (ampm = \"am\") : (ampm = \"pm\");\n return `${monthNames[month - 1]} ${day}, ${year} at ${hour} ${ampm}`;\n }\n }\n return \"\";\n}", "formatTime(date) {\n const df = new DateFormatter()\n df.locale = this.locale\n df.useNoDateStyle()\n df.useShortTimeStyle()\n return df.string(date)\n }", "function displayAmPm (hour) {\n var ampm = '';\n var displayHour = 0;\n if (hour > 12) {\n displayHour = hour - 12;\n ampm = 'pm';\n } else if (hour == 12) {\n displayHour = hour\n ampm = 'pm';\n } else {\n displayHour = hour\n ampm = 'am';\n }\n return displayHour + '' + ampm\n}", "function timeTo12HrFormat(time) {\r\n const timeArr = time.split(':');\r\n const H = +timeArr[0];\r\n const h = H % 12 || 12;\r\n const am_pm = (H < 12 || H === 24) ? 'AM' : 'PM';\r\n return `${`${h}`.padStart(2, '0')}:${timeArr[1]} ${am_pm}`;\r\n }", "function convert_to_12_format (time) {\n var timeString = time;\n var hourEnd = timeString.indexOf(\":\");\n var Hour = +timeString.substr(0, hourEnd);\n var get_hour = Hour % 12 || 12;\n var ampm = Hour < 12 ? \"AM\" : \"PM\";\n timeString = get_hour + timeString.substr(hourEnd, 3) + ' '+ ampm;\n \n console.log(timeString)\n return timeString;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to compare if 2 cards are the same
isSameCard(card){ if(this.number == card.number && this.suit == card.suit){ return true; } return false; }
[ "isMatch(card_1, card_2) {\n if (card_1.value == card_2.value) {\n return true;\n }\n\n return false;\n }", "function areCardsEqual()\n{\n if(cards[cards_clicked[FIRST_CARD_CLICKED]] === cards[cards_clicked[LAST_CARD_CLICKED]])\n return YES;\n\n return NO;\n}", "function checkMatch(){\n\n if(cardDictionary.card1[1] === cardDictionary.card2[1]){\n return true;\n }else{\n return false;\n }\n }", "matchCards(card1, card2) {\n if(card1.letter === card2.letter) {\n return true;\n } else {\n return false;\n }\n }", "function compareCards() {\n if(selectedCards[1].textContent === selectedCards[3].textContent) {\n return true;\n } else {\n return false;\n }\n}", "function compare_card(card1, card2)\r\n{\r\n if (card1 == card2)\r\n return 0;\r\n if (card_is_trump(card1) && !card_is_trump(card2))\r\n return 1;\r\n if (!card_is_trump(card1) && card_is_trump(card2))\r\n return -1;\r\n if (get_card_suit(card1) != get_card_suit(card2))\r\n return 1;\r\n return get_card_value(card1) - get_card_value(card2); \r\n}", "function compare_card(card1, card2)\n{\n if (card1 == card2)\n return 0;\n if (card_is_trump(card1) && !card_is_trump(card2))\n return 1;\n if (!card_is_trump(card1) && card_is_trump(card2))\n return -1;\n if (get_card_suit(card1) != get_card_suit(card2))\n return 1;\n return get_card_value(card1) - get_card_value(card2); \n}", "function compareCards() {\n\tif (flippedCards[0].innerHTML === flippedCards[1].innerHTML) {\n\t matchYes();\n\n\t} else {\n \t matchNo();\n\n\t}\n\tflippedCards = [];\n}", "function checkForMatch()\n{\n if(firstCard.dataset.card===secondCard.dataset.card)\n {\n disableCards();\n return true;\n \n \n \n }\n else\n {\n unFlipCards();\n return false;\n \n }\n}", "function isCardEquals(former, latter) {\n return former.suit === latter.suit && former.rank === latter.rank\n}", "function compareCards() {\n if (cardHolder[0] == cardHolder[1]) {\n winCondition += 1;\n cardsMatch();\n } else {\n noMatch();\n };\n}", "function compareCards() {\n if (openCards[0] == openCards[1]) {\n console.log('They match');\n matchedCards();\n } else {\n console.log('They dont match');\n }\n}", "function compareCards(card) {\n\tif(values.count < 2) {\n\t\tvalues.count++;\n\t\tcardShow(card);\n\t\tif(values.cardOne === null) {\n\t\t\tvalues.cardOne = card.dataset.icon;\n\t\t} else {\n\t\t\tvalues.cardTwo = card.dataset.icon;\n\t\t}\n\n\t\tif(values.cardOne != null && values.cardTwo != null) {\n\t\t\tif(values.cardOne === values.cardTwo) {\n\t\t\t\tvalues.winCounter++;\n\t\t\t\tcardMatched();\n\t\t\t\tif(values.winCounter == 8) {\n\t\t\t\t\twin();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tgameRating(values.moveCounter);\n\t\t\t\tsetTimeout(cardNotMatched, 850);\n\t\t\t}\n\t\t}\n\t}\n}", "spadesCompare(card1, card2) {\n if (card1.suit === this.trumps && card2.suit === this.trumps) {\n return card1.rank - card2.rank;\n }\n\n if (card1.suit === this.trumps) {\n return 1;\n }\n\n if (card2.suit === this.trumps) {\n return -1;\n }\n\n if (card1.suit === card2.suit) {\n return card1.rank - card2.rank;\n }\n\n return 1;\n }", "function cards_are_paired(){\n\n // Declarations\n var a, b;\n\n // Only executes if there are two or more cards turned facing up\n if( cards.active.number >= 2 ){\n\n // Get the cards to be compared\n a = cards.active.index_positions[0];\n b = cards.active.index_positions[1];\n\n // Return the results\n return cards.shuffled[ a ][0] == cards.shuffled[ b ][0];\n\n }\n\n}", "checkIfPair(card1, card2) {\n const isMatch = card1 === card2;\n if(isMatch){\n this.pairsGuessed += 1; \n this.pickedCards.push(card1);\n }\n this.pairsClicked += 1;\n return isMatch;\n }", "function cardsMatch() {\n return (selectedCards.length === 2)\n && (document.getElementsByClassName(\"card\")[selectedCards[0]].innerHTML\n === document.getElementsByClassName(\"card\")[selectedCards[1]].innerHTML);\n}", "function checkSameRankCards(cards ){\n for(var i = 0; i <= cards.length - 1; i++) {\n if(cards[i].card !== cards[0].card) {\n return false;\n }\n }\n return true;\n }", "function checkCardsMatch() {\n if (openCardList.length == 2) {\n movesCount();\n var firstCard = openCardList[0];\n var secondCard = openCardList[1];\n compareCards(firstCard, secondCard); // compare two clicks cards\n openCardList = []; // clear openCardList array\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::LoggingConfiguration` resource
function cfnLoggingConfigurationPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnLoggingConfigurationPropsValidator(properties).assertSuccess(); return { LogDestinationConfigs: cdk.listMapper(cdk.stringToCloudFormation)(properties.logDestinationConfigs), ResourceArn: cdk.stringToCloudFormation(properties.resourceArn), LoggingFilter: cdk.objectToCloudFormation(properties.loggingFilter), RedactedFields: cdk.listMapper(cfnLoggingConfigurationFieldToMatchPropertyToCloudFormation)(properties.redactedFields), }; }
[ "function cfnGraphQLApiLogConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGraphQLApi_LogConfigPropertyValidator(properties).assertSuccess();\n return {\n CloudWatchLogsRoleArn: cdk.stringToCloudFormation(properties.cloudWatchLogsRoleArn),\n ExcludeVerboseContent: cdk.booleanToCloudFormation(properties.excludeVerboseContent),\n FieldLogLevel: cdk.stringToCloudFormation(properties.fieldLogLevel),\n };\n}", "function cfnApplicationZeppelinMonitoringConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplication_ZeppelinMonitoringConfigurationPropertyValidator(properties).assertSuccess();\n return {\n LogLevel: cdk.stringToCloudFormation(properties.logLevel),\n };\n}", "function cfnApplicationCloudWatchLoggingOptionCloudWatchLoggingOptionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplicationCloudWatchLoggingOption_CloudWatchLoggingOptionPropertyValidator(properties).assertSuccess();\n return {\n LogStreamARN: cdk.stringToCloudFormation(properties.logStreamArn),\n };\n}", "function cfnResourceVersionLoggingConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnResourceVersion_LoggingConfigPropertyValidator(properties).assertSuccess();\n return {\n LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),\n LogRoleArn: cdk.stringToCloudFormation(properties.logRoleArn),\n };\n}", "function loadBalancerResourceAccessLoggingPolicyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n LoadBalancerResource_AccessLoggingPolicyPropertyValidator(properties).assertSuccess();\n return {\n EmitInterval: cdk.numberToCloudFormation(properties.emitInterval),\n Enabled: cdk.booleanToCloudFormation(properties.enabled),\n S3BucketName: cdk.stringToCloudFormation(properties.s3BucketName),\n S3BucketPrefix: cdk.stringToCloudFormation(properties.s3BucketPrefix),\n };\n }", "function cfnBucketLoggingConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnBucket_LoggingConfigurationPropertyValidator(properties).assertSuccess();\n return {\n DestinationBucketName: cdk.stringToCloudFormation(properties.destinationBucketName),\n LogFilePrefix: cdk.stringToCloudFormation(properties.logFilePrefix),\n };\n}", "function cfnEnvironmentModuleLoggingConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnEnvironment_ModuleLoggingConfigurationPropertyValidator(properties).assertSuccess();\n return {\n CloudWatchLogGroupArn: cdk.stringToCloudFormation(properties.cloudWatchLogGroupArn),\n Enabled: cdk.booleanToCloudFormation(properties.enabled),\n LogLevel: cdk.stringToCloudFormation(properties.logLevel),\n };\n}", "renderProperties(x) { return ui.divText(`Properties for ${x.name}`); }", "function hostedZoneResourceQueryLoggingConfigPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n HostedZoneResource_QueryLoggingConfigPropertyValidator(properties).assertSuccess();\n return {\n CloudWatchLogsLogGroupArn: cdk.stringToCloudFormation(properties.cloudWatchLogsLogGroupArn),\n };\n }", "function cfnHttpApiAccessLogSettingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnHttpApi_AccessLogSettingPropertyValidator(properties).assertSuccess();\n return {\n DestinationArn: cdk.stringToCloudFormation(properties.destinationArn),\n Format: cdk.stringToCloudFormation(properties.format),\n };\n}", "function cfnApiAccessLogSettingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApi_AccessLogSettingPropertyValidator(properties).assertSuccess();\n return {\n DestinationArn: cdk.stringToCloudFormation(properties.destinationArn),\n Format: cdk.stringToCloudFormation(properties.format),\n };\n}", "function cfnResourceSpecificLoggingPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnResourceSpecificLoggingPropsValidator(properties).assertSuccess();\n return {\n LogLevel: cdk.stringToCloudFormation(properties.logLevel),\n TargetName: cdk.stringToCloudFormation(properties.targetName),\n TargetType: cdk.stringToCloudFormation(properties.targetType),\n };\n}", "function cfnLoadBalancerAccessLoggingPolicyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnLoadBalancer_AccessLoggingPolicyPropertyValidator(properties).assertSuccess();\n return {\n EmitInterval: cdk.numberToCloudFormation(properties.emitInterval),\n Enabled: cdk.booleanToCloudFormation(properties.enabled),\n S3BucketName: cdk.stringToCloudFormation(properties.s3BucketName),\n S3BucketPrefix: cdk.stringToCloudFormation(properties.s3BucketPrefix),\n };\n}", "function renderProperties(setup) {\n // print available exams\n var html = '';\n if (!('localStorage' in window)) {\n html += warning(getMessage('msg_options_change_disabled', 'Changing options is disabled, because your browser does not support localStorage.'));\n }\n for (var section in setup) {\n if (setup[section].opts.length) {\n html += '<p class=\"opts-header\">' + getMessage(section + '_label', setup[section].label) + '</p>';\n html += '<div class=\"list-group\">';\n for (var p in setup[section].opts) {\n html += prepareProperty(setup[section].opts[p]);\n }\n html += '</div>';\n }\n }\n renderElement('#app-properties', html);\n}", "function cfnLoggingConfigurationJsonBodyPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnLoggingConfiguration_JsonBodyPropertyValidator(properties).assertSuccess();\n return {\n InvalidFallbackBehavior: cdk.stringToCloudFormation(properties.invalidFallbackBehavior),\n MatchPattern: cfnLoggingConfigurationMatchPatternPropertyToCloudFormation(properties.matchPattern),\n MatchScope: cdk.stringToCloudFormation(properties.matchScope),\n };\n}", "function cfnDeploymentAccessLogSettingPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDeployment_AccessLogSettingPropertyValidator(properties).assertSuccess();\n return {\n DestinationArn: cdk.stringToCloudFormation(properties.destinationArn),\n Format: cdk.stringToCloudFormation(properties.format),\n };\n}", "function cfnStateMachineLoggingConfigurationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnStateMachine_LoggingConfigurationPropertyValidator(properties).assertSuccess();\n return {\n Destinations: cdk.listMapper(cfnStateMachineLogDestinationPropertyToCloudFormation)(properties.destinations),\n IncludeExecutionData: cdk.booleanToCloudFormation(properties.includeExecutionData),\n Level: cdk.stringToCloudFormation(properties.level),\n };\n}", "function flowLogResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n FlowLogResourcePropsValidator(properties).assertSuccess();\n return {\n ResourceId: cdk.stringToCloudFormation(properties.resourceId),\n ResourceType: cdk.stringToCloudFormation(properties.resourceType),\n TrafficType: cdk.stringToCloudFormation(properties.trafficType),\n DeliverLogsPermissionArn: cdk.stringToCloudFormation(properties.deliverLogsPermissionArn),\n LogDestination: cdk.stringToCloudFormation(properties.logDestination),\n LogDestinationType: cdk.stringToCloudFormation(properties.logDestinationType),\n LogGroupName: cdk.stringToCloudFormation(properties.logGroupName),\n };\n }", "function cfnApplicationCloudWatchLoggingOptionPropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnApplicationCloudWatchLoggingOptionPropsValidator(properties).assertSuccess();\n return {\n ApplicationName: cdk.stringToCloudFormation(properties.applicationName),\n CloudWatchLoggingOption: cfnApplicationCloudWatchLoggingOptionCloudWatchLoggingOptionPropertyToCloudFormation(properties.cloudWatchLoggingOption),\n };\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get default credit card
function getDefaultCreditCard(custnumber, callback) { var sql = `SELECT autoid, tableid, custnumber, carddefault, cardtype, cardnum, exp, cardholder, cc_cid, LTRIM(RTRIM(custtoken)) AS custtoken, LTRIM(RTRIM(paytoken)) AS paytoken, cc_last_four FROM creditcardsadditional WHERE custnumber = :custnumber AND carddefault = 1 AND deleted IS NULL`; var params = { custnumber: custnumber }; photoeye .query(sql, { replacements: params }) .spread(function(results, metadata) { callback(misc.getCreditCardInfo(results)[0]); }); }
[ "async getDefaultCard() {\n let response = await this.fetchPage('anyUserTransfer.htm');\n let card = scrape.defaultCard(response.data)\n return card;\n }", "function credit_By_Default() {\n document.getElementById('payment').value = 'credit-card';\n class_Paypal[0].style.display = 'none';\n class_Bitcoin[0].style.display = 'none';\n }", "getCreditcardData(cd) {\n const cardType = cd.type;\n return {\n exp_date: cd.expiryDate,\n cardType: cardType.charAt(0).toUpperCase() + cardType.slice(1),\n lastFourCCDigit: this.getLastFourCCDDigits(cd.token),\n token: cd.token,\n cardHolderFirstName: cd.cardholderFirstName,\n cardHolderLastName: cd.cardholderLastName\n };\n }", "getDefaultAccount()\n {\n if (this.meta[\"settings.default-account\"] == null)\n return null\n\n return this.getAccount(this.meta[\"settings.default-account\"])\n }", "function getCardTypeIdDefault(key) {\n switch (key) {\n case \"incident\":\n return config.get(\"leankit:incidentCardTypeId\");\n break;\n case \"problem\":\n return config.get(\"leankit:problemCardTypeId\");\n break;\n case \"change\":\n return config.get(\"leankit:changeCardTypeId\");\n break;\n }\n return null;\n }", "function getCardNumber() {\n\tcardNumber = document.getElementById(\"ccnumber\").value;\n }", "get creditCardInputField () {return browser.element('#awpcp-billing-credit-card-number')}", "get defaultAccount() {\r\n if (this.accounts.length === 0) {\r\n throw new Error(\"No accounts available in this Wallet!\");\r\n }\r\n for (const acct of this.accounts) {\r\n if (acct.isDefault) {\r\n return acct;\r\n }\r\n }\r\n for (const acct of this.accounts) {\r\n if (acct.tryGet(\"privateKey\") || acct.tryGet(\"WIF\")) {\r\n return acct;\r\n }\r\n }\r\n for (const acct of this.accounts) {\r\n if (acct.encrypted) {\r\n return acct;\r\n }\r\n }\r\n return this.accounts[0];\r\n }", "get defaultAccount() {\n if (this.accounts.length === 0) {\n throw new Error(\"No accounts available in this Wallet!\");\n }\n for (const acct of this.accounts) {\n if (acct.isDefault) {\n return acct;\n }\n }\n for (const acct of this.accounts) {\n if (acct.tryGet(\"privateKey\") || acct.tryGet(\"WIF\")) {\n return acct;\n }\n }\n for (const acct of this.accounts) {\n if (acct.encrypted) {\n return acct;\n }\n }\n return this.accounts[0];\n }", "function getCredit() {\n\t/* see if this SCORM 2004 */\n\tif (_sAPI == \"API_1484_11\") {\n\t\t/* it is SCORM 2004, return the launch data */\n\t\treturn scormGetValue(\"cmi.credit\");\n\t} else if (_sAPI == \"API\") {\n\t\t/* it is SCORM 1.2, return the launch data */\n\t\treturn scormGetValue(\"cmi.core.credit\");\n\t} else {\n\t\t/* no SCORM communications */\n\t\treturn \"credit\";\n\t}\n}", "function selectedCard() {\n var card = -1;\n card = document.getElementById(\"creditCard\").selectedIndex;\n return card;\n}", "function get_credit_card_type(fid){\n var file = DriveApp.getFileById(fid);\n var filename = file.getName();\n \n if(filename.startsWith(FILENAME_PREFIX_ISRACARD)){\n return 'Isracard';\n }\n else if(filename.startsWith(FILENAME_PREFIX_VISA)){\n return 'Visa';\n }\n else if(filename.startsWith(FILENAME_PREFIX_MAX)){\n return 'Max';\n }\n else{\n return 'Unknown';\n }\n}", "get credit_card () {\n return new IconData(0xe870,{fontFamily:'MaterialIcons'})\n }", "function whatCompany(cardnumber) {\n var noSpaceNumb = removeWhiteSpace(cardnumber);\n var company = new String('');\n var firstTwo = parseInt(noSpaceNumb.substring(0, 2));\n var firstFour = parseInt(noSpaceNumb.substring(0, 4));\n var firstThree = parseInt(noSpaceNumb.substring(0, 3));\n var firstSix = parseInt(noSpaceNumb.substring(0, 6));\n\n if (verifyCardNumber(cardnumber)) {\n if (cardnumber.charAt(0) == '4')\n company = 'VISA';\n else if (firstTwo >= 51 && firstTwo <= 55)\n company = 'MASTERCARD';\n else if (firstFour >= 2221 && firstFour <= 2720)\n company = 'MASTERCARD';\n else if (firstTwo == 65 || firstFour == 6011)\n company = 'DISCOVER';\n else if (firstThree >= 644 && firstThree <= 649)\n company = 'DISCOVER';\n else if (firstSix >= 622126 && firstSix <= 622925)\n company = 'DISCOVER';\n else\n company = 'UNKNOWN';\n\n return company;\n }\n else\n return 'error';\n}", "function getDefaultBillingAddress() {\n var address = getDefaultAddress.call(this, 'Billing');\n if(address === null || address === undefined) {\n address = new CustomerAddressDisplay();\n address.addressType = 'Billing';\n }\n return address;\n }", "static getDefaultAccount(scope) { return scope.node.tryGetContext(cxapi.DEFAULT_ACCOUNT_CONTEXT_KEY); }", "function getDefault()\n{\n return INITIAL_USER;\n}", "function payementDefaultOption() {\n creditcardOption.selected = true;\n if (creditcardOption.selected) {\n creditCardDiv.hidden = false;\n paypalDiv.hidden = true;\n bitcoinDiv.hidden = true;\n }\n}", "getSfccCardType(cardType) {\n if (!empty(cardType)) {\n switch (cardType) {\n case 'visa':\n case 'visa_applepay':\n cardType = 'Visa';\n break;\n case 'mc':\n case 'mc_applepay':\n cardType = 'Mastercard';\n break;\n case 'amex':\n case 'amex_applepay':\n cardType = 'Amex';\n break;\n case 'discover':\n case 'discover_applepay':\n cardType = 'Discover';\n break;\n case 'maestro':\n case 'maestrouk':\n case 'maestro_applepay':\n cardType = 'Maestro';\n break;\n case 'diners':\n case 'diners_applepay':\n cardType = 'Diners';\n break;\n case 'bcmc':\n cardType = 'Bancontact';\n break;\n case 'jcb':\n case 'jcb_applepay':\n cardType = 'JCB';\n break;\n case 'cup':\n cardType = 'CUP';\n break;\n case 'cartebancaire':\n case 'cartebancaire_applepay':\n cardType = 'Carte Bancaire';\n break;\n default:\n cardType = '';\n break;\n }\n return cardType;\n }\n throw new Error(\n 'cardType argument is not passed to getSfccCardType function',\n );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
get disk usage data function and display it
function getDiskUsage(){ $.get(SERVER_ADDRESS+'/diskusage',function(data){ var diskData = JSON.parse(data); $('#disk_usage .bar').css('width',diskData.availablePerc + '%'); $('#disk_usage .bar').html(diskData.availableGB+' GB free'); $('#disk_usage .bar').attr('aria-valuenow',diskData.availablePerc); }); }
[ "function getDiskUsage() \n{\n try \n {\n PMenablePrivilege(\"UniversalXPConnect\");\n var obj = Components.classes[SystemInfCID]\n .getService(Components.interfaces.ISystemInformation);\n return obj.GetDiskUsage();\n }\n catch (err) \n {\n debugalert(err);\n return null;\n }\n}", "function fnDiskUsage(path){\n try {\n assert( fnIsString(path) && path.length > 0 );\n assert( fs.existsSync(path) );\n const stdout = spawnSync(\"du\", [\"-s\", \"-b\", path], { encoding: \"utf8\", stdio: [\"ignore\", undefined, \"ignore\"] }).stdout;\n assert( stdout.includes(path) );\n const size = parseInt(stdout.trim().split(\"\\t\")[0], 10);\n assert( fnIsInteger(size) );\n \n return size;\n }\n catch (error){\n return 0;\n }\n}", "function getDiskSpace(){\n\n\t\t$.ajax({\n\t\t\turl: '/mixtri/rest/diskspace',\n\t\t\ttype: 'GET',\n\t\t\tdata: {\n\t\t\t\temailId: $.cookie(\"emailId\")\n\t\t\t},\n\n\t\t\tsuccess: function (data, textStatus, jqXHR) {\n\t\t\t\t$('#spanDiskSpace').html(data+\" MB Left\");\n\t\t\t\tvar oneGB = 1024;\n\t\t\t\tvar percentSpaceUsed = (oneGB - data)/1024*100;\n\t\t\t\t$('#disk-space-bar').width(percentSpaceUsed+'%');\n\n\t\t\t},\n\n\t\t\terror: function(data){\n\t\t\t\twindow.location.href = \"error.jsp\";\n\t\t\t},\n\n\n\t\t});\n\n\n\t}", "function getTotalDiskUtilData(countryCode, callback) {\n\t\tvar chartData = [];\n\t\tvar map = {};\n\t\t\n\t\tvar input = fs.createReadStream(CLUSTER_DISKUTIL_FILEPATH);\n utils.readFileLines(input, function (lineNum, rawLine, eof) {\n \tif (!rawLine || lineNum === 0) {\t// ignore first line\n \t\treturn;\n \t}\n \tvar data = parseDiskUtilData(rawLine);\n \t\n \tif (countryCode && countryCode.toLowerCase() !== \"all\") {\n\t\t\t\tvar dataCountryCode = getCountryCodeFromClusterId(data.clusterId);\n\t\t\t\tif (countryCode !== dataCountryCode) {\n\t\t\t\t\tif (eof) {\n\t\t \t\tsendChartData(map, chartData, callback);\n\t\t \t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (map[data.timestamp]) {\n\t\t\t\tmap[data.timestamp] += data.diskUsage;\n\t\t\t}else {\n\t\t\t\tmap[data.timestamp] = data.diskUsage;\n\t\t\t}\n \t\n \tif (eof) {\n \t\tsendChartData(map, chartData, callback);\n \t}\n });\n \n // output a list of tuples of total disk usage in MB \n // and timestamp to a callback\n function sendChartData(map, chartData, callback) {\n \tfor (var timestamp in map) {\n\t\t\t\tchartData.push({\n\t\t\t\t\t\"usage\": map[timestamp],\n\t\t\t\t\t\"timestamp\": parseInt(timestamp)\n\t\t\t\t});\n\t\t\t}\n \t\tcallback({'data': chartData});\n };\n\t}", "function ram_usage_info(data) {\n var tot_entries_last_hour = data.length\n var total_avail = 0\n data.forEach(function(entry){total_avail+=entry.available_ram})\n var av_percentage = (total_avail/tot_entries_last_hour)/data[0].total_ram\n message = \"average percentage of ram in use last hour was \"+parseInt(Math.ceil(av_percentage*100))+\"%\"\n msg.publish(TOPIC,message)\n }", "function getStorageInfo(callback) {\r\n if(process.platform != 'linux')\r\n return callback(\"OS Not Supported\");\r\n/*\r\n var devs = dfParse(df_test_string);\r\n return callback(null, devs);\r\n*/\r\n exec('df --block-size=1', function(err, stdout) {\r\n if(err)\r\n return callback(err);\r\n\r\n var devs = null;\r\n try {\r\n devs = dfParse(stdout);\r\n }\r\n catch(ex) {\r\n return callback(ex);\r\n }\r\n\r\n callback(null, devs);\r\n\r\n })\r\n }", "async function update_data_usage_statistics()\n {\n function to_kb(bytes) { return Math.ceil(bytes / 1000); }\n\n const to_be_synced_bytes = await storage.local.get_bytes_in_use();\n const capacity_bytes = storage.synchronized.CAPACITY_BYTES;\n\n let taken_kb;\n if (to_be_synced_bytes > capacity_bytes)\n {\n taken_kb = to_kb(to_be_synced_bytes);\n messages.info(InfoMessage.DataCapacityExceeded);\n }\n else\n {\n taken_kb = to_kb(await storage.synchronized.get_bytes_in_use());\n messages.clear();\n }\n\n const capacity_kb = to_kb(capacity_bytes);\n const percentage_taken = Math.round(100 * taken_kb / capacity_kb);\n\n DOM.sync_data_usage.textContent = browser.i18n.getMessage(\n \"info_sync_data_usage\",\n [taken_kb.toString(),\n capacity_kb.toString(),\n percentage_taken.toString()]\n );\n }", "function getUsageLinux(cb) {\n // TODO: throw error\n if (!isFunction(cb)) { return; }\n\n function calcFree(data) {\n return (data[\"cached\"] + data[\"buffers\"] + data[\"memfree\"]) / data[\"memtotal\"];\n }\n\n function calcUsage(data) {\n return 1 - calcFree(data);\n }\n\n fs.readFile(\"/proc/meminfo\", function(err, data) {\n if (err) { return cb(err); }\n\n var meminfo = data.toString().split(\"\\n\");\n var data = {};\n\n for (var i in meminfo) {\n var line = meminfo[i].split(\":\");\n // Ignore invalid lines, if any\n if (line.length == 2) {\n data[line[0].trim().toLowerCase()] = parseInt(line[1].trim(), 10);\n }\n }\n\n cb(null, calcUsage(data) * 100);\n });\n}", "function diskReadOps(change) {\n return metric(\"DiskReadOps\", Object.assign({ unit: \"Count\" }, change));\n }", "function drawOverallUsage(elementId, machineInfo, containerInfo) {\n var cur = containerInfo.stats[containerInfo.stats.length - 1];\n var gauges = [];\n\n var cpuUsage = 0;\n if (containerInfo.spec.has_cpu && containerInfo.stats.length >= 2) {\n var prev = containerInfo.stats[containerInfo.stats.length - 2];\n var rawUsage = cur.cpu.usage.total - prev.cpu.usage.total;\n var intervalNs = getInterval(cur.timestamp, prev.timestamp);\n\n // Convert to millicores and take the percentage\n cpuUsage =\n Math.round(((rawUsage / intervalNs) / machineInfo.num_cores) * 100);\n if (cpuUsage > 100) {\n cpuUsage = 100;\n }\n gauges.push(['CPU', cpuUsage]);\n }\n\n var memoryUsage = 0;\n if (containerInfo.spec.has_memory) {\n // Saturate to the machine size.\n var limit = containerInfo.spec.memory.limit;\n if (limit > machineInfo.memory_capacity) {\n limit = machineInfo.memory_capacity;\n }\n\n memoryUsage = Math.round((cur.memory.usage / limit) * 100);\n gauges.push(['Memory', memoryUsage]);\n }\n\n var numGauges = gauges.length;\n if (cur.filesystem) {\n for (var i = 0; i < cur.filesystem.length; i++) {\n var data = cur.filesystem[i];\n var totalUsage = Math.floor((data.usage * 100.0) / data.capacity);\n var els = window.cadvisor.fsUsage.elements[data.device];\n\n // Update the gauges in the right order.\n gauges[numGauges + els.index] = ['FS #' + (els.index + 1), totalUsage];\n }\n\n // Limit the number of filesystem gauges displayed to 5.\n // 'Filesystem details' section still shows information for all filesystems.\n var max_gauges = numGauges + 5;\n if (gauges.length > max_gauges) {\n gauges = gauges.slice(0, max_gauges);\n }\n }\n\n drawGauges(elementId, gauges);\n}", "async function update_data_usage_statistics()\n {\n function to_kb(bytes) { return Math.ceil(bytes / 1000); }\n\n const to_be_synced_bytes = await storage.local.get_bytes_in_use();\n const capacity_bytes = storage.synchronized.ITEM_CAPACITY_BYTES;\n\n let taken_kb;\n if (to_be_synced_bytes > capacity_bytes)\n {\n taken_kb = to_kb(to_be_synced_bytes);\n messages.info(InfoMessage.DataCapacityExceeded);\n }\n else\n {\n taken_kb = to_kb(await storage.synchronized.get_bytes_in_use());\n messages.clear();\n }\n\n const capacity_kb = to_kb(capacity_bytes);\n const percentage_taken = Math.round(100 * taken_kb / capacity_kb);\n\n DOM.sync_data_usage.textContent = browser.i18n.getMessage(\n \"info_sync_data_usage\",\n [taken_kb.toString(),\n capacity_kb.toString(),\n percentage_taken.toString()]\n );\n }", "getDiskWiseMemoryDetails() {\n logger.info(\"SystemInformationDataAcess|getDiskWiseMemoryDetails \");\n try {\n return new Promise((resolve, reject) => {\n let mainGraphData = [];\n let graphData = [];\n d.getDrives(function (err, aDrives) {\n for (var i = 0; i < aDrives.length; i++) {\n if (aDrives[i].filesystem != \"CD-ROM Disc\") {\n graphData = [];\n graphData.push([\"Total \", aDrives[i].blocks]);\n graphData.push([\"Used\", aDrives[i].used]);\n graphData.push([\"Available\", aDrives[i].available]);\n mainGraphData.push({\n driveData: graphData,\n mounted: aDrives[i].mounted,\n });\n }\n }\n aDrives.length = 0;\n logger.debug(\n \"SystemInformationDataAcess|getDiskWiseMemoryDetails|mainGraphData \",\n mainGraphData\n );\n graphData = [];\n resolve(mainGraphData);\n });\n });\n } catch (err) {\n logger.error(\n \"Error Occured in SystemInformation|getDiskWiseMemoryDetails \",\n err\n );\n }\n }", "function getCpuData () {\r\n fetch('poll_cpu_usage.php')\r\n .then(response => {\r\n let data = response.json();\r\n return data;\r\n })\r\n .then(data => {\r\n if (data === 0) { errorsCounter++; }\r\n addData(data);\r\n })\r\n .catch(error => console.error(error));\r\n\r\n // stats\r\n let percent = Math.floor(100 * errorsCounter / requestsCounter);\r\n requestsStats.innerHTML = requestsCounter++;\r\n errorsPercent.innerHTML = `${percent}%`;\r\n}", "function FindAverageCpuUsage(req,resp){\n ClearBlade.init({request:req});\n var analysis = function() {\n var q =ClearBlade.Query({collectionName:\"CpuUsage\"});\n var prevTime =parseInt( Date.now()/1000) -60;\n q.greaterThan(\"timestamp\",prevTime);\n var averageCPUusage;\n q.fetch(function(err,itemsArray){\n if(err)\n resp.error(itemsArray);\n else{\n var sum, count;\n sum = count = 0;\n log(itemsArray);\n for(var i in itemsArray.DATA){\n sum += parseFloat(itemsArray.DATA[i].usageinpercentage);\n count++;\n }\n averageCPUusage = sum/count;\n }\n });\n var mqtt = ClearBlade.Messaging();\n\t mqtt.subscribe('analytics', function(err, message) {\n\t \tif (err) {\n\t \t} else {\n log(averageCPUusage);\n mqtt.publish(\"analytics\",averageCPUusage.toString());\n\t \t}\n \t});\n }\n analysis();\n\n resp.success(\"Success\");\n}", "function startFileSystemUsage(metrics) {\n\twindow.cadvisor.fsUsage = {};\n\n\t// A map of device name to DOM elements.\n\twindow.cadvisor.fsUsage.elements = {};\n\n\tvar cur = stats.stats[stats.stats.length - 1];\n\tvar el = $(\"<div>\");\n\tif (!cur.filesystem) {\n\t\treturn;\n\t}\n\tfor (var i = 0; i < cur.filesystem.length; i++) {\n\t\tvar data = cur.filesystem[i];\n\t\tel.append($(\"<div>\")\n\t\t\t.addClass(\"row col-sm-12\")\n\t\t\t.append($(\"<h4>\")\n\t\t\t\t.text(\"FS #\" + (i + 1) + \": \" + data.device)));\n\n\t\tvar progressElement = $(\"<div>\").addClass(\"progress-bar progress-bar-danger\");\n\t\tel.append($(\"<div>\")\n\t\t\t.addClass(\"col-sm-9\")\n\t\t\t.append($(\"<div>\")\n\t\t\t\t.addClass(\"progress\")\n\t\t\t\t.append(progressElement)));\n\n\t\tvar textElement = $(\"<div>\").addClass(\"col-sm-3\");\n\t\tel.append(textElement);\n\n\t\twindow.cadvisor.fsUsage.elements[data.device] = {\n\t\t\t'progressElement': progressElement,\n\t\t\t'textElement': textElement,\n\t\t\t'index': i,\n\t\t};\n\t}\n\t$(\"#\" + elementId).empty().append(el);\n\n\tdrawFileSystemUsage(machineInfo, stats);\n}", "function buildDiskMsg(data) {\n var i, obj, usedPercent,\n diskmsg = '<table class=\"table table-condensed\"><thead><tr><th>FS</th>'\n + '<th>Total</th><th>Used</th><th>Available</th><th></th></tr></thead><tbody>';\n\n for (i=0;i<data.diskspace.length;i++) {\n obj = data.diskspace[i];\n usedPercent = obj.disk_used_percent.replace(/%/,'');\n\n diskmsg += '<tr><th>' + obj.disk_partition + '</th>' \n + '<td>' + obj.disk_size + '</td>'\n + '<td>' + obj.disk_used + '</td>'\n + '<td>' + obj.disk_avail + '</td>'\n + '<td><div class=\"progress\">'\n + '<div class=\"progress-bar\" style=\"width: '\n + usedPercent + '%\">' + usedPercent + '%</div></div></td></tr>';\n }\n diskmsg += '</tbody></table>';\n\n return diskmsg;\n }", "function diskReadBytes(change) {\n return metric(\"DiskReadBytes\", Object.assign({ unit: \"Bytes\" }, change));\n }", "function disktemps() {\n\tfor (i=0; i < disks.length; i++){\n\t\tchild = exec(smartctlbin + \" -a -d scsi /dev/rdsk/\" + disks[i] + \"|grep Current|awk '{print $4}'\", function (error, stdout, stderr) {\n\t\t\ttotaltemp = totaltemp + parseInt(stdout);\n\t\t\tcounter++;\n\t\t\tif(disks.length == counter) {\n\t\t\t\tgettemp();\n\t\t\t};\n\t\t});\n\t};\n}", "function statfs(cb) {\n\tcb(0, {\nbsize: 1000000,\nfrsize: 1000000,\nblocks: 1000000,\nbfree: 1000000,\nbavail: 1000000,\nfiles: 1000000,\nffree: 1000000,\nfavail: 1000000,\nfsid: 1000000,\nflag: 1000000,\nnamemax: 1000000\n});\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Update nav with passed path and link text
function updateNav(text, path) { $('#nav').append(' > <a href="' + path + '">' + text + '</a>') }
[ "function addNewLink() {\n var navbar = _$c(navbar)\n navbar.textContent = \"www.stratofyzika.com\"\n}", "function updateNavBar()\n {\n $(\"#list-name\").html(\"+\" + currentList.name);\n $(\"#menu-archive-text\").html(\n currentList.archived ? \"Unarchive\" : \"Archive\"\n );\n $(\"#button-add\").prop(\"disabled\", currentList.archived);\n }", "static navBarUpdate() {\n const linkToHere = document.getElementById('navigation').querySelector(`a[href='#${Navigation.hash}']`);\n // un-highlight all the links\n document.getElementById('navigation').querySelectorAll('a').forEach(a => a.classList.remove('selected'));\n // re-highlight the right one\n linkToHere.classList.add('selected');\n }", "updateNavDetail(info) {\n var navSection = this._nodeContent.querySelector('.navigation');\n\n if (!navSection) {\n return false;\n }\n var content = '';\n if (info.prevId) {\n //content = '<a class=\"pull-left\" data-id=\"' + info.prevId + '\" >Back &larr;</a>';\n content = '<a class=\"pull-left\" data-id=\"' + info.prevId + '\" data-view-id=\"' + info.prevViewId + '\" >Back &larr;</a>';\n }\n else {\n content = '<a class=\"pull-left disabled\">Back</a>';\n }\n\n if (info.nextId) {\n content += '<a class=\"pull-right\" data-id=\"' + info.nextId + '\" data-view-id=\"' + info.nextViewId + '\" >&rarr; Next</a>';\n }\n else {\n content += '<a class=\"pull-right disabled\">Next</a>';\n }\n navSection.innerHTML = content;\n }", "function updateNav (nav) {\n const communityItem = Map({ label: 'Community', url: '/community', trackingId: '123456789' })\n const homeNavChildren = nav.getIn([1, 'children'], List())\n const updatedHomeNavChildren = homeNavChildren.push(communityItem)\n const updatedNav = nav.setIn([1, 'children'], updatedHomeNavChildren)\n return updatedNav\n}", "updateCurrent() {\n let currentPage = page.getBasePath() + page.getCurrentFile();\n let current = this.navEl_.querySelector('a.current');\n if (current) {\n let href = current.getAttribute('href');\n if (href === currentPage) {\n return;\n }\n current.classList.remove('current');\n }\n\n let link = this.navEl_.querySelector(`a[href=\"${currentPage}\"]`);\n if (link) {\n link.classList.add('current');\n }\n }", "function updateNavigation(album) {\n // remove any extra link\n if (navRootElement.nextSibling)\n navRootElement.parentElement.removeChild(navRootElement.nextSibling);\n\n if (album) {\n var navAlbumLink = document.createElement('a');\n navAlbumLink.href = '#!/' + encodeURIComponent(album.name) + '/';\n navAlbumLink.innerHTML = album.name;\n\n var navExtraElement = document.createElement('span');\n navExtraElement.appendChild(document.createTextNode(' → '));\n navExtraElement.appendChild(navAlbumLink);\n\n navRootElement.parentElement.appendChild(navExtraElement);\n }\n }", "function update_nav() {\n var next, prev, title, up\n var page = \"\"\n var top = window.pageYOffset || document.documentElement.scrollTop\n\n // Do nothing until all four tables have been loaded.\n if (!nextlinks || !prevlinks || !uplinks || !titles)\n return\n\n // Find page containing the top of the viewport.\n try {\n pagelocs.forEach(function(id, pos) {\n if (pos <= top)\n page = id\n else\n throw null\n })\n }\n catch (e) {}\n\n // All done if no change.\n if (page === last_page)\n return\n last_page = page\n\n // Change URL in address bar, and title in tab.\n history.replaceState(null, titles[page], \"master.html#\" + page)\n document.title = titles[page]\n\n // If found, look up three nav links.\n if (page) {\n next = nextlinks[page]\n prev = prevlinks[page]\n up = uplinks[page]\n }\n\n // For each nav link, set up nav button.\n if (next) {\n nextlink.setAttribute(\"onclick\", \n \"window.scrollTo(0, \" + pagelocs.indexOf(next) + \")\")\n nextlink.innerHTML = titles[next];\n }\n else {\n nextlink.setAttribute(\"onclick\", null)\n nextlink.innerHTML = \"\"\n }\n if (prev) {\n prevlink.setAttribute(\"onclick\", \n \"window.scrollTo(0, \" + pagelocs.indexOf(prev) + \")\")\n prevlink.innerHTML = titles[prev]\n }\n else {\n prevlink.setAttribute(\"onclick\", null)\n prevlink.innerHTML = \"\"\n }\n if (up) {\n uplink.setAttribute(\"onclick\", \n \"window.scrollTo(0, \" + pagelocs.indexOf(up) + \")\")\n uplink.innerHTML = titles[up]\n }\n else {\n uplink.setAttribute(\"onclick\", null)\n uplink.innerHTML = \"\"\n }\n }", "function updateNavigation() {\n\tif ($(document.body).hasClass('single-page')){\n\t\treturn;\n\t}\n\n\t$(\".toc .topic-link + ul\").hide();\n\n\tvar li = $(\".toc li\");\n\tvar next, prev;\n\t$.each(li, function(i, e){\n\t\tif ($(\".topic-link.active\").closest(\"li\").get(0) === this) {\n\t\t\tnext = $(li.get(i+1)).find(\".topic-link:first\");\n\t\t\tif (i>0){\n\t\t\t\tprev = $(li.get(i-1)).find(\".topic-link:first\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t});\n}", "function updateTriggerLink(tabNav) {\n tabNav.closest('.ls-dropdown-tabs').find('> a').text(tabNav.find('li.ls-active > a').text());\n }", "function leftNav()\n{\n \n\t$(function(){\n\t\t var path = location.pathname.substring(1);\n\t\t //only do the dom traversal is we have a valid path\n\t\t //attr('class','selected');\n\t\t if ( path )\n\t\t $('#leftNav a[href$=\"' + path + '\"]').attr('class', 'selected');\n\t\t\t//marksup parent link\n\t\t $('#leftNav a[href$=\"' + path + '\"]').parentsUntil('#leftNav').filter('li').contents().filter(function(){return this.nodeType == 3;}).wrap('<b></b>');\n\t\t\t//marksup current link.\n\t\t \t$('#leftNav a[href$=\"' + path + '\"]').parentsUntil('#leftNav').filter('li').children().filter(':not(ul)').css({'color' : '#005D61', 'font-weight' : 'bolder'});\n\t\t });\n}//end leftNav", "function updateNav() {\n var position = window.location.pathname;\n var dot1 = position.indexOf('.')\n if (dot1 < 0) { //home\n $('#index').addClass('active');\n } else {\n //index.html or other\n var slash1 = position.lastIndexOf('/');\n if (slash1 < 0) { // impossible\n $('#index').addClass('active');\n } else {\n var posName = position.substring(slash1 + 1, dot1);\n $('#' + posName).addClass('active');\n }\n }\n}", "updateActiveNavLink( ){\n\t \n\t var navigation = this\n\t .getModel( )\n\t .firstDatarow( )\n\t .navigation;\n\t \n\t var link = navigation.firstDatarow( );\n\t do{\n\n link.active = this\n\n .getRootController( )\n .getRouter( )\n .isNavLinkActive( link.id );\n\n\t \n\t }while( link = navigation.nextDatarow( ) );\n\t}", "function addNavigationItems () {\n for (let i = 0; i < sections.length; i++) {\n const sec = sections[i]\n // Using this for the text\n const value = sec.getAttribute('data-nav')\n // Using this for the click\n const id = sec.id\n const navId = `${navIdRootTag}-${id}`\n navbar.innerHTML += `<li id=\"${navId}\" class='menu__link' jumpto='${id}'> ${value} </li>`\n }\n\n // Now that the navigation has been added we can add listeners to detect clicks\n // Doing it on the parent and then using delegation\n navbar.addEventListener('click', function (evt) {\n const id = evt.target.getAttribute('jumpto')\n window.location.hash = id\n // Makubg the new section the active one\n changeActiveSection(document.getElementById(id))\n // var elmnt = document.getElementById(id);\n // elmnt.scrollIntoView(true);\n })\n}", "function setCurrentLink(){\n if (sidenav) {\n let h3s = document.querySelectorAll('h3');\n let scrollPos = document.documentElement.scrollTop;\n let topHead = h3s[0];\n let i = 0;\n let found = false;\n while (!found && i < h3s.length) {\n if (scrollPos < h3s[i].offsetTop){\n found = true;\n }\n else {\n topHead = h3s[i];\n }\n i++;\n }\n let href = topHead.id;\n let oldLink = document.querySelector('.usa-sidenav__sublist .usa-current');\n if (oldLink) {\n oldLink.classList.remove('usa-current');\n }\n let currentLink = document.querySelector('.usa-sidenav__sublist [href=\"#'+href+'\"]').parentElement;\n currentLink.classList.add('usa-current');\n }\n}", "function updateNavigation(){\n\t\n\t\t// Just recreate the contents of the bar to keep things simple\n\t\tcontext.navElement.innerHTML = '<a onclick=\"this.parentNode.cardList.setPage(0)\" title=\"First Page\"><img src=\"https://deckmaven.com/images/first.svg\"></a> ';\n\t\tcontext.navElement.innerHTML += '<a onclick=\"this.parentNode.cardList.setPage(' + ( context.currentPage - 1 ) + ')\" title=\"Previous Page\"><img src=\"https://deckmaven.com/images/previous.svg\"></a> ';\n\t\tcontext.navElement.innerHTML += '<span class=\"topTab\"> Page ' + ( context.currentPage + 1 ) + ' of ' + ( context.pageCount ) + '</span>';\n\t\tcontext.navElement.innerHTML += ' <a onclick=\"this.parentNode.cardList.setPage(' + ( context.currentPage + 1 ) + ')\" title=\"Next Page\"><img src=\"https://deckmaven.com/images/next.svg\"></a>';\n\t\tcontext.navElement.innerHTML += ' <a onclick=\"this.parentNode.cardList.setPage(' + ( context.pageCount - 1 ) + ')\" title=\"Last Page\"><img src=\"https://deckmaven.com/images/last.svg\"></a>';\n\t\t\n\t}", "function dynamicLink(link, nav) {\n let linkID = window.location.search\n let userID = linkID.slice(4)\n dynamicLink = link + linkID\n nav.setAttribute('href', dynamicLink)\n }", "function updateActiveAnchor(label, href)\n {\n // Get the navigation data for the scene\n var scene_navigation_data = scenes_navigation[href.replace('#', '')];\n\n if (scene_navigation_data !== undefined)\n {\n // Update the active anchor\n active_anchor.html(label);\n active_anchor.attr('href', href);\n\n // Clear the HTML of the scene navigation\n scene_navigation.html('');\n scene_navigation.hide();\n\n // Render the scene navigation\n for (var i = 0; i < scene_navigation_data.navigation.length; i++)\n {\n scene_navigation.append('<li><a href=\"#' + scene_navigation_data.navigation[i].id + '\">' + scene_navigation_data.navigation[i].label + '</a></li>');\n }\n\n // Display the scene navigation\n scene_navigation.show();\n }\n }", "function updateNav(item) {\n $('button.navigation').removeClass('active');\n $('button.navigation[name=' + item + ']').addClass('active');\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the heading from one LatLng to another LatLng. Headings are expressed in degrees clockwise from North within the range [180,180).
function computeHeading(from, to) { // http://williams.best.vwh.net/avform.htm#Crs var fromLat = toRadians(from.lat); var fromLng = toRadians(from.lng); var toLat = toRadians(to.lat); var toLng = toRadians(to.lng); var dLng = toLng - fromLng; var heading = Math.atan2( Math.sin(dLng) * Math.cos(toLat), Math.cos(fromLat) * Math.sin(toLat) - Math.sin(fromLat) * Math.cos(toLat) * Math.cos(dLng)); return wrap(toDegrees(heading), -180, 180); }
[ "function GPSHeading(){\n var previousLocation = locationHistory[locationHistory.length-1];\n var previousLocation2 = locationHistory[locationHistory.length-2];\n heading = new google.maps.geometry.spherical.computeHeading(previousLocation, previousLocation2);\n}", "function heading(x,y){\n\treturn Math.atan(y/x); \t\n}", "heading() {\n return Math.atan2(this.y, this.x);\n }", "function getHeading(pointA, pointB){\n if (pointA && pointB){\n return google.maps.geometry.spherical.computeHeading(pointA.location.latLng, pointB.location.latLng);\n } else {\n //This should never run\n console.error('Cannot calculate heading for null point', pointA, pointB);\n }\n }", "function GPSHeading(previousLocation){\n // Calculate the bearing using previousLocation and userLocation\n var GPSHeading = getBearing(previousLocation.lat, previousLocation.long, \n userLocation.lat, userLocation.long);\n userHeading = 360 - GPSHeading;\n \n // Update the display with the new heading\n updateDisplay();\n}", "raw_heading() {\n this._heading = Math.atan2(this._mag[X], this._mag[Y]);\n\n if (this._heading < 0) {\n this._heading += 2 * Math.PI;\n }\n\n if (this._heading > 2 * Math.PI) {\n this._heading -= 2 * Math.PI;\n }\n\n this._heading_degrees = Math.round(100 * 180 * this._heading / Math.PI) / 100;\n\n return this._heading_degrees;\n }", "function headingCompass(args) {\n var compassHead = \"\";\n\n //gets orientation and set the compass head if landscape (subtracs 90 degrees)\n //console.log(\"Compass pointing to: \"+compassHeading)\n args = args - compassHeading;\n if (args<0) {\n args = 360 + args;\n }\n if (args>12 && args<=34) {\n compassHead = L('NNE');\n } else if (args>34 && args<=57) {\n compassHead = L('NE');\n } else if (args>57 && args<=80) {\n compassHead = L('ENE');\n } else if (args>80 && args<=102) {\n compassHead = L('E');\n } else if (args>102 && args<=124) {\n compassHead = L('ESE');\n } else if (args>124 && args<=147) {\n compassHead = L('SE');\n } else if (args>147 && args<=170) {\n compassHead = L('SSE');\n } else if (args>170 && args<=192) {\n compassHead = L('S');\n } else if (args>192 && args<=215) {\n compassHead = L('SSW');\n } else if (args>215 && args<=237) {\n compassHead = L('SW');\n } else if (args>237 && args<=260) {\n compassHead = L('WSW');\n } else if (args>260 && args<=282) {\n compassHead = L('W');\n } else if (args>282 && args<=305) {\n compassHead = L('WNW');\n } else if (args>305 && args<=327) {\n compassHead = L('NW');\n } else if (args>327 && args<=350) {\n compassHead = L('NNW');\n } else {\n compassHead = L('N');\n } \n\n return compassHead\n}", "function fromDirectionToHeading(direction) {\n\t\tvar mapping = {\"N\": \"0\", \"NE\": \"45\", \"E\": \"90\", \"SE\": \"135\", \"S\": \"180\", \"SW\": \"225\", \"W\": \"270\", \"NW\": \"315\"};\n\t\treturn direction ? mapping[direction] : \"\";\n\t}", "function getPixelHeading(origin, destination) {\n\t origin = getPosition(origin);\n\t destination = getPosition(destination);\n\t var _a = mercatorPositionsToPixels([origin, destination], 21), p1 = _a[0], p2 = _a[1];\n\t var dx = (p2[0] - p1[0]);\n\t var dy = (p1[1] - p2[1]);\n\t var alpha = ((5 / 2 * Math.PI) - Math.atan2(dy, dx)) * INV_PI_BY_180 % 360;\n\t return alpha;\n\t}", "function ComputeTargetHeading(targetPos)\n{\n var targetDirection = targetPos.Sub(me.placeable.WorldPosition());\n targetDirection.y = 0; // for now at least, we're only interested in motion on the XZ plane\n return Math.atan2(-targetDirection.x, -targetDirection.z) * (180 / Math.PI);\n}", "get heading() {\n return this.model.fromRads(this.theta)\n }", "function ComputeTargetHeading(entity, targetPos)\n{\n var targetDirection = targetPos.Sub(entity.placeable.WorldPosition());\n targetDirection.y = 0; // for now at least, we're only interested in motion on the XZ plane\n return Math.atan2(-targetDirection.x, -targetDirection.z) * (180 / Math.PI);\n}", "function heading(){\n return position.heading;\n }", "function arrowHead(points) {\n\tvar from=points[points.length-2];\n\tvar to=points[points.length-1];\n \n\tvar heading = google.maps.geometry.spherical.computeHeading(to, from).toFixed();\n\tif(heading < 0){\n\t\tvar num = new Number(360);\n\t\tvar addNum = new Number(heading);\n\t\theading = addNum + num;\n\t}\n\t\n\t// == obtain the bearing between the last two points\n\t/* var p1=points[points.length-2];\n \tvar p2=points[points.length-1];\n \tvar dir = bearing(p1,p2);*/\n\t\n\t// == round it to a multiple of 3 and cast out 120s\n\tvar dir = Math.round(heading/3) * 3;\n\twhile (dir >= 120) {dir -= 120;}\n\t// == use the corresponding triangle marker \n\tvar returnImage = \"http://www.google.com/intl/en_ALL/mapfiles/dir_\"+dir+\".png\";\n\t//alert(returnImage);\n \treturn returnImage;\n}", "function headingDegreesToDirection(degrees){\n // Clockwise rotation\n if (degrees < 22.5 || degrees >= 337.5){\n return 'South to North';\n } else if (degrees >= 22.5 && degrees < 67.5) {\n return 'Southwest to Northeast';\n } else if (degrees >= 67.5 && degrees < 112.5) {\n return 'West to East'\n } else if (degrees >= 112.5 && degrees < 157.5) {\n return 'Northwest to Southeast';\n } else if (degrees >= 157.5 && degrees < 202.5) {\n return 'North to South';\n } else if (degrees >= 202.5 && degrees < 247.5) {\n return 'Northeast to Southwest';\n } else if (degrees >= 247.5 && degrees < 292.5) {\n return 'East to West';\n } else if (degrees >= 292.5 && degrees < 337.5) {\n return 'Southeast to Northwest';\n } else {\n return 'unknown';\n }\n}", "function compassHeading(rad){\n // force rad into range of zero to two-pi\n if(rad < 0)\n rad = 2*PI - (-rad % (2*PI));\n else\n rad = rad % (2*PI);\n // convert heading from radians-from-east to degrees-from-north\n let heading = map(rad,0,2*PI,90,450) % 360;\n let compass;\n // calculate compass direction\n if(heading < 11.25)\n compass = 'N';\n else if(heading < 33.75)\n compass = 'NNE';\n else if(heading < 56.25)\n compass = 'NE';\n else if(heading < 78.75)\n compass = 'ENE';\n else if(heading < 101.25)\n compass = 'E';\n else if(heading < 123.75)\n compass = 'ESE';\n else if(heading < 146.25)\n compass = 'SE';\n else if(heading < 168.75)\n compass = 'SSE';\n else if(heading < 191.25)\n compass = 'S';\n else if(heading < 213.75)\n compass = 'SSW';\n else if(heading < 236.25)\n compass = 'SW';\n else if(heading < 258.75)\n compass = 'WSW';\n else if(heading < 281.25)\n compass = 'W';\n else if(heading < 303.75)\n compass = 'WNW';\n else if(heading < 326.25)\n compass = 'NW';\n else if(heading < 348.75)\n compass = 'NNW';\n else\n compass = 'N';\n heading = round(heading);\n return heading + '\\u00B0 '/* degree sign */ + compass;\n}", "function normalizeHeading(heading) {\n heading = heading % 360;\n if (heading < 0) heading = 360 + heading;\n return heading;\n}", "function getBearing(startLat, startLng, endLat, endLng){\n var y = Math.sin(endLng-startLng) * Math.cos(endLat);\n var x = Math.cos(startLat)*Math.sin(endLat) - Math.sin(startLat)*Math.cos(endLat)*Math.cos(endLng-startLng);\n var brng = Math.atan2(y, x);\n brng = brng * (180.0 / Math.PI);\n brng = (brng + 360) % 360;\n return brng;\n}", "function getBearing(startLat,startLong,endLat,endLong){\n startLat = radians(startLat);\n startLong = radians(startLong);\n endLat = radians(endLat);\n endLong = radians(endLong);\n\n var dLong = endLong - startLong;\n\n var dPhi = Math.log(Math.tan(endLat/2.0+Math.PI/4.0)/Math.tan(startLat/2.0+Math.PI/4.0));\n if (Math.abs(dLong) > Math.PI){\n if (dLong > 0.0)\n dLong = -(2.0 * Math.PI - dLong);\n else\n dLong = (2.0 * Math.PI + dLong);\n }\n\n return (degrees(Math.atan2(dLong, dPhi)) + 360.0) % 360.0;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Draw a filled circle with the given size and color to the context.
function drawCircleAndFill(ctx, size, color) { drawCircle(ctx, size); ctx.fillStyle = color; ctx.fill(); }
[ "function drawCircle(ctx, size) {\n ctx.beginPath();\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2, true);\n ctx.closePath();\n}", "function drawCircle(cX, cY, cSize, cColor) {\n noStroke();\n fill(cColor);\n ellipse(cX, cY, cSize, cSize);\n}", "function fillCircle(ctx,x,y,r,color){\n\tctx.fillStyle = color;\n\tctx.beginPath();\n\tctx.arc(x,y,r, 0, Math.PI*2, true); \n\tctx.closePath();\n\tctx.fill();\n}", "function drawcircle(x, y, radius, color){\n ctx.beginPath();\n ctx.arc(x, y, radius, 0, Math.PI*2);\n ctx.fillStyle = color;\n ctx.fill();\n}", "function strokeCircle(ctx, size, color) {\n drawCircle(ctx, size);\n ctx.strokeStyle = color;\n ctx.stroke();\n}", "function printCircle(x, y, size, color) {\n context.beginPath();\n if(!color)\n color =\"#FF0000\"\n context.arc(tile_size*x+size/2, tile_size*y+size/2, size, 0, 2 * Math.PI, false);\n context.fillStyle = color;\n context.fill();\n context.stroke();\n}", "function drawCircle(x, y, size, offset, fill){\n\tif(size === undefined){\n\t\tsize = 3/8;\n\t}\n\tif(offset === undefined){\n\t\toffset = STEP / 2;\n\t}\n\tif(fill === undefined){\n\t\tfill = true;\n\t}\n\tctx.beginPath();\n\tctx.arc(x+offset, y+offset, STEP*size, 0, Math.PI*2);\n\tif(fill){\n\t\tctx.fill();\n\t}\n\tctx.stroke();\n}", "function drawCircle(cX, cY, cSize, cColor) {\n ellipseMode(CORNER);\n noStroke();\n fill(cColor);\n ellipse(cX, cY, cSize, cSize);\n}", "function colorCircle(centerX, centerY, radius, drawColor) {\n ctx.fillStyle = drawColor;\n ctx.beginPath();\n ctx.arc(centerX, centerY, radius, 0, Math.PI * 2, true);\n ctx.fill();\n}", "function drawCircle(cX, cY, cSize, cColor) {\n\tellipseMode(CORNER);\n\tstrokeWeight(6);\n\tstroke(135, 206, 250);\n\tfill(cColor);\n\tellipse(cX, cY, cSize, cSize);\n}", "function drawCircle(canvasContext, posX, posY, radius, color) {\r\n // draw the circle\r\n canvasContext.beginPath();\r\n canvasContext.arc(posX, posY, radius, 0, Math.PI * 2, false);\r\n canvasContext.closePath();\r\n\r\n // color in the circle\r\n canvasContext.fillStyle = color.AsTextRGB();\r\n canvasContext.fill();\r\n}", "function drawCircle( center, radius, color ) {\n if (color === undefined) {\n color = black8;\n }\n ctx.beginPath();\n ctx.arc(\n center[0], // center x coordinate\n center[1], // center y coordinate\n radius, // radius\n 0, // starting angle\n 2 * Math.PI // ending angle\n );\n ctx.closePath();\n\n if ( radius < 40 ) {\n ctx.fillStyle = color;\n ctx.fill();\n } else {\n ctx.strokeStyle = color;\n ctx.stroke();\n }\n}", "function fillCircle (x, y, r)\n{\n ctx.beginPath ();\n ctx.arc (x, y, r, 0, 2 * Math.PI);\n ctx.fill ();\n}", "function createFilledCircle(x,y,radius,color){\n let circle = GOval(x - radius,y - radius,2 * radius,2 * radius);\n circle.setColor(color);\n circle.setFilled(true);\n return circle;\n }", "function circle(ctx,x_center,y_center,radius,shade) {\n ctx.fillStyle = \"rgb(\"+shade+\",\"+shade+\",\"+shade+\")\";\n ctx.beginPath();\n ctx.arc(x_center,y_center,radius,0,2*Math.PI,false);\n ctx.arc(x_center,y_center,radius-8,0,2*Math.PI,true);\n ctx.fill();\n }", "function createCircle(color, size, xPos, yPos){\n\t\tvar circle = new createjs.Shape();\n\n\t\tcircle.graphics.beginFill(color).drawCircle(0,0,size);\n\t\tcircle.x = xPos;\n\t\tcircle.y = yPos;\n\t\treturn circle;\n\t}", "function drawEffectCircle(x, y, r, color) {\r\n ctx.beginPath();\r\n ctx.arc(x, y, r, 0, 2 * Math.PI);\r\n ctx.fillStyle = color\r\n ctx.fill();\r\n}", "function drawCircle(pos, color) {\n var can = document.getElementById(\"mainCanvas\");\n var ctx = can.getContext(\"2d\");\n ctx.fillStyle = color;\n ctx.beginPath();\n ctx.arc(coin2Pos(pos)[0], coin2Pos(pos)[1], circleRadius, 0, 2 * Math.PI, false);\n ctx.fill();\n}", "function drawEllipse(canvasCtx, centerX, centerY, bigRadius, smallRadius, from, to, isFilled, fillColor, strokeColor) {\n canvasCtx.beginPath();\n var step = 2 * Math.PI / 40;\n for (var angle = from; angle <= to; angle += step) {\n var currentX = centerX + bigRadius * Math.cos(angle);\n var currentY = centerY - smallRadius * Math.sin(angle);\n\n canvasCtx.lineTo(currentX, currentY);\n\n }\n\n canvasCtx.lineWidth = 3;\n if (isFilled) {\n canvasCtx.fillStyle = fillColor;\n canvasCtx.fill();\n }\n\n canvasCtx.strokeStyle = strokeColor;\n canvasCtx.stroke();\n canvasCtx.closePath();\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for mouseleave events on hover items or their children. This will hide the hover details for the item. Args: evt (Event): The mouseleave event.
_onHoverItemMouseLeave(evt) { $(evt.target).closest('.infobox-hover-item') .removeClass('infobox-hover-item-opened'); }
[ "_onMouseleave(ev) {\n this.unactivate();\n this.get('canvas').draw();\n this.emit('itemunhover', ev);\n return;\n }", "_itemOnMouseLeave() {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (JQX.ListBox.DragDrop.Dragging) {\n that.$.removeClass('jqx-list-item-line-feedback');\n that.$.removeClass('jqx-list-item-bottom-line-feedback');\n }\n\n that.removeAttribute('hover');\n }", "_itemOnMouseLeave() {\n const that = this;\n\n if (!that.ownerListBox) {\n return;\n }\n\n if (Smart.ListBox.DragDrop.Dragging) {\n that.$.removeClass('smart-list-item-line-feedback');\n that.$.removeClass('smart-list-item-bottom-line-feedback');\n }\n\n that.removeAttribute('hover');\n }", "function winMouseLeave(evt) {\n if (helper.getEventTarget(evt).id === BP_CONST.BADGE_ID) {\n mouseLeaveShrinkTimer = nativeGlobal.setTimeout(shrinkPanel, BP_CONST.MOUSELEAVE_DELAY_SHRINK_BP);\n }\n }", "handleMouseLeave() {\n this.props.hideThumbnail();\n }", "mouseLeave() {\n this.tooltipBox.style(\"visibility\", \"hidden\");\n }", "function hideCreateLinkOnEventItemHover() {\n element.on('mouseenter', function () {\n element.on('mousemove', checkForEventItemRAF);\n });\n element.on('mouseleave', function () {\n element.off('mousemove', checkForEventItemRAF);\n element.removeClass('md-event-hover');\n });\n var lastHoverItem;\n var checkForEventItemRAF = $$rAF.throttle(checkForEventItem);\n\n function checkForEventItem(e) {\n if (mdEventCalendarCtrl.isCreateDisabled() === true) {\n return;\n }\n if (lastHoverItem === e.target) {\n return;\n }\n lastHoverItem = e.target;\n var targetIsEvent = !!e.target.getAttribute('md-event-id');\n element.toggleClass('md-event-hover', targetIsEvent);\n }\n }", "function mouseleave(e){\n\t\tmouseIsDown = false;\n\t\tnewFurniture = undefined;\n\t}", "function onMouseLeave() {\n LxNotificationService.success('Mouse leave callback');\n }", "function mouseLeave(e)\n {\n cancelEvents($(this));\n }", "onMouseLeave(event) {\n const me = this,\n { relatedTarget } = event,\n leavingToChild = relatedTarget && me.owns(relatedTarget);\n\n let targetCmp = relatedTarget && relatedTarget instanceof HTMLElement && IdHelper.fromElement(relatedTarget),\n shouldHideMenu = !leavingToChild;\n\n if (targetCmp) {\n while (targetCmp.ownerCmp) {\n targetCmp = targetCmp.ownerCmp;\n }\n\n // Or was found and does not belong to current menu DOM tree\n // This condition will not allow possibly existing picker to hide\n // Covered by Menu.t.js\n shouldHideMenu &= !DomHelper.getAncestor(targetCmp.element, [event.target]);\n }\n\n if (!leavingToChild && shouldHideMenu) {\n me.currentSubMenu && me.currentSubMenu.hide();\n me.currentSubMenu = me.selectedElement = null;\n\n // Deactivate currently active *menu items* on mouseleave\n if (me.element.contains(document.activeElement) && document.activeElement.matches('.b-menuitem')) {\n me.element.focus();\n }\n }\n }", "function onImageMouseLeave(event){\n\t\t\n\t\tg_temp.positionFrom = \"hideCompactElements\";\n\t\t\n\t\tif(g_temp.isArrowsOnHoverMode == true && isSliderImageInPlace() == true)\n\t\t\thideArrows(false, true);\n\t\t\n\t}", "function hideTooltipOnMouseLeave() {\n\t\t\tresetTracker();\n\t\t\tchartPosition = null; // also reset the chart position, used in #149 fix\n\t\t}", "function box_mouseleaveHandler(event) {\r\n closeBox(this);\r\n }", "function on_mouse_leave() {}", "_afterMouseLeaveHook() { }", "function doOnItemMouseLeave(){\n\t\t\tif(!$(this).find('.'+o.itemLoadingClass).length){\n\t\t\t\telemFadeOut($(this).find('.'+o.plusClass), 0);\n\t\t\t\tif(!o.desaturate){\n\t\t\t\t\telemFadeIn($(this).find('img'));\n\t\t\t\t}\n\t\t\t}\n\t\t}", "onItemMouseOut() {\n this.hideMainMarker();\n }", "function cardMouseLeaveHandler () {\n\n mouseOver = false;\n\n // reset index\n thumbnailIndex = 0;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This.state constructor initialises the variabes/arrays: overall_rating, price_rating, quality_rating, clenliness_rating, review_body, locationData, loc_id, loc_name and ButtonState
constructor(props) { super(props); this.state={ overall_rating: "", price_rating: "", quality_rating: "", clenliness_rating: "", review_body: "", locationData: [], loc_id: "", loc_name: "", ButtonState: false, isLoading: true } }
[ "constructor(props) {\n super(props);\n this.state={\n overall_rating: \"\",\n price_rating: \"\",\n quality_rating: \"\",\n clenliness_rating: \"\",\n review_body: \"\",\n locationData: [],\n loc_id: \"\",\n ButtonState: false,\n isLoading: true\n }\n }", "constructor() {\n super();\n\n let buttonArray = this.generateButtons();\n let colourArray = this.generateDefaultColours();\n \n this.state = {\n buttonPixels: buttonArray,\n buttonPixelColours: colourArray,\n selectedColour: `#fff`,\n title: \"\",\n authour: \"\", \n }\n }", "constructor(props) {\n super(props);\n this.state = {\n rating: 0\n };\n }", "constructor(props) {\n super(props);\n this.state={\n locationData: [],\n loc_id: \"\",\n locationRev: [],\n rev_id: \"\",\n isLoading: true\n }\n }", "constructor(props) {\n super(props);\n this.state={\n userReviews: [],\n favouriteCoffee: [],\n rev_id: \"\",\n loc_id: \"\",\n isLoading: true\n }\n }", "constructor(props) /* A. */ {\n super(props);\n this.state = {rating: this.props.rating};\n }", "constructor(state, numActions) {\n this.state = Array.from(state);\n this.actions = new Array(numActions);\n //elements are floats representing the qScore\n for (let i = 0; i < this.actions.length; i++) {\n this.actions[i] = 0;\n }\n }", "constructor(props) {\n super();\n this.state = {\n editing: false,\n rating: props.dog.rating\n\n };\n // Bind function (used in button)\n }", "constructor(props) {\n super(props)\n const { nb, rating } = props\n let nbStars = nb ? nb : 5\n const stars = []\n for (var i = 0; i < nbStars; i++) {\n const value = i < rating\n stars.push(value)\n }\n this.state = {\n stars\n }\n }", "initializeState() {}", "function stateInit()\n{\n\tstateNew = {\n\t\t'frontdoor':{\n\t\t\t\"3311\":{\"0\":{\"5850\": false}} // 'lock_sta'\n\t\t},\n\t\t'livingroom':{\n\t\t\t\"3311\":{\"0\":{\"5850\": false}},// 'light_sta'\n\t\t\t\"3303\":{\"0\":{\"5700\": 0}} // 'temp'\n\t\t}\n\t}\n}", "constructor(props){\n super(props);\n this.state = {\n lastKey: 0,\n keysRounded: false,\n keys: [],\n fetchedItems: [],\n SnackCat: \"Chips\",\n categories: [],\n firstLaunch: null,\n update: false\n }\n }", "function p4_initialise_state(){\n var board;\n if (P4_USE_TYPED_ARRAYS){\n board = new Int32Array(121);\n P4_BASE_WEIGHTS = new Int32Array(120);\n P4_BASE_PAWN_WEIGHTS = new Int32Array(120);\n\n }\n else {\n board = [];\n P4_BASE_WEIGHTS = [];\n P4_BASE_PAWN_WEIGHTS = [];\n }\n var zeros = [];\n for(var i = 0; i < 120; i++){\n var y = parseInt(i / 10);\n P4_BASE_PAWN_WEIGHTS[i] = parseInt(P4_PAWN_WEIGHTS.charAt(y), 35);\n P4_BASE_WEIGHTS[i] = parseInt(P4_WEIGHT_STRING.charAt((i < 60) ? i : 119 - i),\n 35) & 15;\n board[i] = 16;\n zeros[i] = 0;\n }\n function _weights(){\n if (P4_USE_TYPED_ARRAYS)\n return new Int32Array(120);\n return zeros.slice();\n }\n\n board[P4_OFF_BOARD] = 0;\n var state = {\n board: board,\n pawn_promotion: [P4_QUEEN, P4_QUEEN],\n pweights: [_weights(), _weights()],\n kweights: [_weights(), _weights()],\n weights: [_weights(), _weights()],\n history: []\n };\n return state;\n}", "componentWillMount()\n {\n /* Getting the rating passed to the ratings object */\n let rating = this.props.rating\n\n /* Initializing the ratings array */\n let star_values = [];\n\n /* Product Rating Star Conversion */\n for (let i = 0; i < 5; i++)\n {\n /* Defaulting to max value */\n let product_value_to_be_set = 100;\n let brand_value_to_be_set = 100;\n\n /* Product Rating Checks */\n if (rating < 20) { product_value_to_be_set = (rating / 20) * 100; }\n if (rating <= 0) { product_value_to_be_set = 0; }\n\n /* Brand Rating Checks */\n if (rating < 20) { brand_value_to_be_set = (rating / 20) * 100; }\n if (rating <= 0) { brand_value_to_be_set = 0; }\n\n /* Setting the array of values */\n star_values[i] = product_value_to_be_set;\n\n /* Decrementing to the next star */\n rating -= 20;\n }\n\n let uniqueString = nanoid()\n let starOneID = uniqueString.slice(0,4)\n let starTwoID = uniqueString.slice(4,8)\n let starThreeID = uniqueString.slice(8,12)\n let starFourID = uniqueString.slice(12,16)\n let starFiveID = uniqueString.slice(16,20)\n\n /* Setting the state */\n this.setState({\n\n starOne: star_values[0],\n starTwo: star_values[1],\n starThree: star_values[2],\n starFour: star_values[3],\n starFive: star_values[4],\n\n starOneID: starOneID,\n starTwoID: starTwoID,\n starThreeID: starThreeID,\n starFourID: starFourID,\n starFiveID: starFiveID\n\n })\n }", "constructor(props) {\n super(props);\n this.state = {\n remainingVerifications: [...this.props.allVerifications],\n remainingAnswers: [...this.props.allAnswers],\n remainingTrialLengths: [...this.props.trialLengths],\n scoreResults: [] \n // array of JSON objects of verifyScore, recallScore, trialLength (TODO: ScoreResult object?)\n };\n \n this.recordResultsAndAdvance = this.recordResultsAndAdvance.bind(this);\n }", "constructor(props) {\n super(props);\n this.state = {\n symbol: [{\n numberOfAnalysts: 0,\n priceTargetAverage: 0,\n priceTargetHigh: 0,\n priceTargetLow: 0,\n symbol: \"\",\n updatedDate: \"\",\n }],\n currentPage: 1,\n todosPerPage: 3,\n id: \"\",\n pressed: false,\n balancesheet: [\n ]\n\n }\n }", "constructor() {\n super();\n\n this.state = {\n recommendedOffers: staticoffers\n }\n }", "initializeState() {\n const attrs = this.state.attributes;\n attrs.x = 0;\n attrs.y = 0;\n }", "constructor(props) {\n super(props);\n this.state={\n locationData: [],\n loc_id: \"\",\n loc_name: \"\",\n isLoading: true\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
slides to the CREDITs screen
function creditsScreen() { $box3.animate({left: 0}, 150); // moves the screen into the main container display currentPage = 'creditspage'; }
[ "function showCredits()\n\t{\n\t\tapp.externalJump(app.paths.mediaCreds + '#' + location.href);\n\t}", "function mainMenutoCredits() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'MAIN_MENU' && store.getState().currentPage == 'CREDITS') {\n mainSfxController(preloaderSfxSource);\n preloaderStarter();\n\n mainMenuCreditsButtonid.classList.add('nodisplay');\n mainMenuStartButtonid.classList.add('nodisplay');\n\n setTimeout(function(){\n mainMenu.classList.add('pagehide');\n credits.classList.remove('pagehide');\n mainMenuPlayonmobileButtonid.classList.remove('main-menu-playonmobile-button');\n mainMenuArmorgamesImageid.classList.remove('main-menu-armorgames-image');\n mainMenuIronhideImageid.classList.remove('main-menu-ironhide-image');\n mainMenuStartImageid.classList.remove('main-menu-start-image');\n mainMenuCreditsImageid.classList.remove('main-menu-credits-image');\n mainMenuArmorgamesImageid.classList.remove('main-menu-armorgames-image-ls');\n mainMenuIronhideImageid.classList.remove('main-menu-ironhide-image-ls');\n mainMenuStartImageid.classList.remove('main-menu-start-image-ls');\n mainMenuCreditsImageid.classList.remove('main-menu-credits-image-ls');\n }, 600);\n }\n }", "function displayCredits()\n{\n\ttitleScreen.visible = false;\n\t\n\tendScreen.visible = false;\n\t\n\tcreditsScreen.addChild(backBtn);\n\t\n\tcreditsScreen.visible = true;\n\t\n\tgame.visible = false;\n}", "function loadCredits(){\n\t\tpgame.state.start('credits');\n\t}", "function BillingButtonClickHandler()\n{\n SlideToPage(\"billing.html\");\n}", "function gotoCredits(){\n\ttitleMusic.stop();\n\tgame.state.start('Credits');\t\n}", "function showCreditsPanel() {\n\n isCreditsPanelVisible = true;\n creditsButton.innerHTML = \"Hide Credits\";\n\n creditsPanelRef.style.bottom = \"0px\";\n\n // Hide the editor\n hideEditor();\n\n // Shrink the scoreboard contents\n shrinkScoreboardContents();\n}", "viewCard(){\n\t\tpage.navigate(\"/\"+this.card.ownerInfo.customURL);\n\t}", "function goContact() {\n setDisplay('contact');\n }", "switchToPage() {\n getCardSlider().selectCardByValue(this.page_, true);\n }", "function openCreditsDialog() {\n\tdialogs.openDialog(dialogs.generateDialog('What is Wunderlist?', html.generateCreditsDialogHTML(), 'dialog-credits'));\n}", "function CreditstoMainMenu() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'CREDITS' && store.getState().currentPage == 'MAIN_MENU') {\n mainSfxController(preloaderSfxSource);\n preloaderStarter();\n\n setTimeout(function(){\n credits.classList.add('pagehide');\n mainMenu.classList.remove('pagehide');\n }, 600);\n\n setTimeout(function(){\n mainMenuCreditsButtonid.classList.remove('nodisplay');\n mainMenuStartButtonid.classList.remove('nodisplay');\n }, 1400);\n\n mainMenuPlayonmobileButtonid.classList.add('main-menu-playonmobile-button');\n mainMenuArmorgamesImageid.classList.add('main-menu-armorgames-image');\n mainMenuIronhideImageid.classList.add('main-menu-ironhide-image');\n mainMenuStartImageid.classList.add('main-menu-start-image');\n mainMenuCreditsImageid.classList.add('main-menu-credits-image');\n }\n }", "function mouseClickCredits(e) {\r\n\tcredits.alpha = 1;\r\n\thome.alpha = 0;\r\n\tstage.addChild(credits);\r\n\tcreditsScreen();\r\n\t\r\n\t}", "function donateMoneyPage()\n {\n // Code to take us to the donate page\n location.href = \"https://d4q2.github.io/donatemoney\";\n }", "function goToBuzzer(){\n clientValuesFactory.setActiveWindow(windowViews.buzzer);\n }", "function toAboutPage() {\n setHeader('About');\n hideAll();\n changeAboutDisplay('flex');\n }", "function creditDebitCards() {\n document.getElementById('creditDebitCardsBtn').style.background = \"$turquoise\";\n document.getElementById('paypalBtn').style.background = \"$grey\";\n document.getElementById('alipayBtn').style.background = \"$grey\";\n\n document.getElementById('cardsForm').style.display = \"block\";\n document.getElementById('payPal').style.display = \"none\";\n document.getElementById('aliPay').style.display = \"none\";\n}", "function goToContact() {\n var index = $(\".slider\").find(\".active\").index();\n var name = $(\".name\").index();\n var about = $(\".about\").index();\n var contact = $(\".contact\").index();\n\n switch (index) {\n case name:\n $(\".slider\").slider(\"prev\");\n pause();\n break;\n case about:\n $(\".slider\").slider(\"next\");\n pause();\n break;\n case contact:\n pause();\n break;\n };\n\n document.title = \"Melissa Womack | Contact\";\n }", "function showCreditScreen() {\n if (tempCreditChecker) {\n canvasContext.font = \"15px arial bold\";\n canvasContext.fillStyle = 'lime';\n canvasContext.textAlign = 'left';\n canvasContext.fillText(\">>>CREDITS: <#OPENSOURCE!>\", 10, canvas.height / 1.5);\n tempCreditChecker = false;\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initiate the image picker
function initializeImagePicker() { $('#selectProjectImages').imagepicker({ selected: onImagePickerOptionChange }); $('#selectProjectImages') .data('picker') .sync_picker_with_select(); }
[ "function initPicker() {\n //so not selected when started\n $(\"select\").prop(\"selectedIndex\", -1);\n\n $(\"select\").imagepicker({\n hide_select : true,\n show_label : true\n })\n }", "function image_picker_noop() {}", "async openPickerAsync() {\n // Request permissions to access the user's media libraries.\n let permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync();\n if (permissionResult.granted == false) {\n alert(\"Permissions are required to access your image gallery. Please enable them and retry.\");\n return;\n }\n\n // Launch the image picker and wait for the user to select an image.\n let pickerResult = await ImagePicker.launchImageLibraryAsync();\n if (pickerResult.cancelled === true) {\n return;\n }\n\n // When image is selected, push new image into the state.\n var imgsArray = this.state.images;\n imgsArray.push(pickerResult);\n this.setState({ images: imgsArray })\n }", "function initImageFileUploadUI() {\n\t$(\".profileImageInput\").fileinput({\n\t overwriteInitial: true,\n\t maxFileSize: 1500,\n\t showClose: true,\n\t showCaption: false,\n\t browseLabel: '',\n\t removeLabel: '',\n\t browseIcon: '<i class=\"fa fa-folder-open fa-fw\"></i>',\n\t removeIcon: '<i class=\"fa fa-close fa-fw\"></i>',\n\t removeTitle: 'Cancel or reset changes',\n\t elErrorContainer: '#kv-avatar-errors-1',\n\t msgErrorClass: 'alert alert-block alert-danger',\n\t defaultPreviewContent: '<img src=\"/ackamarackus/assets/images/default_avatar_male.jpg\" alt=\"Your Avatar\">',\n\t layoutTemplates: {main2: '{preview} {browse}'},\n\t allowedFileExtensions: [\"jpg\", \"png\", \"gif\"],\n\t \n\t});\n\t$(\".imageFileinput\").fileinput({\n\t\tshowUpload: false\n\t});\n}", "function imagePicker() {\n var context = imagepicker.create({ mode: \"single\" });\n context\n .authorize()\n .then(function () {\n return context.present();\n })\n .then(function (selection) {\n selection.forEach(function (selected) {\n // process the selected image\n logo = selected.android.toString();\n });\n list.items = selection;\n }).catch(function (e) {\n // process error\n });\n}", "async function handlePickImgBtnClick() {\n let result = await ImagePicker.launchImageLibraryAsync({\n mediaTypes: ImagePicker.MediaTypeOptions.All,\n quality: 1,\n });\n\n if (!result.cancelled) {\n setImage(result.uri);\n }\n }", "function initGalleryUpload() {\n $('.fileinput').fileinput();\n }", "function initOpenImageFile() {\n\t\n\t// instantiate file reader\n\tconst reader = new FileReader();\n\t\n\tconst $form = $(\"#ime-openfile\");\n\tconst $input = $form.find(\"input\");\n\t\n\t// form actions\n\t$form\n\t\t.submit(function(e) {\t\t\n\t\t\t\te.preventDefault();\n\t\t\t})\n\t\t.change(function(e) {\n\t\t\t\t\n\t\t\t// disable controls on file loading\n\t\t\tgui.disableControls();\n\t\t\t\n\t\t\t// read file\n\t\t\treader.readAsDataURL($input[0].files[0]);\t\t\t\n\t\t});\n\t\n\t// on file load\n\treader.onload = function(){\n\t\tvar dataURL = reader.result;\n\t\t\n\t\t// validate file type\n\t\tif ($input[0].files[0].type.substring(0, 5) == \"image\") {\t \t\t\t\n\t\t\t\n\t\t\t// pass src to editor\n\t\t\time.setImageSource(dataURL);\n\t\t} else {\n\t\t\t\n\t\t\tconsole.warn(\"Image Editor error: invalid file type\");\n\t\t\t\n\t\t\tshowError(\"Image Editor error: invalid file type\");\n\t\t\t\n\t\t}\n\t\t\n\t\t// clear information about file from the form\n\t\t$form[0].reset();\t\t\n\t}\n\t\n\t// on file load error\n\treader.onerror = function(){\n\t\n\t\tconsole.warn(\"Image Editor error: can't load the file\");\n\t\t\t\t\n\t\tshowError(\"Image Editor error: can't load the file\");\n\t\t\t\t\n\t\t// clear information about file from the form\n\t\t$form[0].reset();\n\t}\n}", "function initUploader() {\n // Initialize image upload widget\n var uploader = $('.image-editor')\n uploader.cropit({\n // Exported image set to 3x the preview's size\n exportZoom: 3,\n // Set initial image to saved data, if applicable\n imageState: {src: $('#placemark_image_data').val()},\n // When image is loaded:\n onImageLoaded: function() {\n // Set image alt text to image name;\n var imagePath = $('.cropit-image-input').val();\n $('.image-alt').val(imagePath.substring(imagePath.lastIndexOf('\\\\')+1, imagePath.lastIndexOf('.')));\n // Attempt to set location based on coordinate metadata\n setExifLocation();\n }\n });\n // Return uploader to caller's scope\n return uploader;\n }", "function getImg() {\n filepicker.setKey(\"ABDI6UIw6SzCfmtCVzEI3z\");\n filepicker.pick({\n mimetypes: [\"image/*\"],\n container: \"modal\",\n services: filepickerServices(),\n },\n function(InkBlob) {\n $(\"#pic\").find(\".btn[type=submit]\").removeAttr(\"disabled\").removeClass(\"disabled\");\n $(\"#profile_pic\").attr(\"src\", InkBlob.url);\n $(\"#id_pic_url\").attr(\"value\", InkBlob.url);\n });\n}", "function initImageLoading() {\n var imageBox = document.querySelector('.image_box');\n var fileChooser = imageBox.querySelector('.box_file');\n\n if(advancedLoad) {\n imageBox.className += \" advanced\";\n initDragDropListeners(imageBox);\n }\n\n imageBox.addEventListener('click', function() {\n resetInfos(imageBox);\n fileChooser.click();\n });\n\n fileChooser.addEventListener('change', function() {\n checkFiles(imageBox, this.files);\n });\n }", "openPicker() {\n if (this.loading) return;\n\n // Create a hidden HTML input element and click on it so the user can select\n // an avatar file. Once they have, we will upload it via the API.\n const $input = $('<input type=\"file\" accept=\".jpg, .jpeg, .png, .bmp, .gif\">');\n\n $input\n .appendTo('body')\n .hide()\n .click()\n .on('input', (e) => {\n this.upload($(e.target)[0].files[0]);\n });\n }", "init() {\n const cls = this.constructor\n\n // Store a reference to the image set instance against the input\n this.input._mhImageSet = this\n\n // Create the image set element\n this._dom.imageSet = $.create(\n 'div',\n {'class': cls.css['imageSet']}\n )\n\n // Add the image set to the page\n this.input.parentNode.insertBefore(\n this._dom.imageSet,\n this.input.nextSibling\n )\n\n if (this.input.value) {\n const behaviour = this._behaviours.input\n cls.behaviours.input[behaviour](this, 'get')\n this.populate(this.baseVersion)\n } else {\n this.clear()\n }\n }", "function updatePickerImage() {\n if (getEditor() != editor) return;\n let sheet = editor.selectedSheet;\n let image = sheet.paint(\n arkham.sheet.RenderTarget.PREVIEW,\n sheet.templateResolution\n );\n picker.image = image;\n }", "function picker_init() {\n picker_color_render();\n\n picker_layer_toggle();\n}", "function image_chooser() {\n\t\tvar overlay = $('#overlay');\n\t\tvar ic = $('.image_chooser');\n\t\tvar close = $('.image_chooser_close');\n\t\tvar ifc = $('.images_for_chooser');\n\t\tvar current_image = null;\n\t\tvar images = $('.images_for_chooser .images');\n\t\tvar picked = $('.picked');\n\t\tvar submit = $('.image_chooser_submit');\n\t\tvar value = $('.global_logo_value');\n\t\tic.click(function(e) {\n\t\t\topenChooser();\n\t\t\te.preventDefault();\n\t\t\treturn false;\n\t\t});\n\n\t\tfunction openChooser() {\n\t\t\tifc.show();\n\t\t\toverlay.show();\n\t\t}\n\t\tclose.click(function() {\n\t\t\tcloseChooser();\n\t\t});\n\n\t\tfunction closeChooser() {\n\t\t\tifc.hide();\n\t\t\toverlay.hide();\n\t\t}\n\t\t$(document).keyup(function(e) { //clicking escape will hide the overlay \n\t\t\tif (e.keyCode == KEYCODE_ESC) {\n\t\t\t\tcloseChooser();\n\t\t\t}\n\t\t});\n\t\timages.click(function() {\n\t\t\t$('.images').removeClass('image-active');\n\t\t\tcurrent_image = $(this).children('p').text();\n\t\t\tpicked.text(current_image);\n\t\t\t$(this).addClass('image-active');\n\t\t});\n\t\tsubmit.click(function(e) {\n\t\t\tvalue.val(current_image);\n\t\t\tcloseChooser();\n\t\t\te.preventDefault();\n\t\t});\n\t}", "function initImages() {\r\n\r\n Durados.Image.Init();\r\n}", "function init() {\n happyBtn.disabled = true;\n angryBtn.disabled = true;\n drawBtn.disabled = true;\n this.photoId = getRequestedName();\n if (!this.photoId) {\n edited.innerHTML = 'Could not retreive photo information.';\n return;\n }\n edited.innerHTML = 'Loading...';\n getBiggestPhoto(this.photoId);\n}", "requestSelectedImage() {}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function for updating html to update currentPlayers
function updateCurrentPlayersTable() { //remove all current players $(".player").remove(); //append entry to currentPlayers div for each player in currentPlayers for (i = 0; i < gameInfo.currentPlayers.length; i++ ) { var player = $("<h3 class=\"player\"></h3>").text(gameInfo.currentPlayers[i]); $("#currentPlayers").append(player); } }
[ "function updatePlayerInfo() {\n\t\tdocument.getElementById(\"player1name\").innerText = `Name: ${player1.name}`;\n\t\tdocument.getElementById(\"player2name\").innerText = `Name: ${player2.name}`;\n\t\tdocument.getElementById(\n\t\t\t\"player1score\"\n\t\t).innerText = `Score: ${player1.getScore()}`;\n\t\tdocument.getElementById(\n\t\t\t\"player2score\"\n\t\t).innerText = `Score: ${player2.getScore()}`;\n\t\tdocument.getElementById(\"current-player\").innerText = `Current Player: ${\n\t\t\tgameFlow.getCurrentPlayer().name\n\t\t} (${gameFlow.getCurrentPlayer().sign})`;\n\t}", "function updatePlayers(gameInfo) {\n let userhtml = \"\";\n gameInfo.players.forEach(function(p, i) {\n let divClass = $(\"#user-menu\").text().startsWith(p.user.username) ? \"box featured\" : \"box\";\n userhtml += \"<div class=\\\"col-lg-\" + String(Math.floor(12/gameInfo.players.length)) + \" col-md-6 mb-md-4\\\">\" +\n \"<div class=\\\"\" + divClass + \"\\\" data-aos=\\\"zoom-in\\\">\" +\n (p.answer !== \"\" ? \"<h4 id=\\\"playeranswer\\\">\" + p.answer + \"</h4>\" : \"\") +\n \"<h3>\" + p.user.username + \"</h3>\" +\n \"<h4 id=\\\"userpoints\\\">\" + String(p.points) + \"<span> point\" + (p.points === 1 ? \"\" : \"s\") + \"</span></h4>\" +\n \"</div>\" +\n \"</div>\";\n $(\"#user-scores\").html(userhtml);\n });\n\n }", "function updatePlayerName() {\r\n $currentPlayerName.innerHTML = getCurrentPlayerName();\r\n}", "function updatePlayerName() {\n $currentPlayerName.innerHTML = getCurrentPlayerName();\n}", "function updatePlayerDisplay(player) {\n if (player.position === 1 && userPlayer === 1) {\n $(\"#player-1-name\").text(player.name);\n addP1Options();\n $(\"#player-1-stats\").text(\"Wins: \" + player.wins + \" Losses: \" + player.losses);\n database.ref(\"turn\").set(1);\n } else if (player.position === 1) {\n $(\"#player-1-name\").text(player.name);\n $(\"#player-1-stats\").text(\"Wins: \" + player.wins + \" Losses: \" + player.losses);\n } else if (player.position === 2 && userPlayer === 2) {\n $(\"#player-2-name\").text(player.name);\n addP2Options();\n $(\"#player-2-stats\").text(\"Wins: \" + player.wins + \" Losses: \" + player.losses);\n } else if (player.position === 2) {\n $(\"#player-2-name\").text(player.name);\n $(\"#player-2-stats\").text(\"Wins: \" + player.wins + \" Losses: \" + player.losses);\n }\n }", "function updatePlayerStatsView(){\n $('#sidebar-turns').html(gameState.turns);\n $('#sidebar-food').html(gameState.food);\n $('#sidebar-morale').html(gameState.morale);\n $('#sidebar-shelter').html(gameState.shelter);\n $('#sidebar-tools').html(gameState.tools);\n $('#sidebar-common').html(gameState.mat.common);\n $('#sidebar-uncommon').html(gameState.mat.uncommon);\n $('#sidebar-rare').html(gameState.mat.rare);\n }", "function displayCurrentPlayers(players) {\n // clear the players list\n $('#players-list').html('');\n\n //print all the players names and id's\n $.each(players, function(index, el) {\n\n //list out all players to players list screen\n $('<li>').text( el.name ).appendTo($('#players-list')).addClass('players-list__item');\n\n });\n}", "function generateCurrentPlayersHTML(currentPlayers, status) {\n var htmlString = \"Group: <b>\" + groupName + \"</b>\";\n for(var i=0; i<currentPlayers.length; i++){\n if (status == \"edit\"){\n htmlString += \"<div class=\\\"highlight-blue blue-bordered\\\">\";\n }\n else if(status == \"select\"){\n htmlString += \"<div class=\\\"highlight-blue blue-bordered individual-player\\\">\";\n }\n htmlString += \"<div class=\\\"left\\\">\";\n htmlString += currentPlayers[i];\n htmlString += \"</div>\";\n if (status == \"edit\"){\n htmlString += \"<div class=\\\"right\\\">\";\n htmlString += \"<span class=\\\"glyphicon glyphicon-remove remove_item_icon remove-player-from-group\\\"> </span>\";\n htmlString += \"</div>\";\n } \n htmlString += \"<br>\";\n htmlString += \"</div>\";\n \n }\n document.getElementById(\"current-players\").innerHTML = htmlString;\n }", "function displayCurrent(player){\r\n\t\t$(`#currentPlayer`).html(`<p>MOVE: <span>Player ${player.id}</span></p>`);\r\n}", "function updatePlayerNames() {\n $('#section__player-one').text(`Player One: ${playerOneName}`);\n $('#section__player-two').text(`Player Two: ${playerTwoName}`);\n}", "function updatePlayers() {\n var select = document.getElementById(\"playersSelector\");\n var players = document.getElementById(\"players\");\n\n while (players.firstChild) {\n players.removeChild(players.firstChild);\n }\n\n currentSession.players = [];\n for (var i = 0; i < select.options.length; i++) {\n var option = select.options[i];\n if (option.selected) {\n var newPlayer = document.createElement(\"span\");\n newPlayer.innerHTML = '<span class=\"imgbig player\" data-player-id=\"' + option.value + '\"><br/><br/><br/><br/><br/><br/>' + option.firstChild.nodeValue + '</span>';\n players.appendChild(newPlayer);\n currentSession.players.push(option.value);\n }\n }\n document.getElementById('playerCount').firstChild.nodeValue = currentSession.players.length;\n}", "function update() {\n $(\"#total\").text(playerscore);\n }", "function updatePlayerNames() {\n\tvar names = getScreenNames();\n\tdocument.getElementById('p1-name').innerHTML = names.player1;\n\tdocument.getElementById('p2-name').innerHTML = names.player2;\n}", "function updateUsersInLobby(){\n\t\tshowAdminButtons();\n\n var usersHtml = '';\n for (var i in g.users){\n var u = g.users[i];\n\t\t\tif (u !== null){\n\t usersHtml += '<li class=\"mdl-list__item mdl-list__item--two-line\">';\n\t usersHtml += '<span class=\"mdl-list__item-primary-content\">';\n\t usersHtml += '<span class=\"player-avatar player-' + (u.id - 1) + '\"></span>';\n\t usersHtml += '<span style=\"margin-top: 10px;\">' + u.name + '</span>';\n\t usersHtml += '<span class=\"mdl-list__item-sub-title\">User ID: ' + u.id + '</span>';\n\t usersHtml += '</span></li>';\n\t\t\t}\n }\n $('#usersOnline').html(usersHtml);\n\n\t\tshowStartGameButton();\n }", "function updatePlayerStats() {\n document.querySelector(\"#lives p\").innerText = playerStats.lives;\n document.querySelector(\"#score p\").innerText = playerStats.score;\n }", "function updateBattlefield(){\n $('.playerTwo.live .content').html('<span class=\" '+playerTwo.hand[0].suit+'\">'+playerTwo.hand[0].rank+' '+playerTwo.hand[0].symbol+'</span><span class=\" upsidedown '+playerTwo.hand[0].suit+'\">'+playerTwo.hand[0].rank+' '+playerTwo.hand[0].symbol+'</span>');\n $('.playerOne.live .content').html('<span class=\" '+playerOne.hand[0].suit+'\">'+playerOne.hand[0].rank+' '+playerOne.hand[0].symbol+'</span><span class=\" upsidedown '+playerOne.hand[0].suit+'\">'+playerOne.hand[0].rank+' '+playerOne.hand[0].symbol+'</span>');\n }", "function updateHTML(){\n\t \t$(\".panel-body\").text(tempObject.question);\n\n\t \t$(\"#wins\").text(wins);\n\t \t$(\"#losses\").text(losses);\n\t }", "updatePlayers(){\n var players = this.getAllPlayers();\n for(var i = 0; i < players.length; i++){\n var player = players[i];\n player.update();\n }\n }", "function updatePlayers() {\n if (!players || players.length == 0) return;\n\n for (var playerId in players) {\n var player = players[playerId];\n updatePlayerControls(player);\n }\n updateCurrentPlayer(currentPlayer);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
| startCapture:void () | | Returns a continuous reading every 33ms
startCapture(){ this._writeRegisters(REGISTRY.SYSRANGE_START, 0x02); setInterval( () => { this._readRegisters(REGISTRY.RESULT_RANGE_STATUS, 16, (err, data) => { var _dis = (data.readInt16BE(8) + 10); this.emit('distance', _dis); }); },33); }
[ "function startCapture() {\n initSize();\n initStyle();\n capturing = true;\n startTime = new Date().getTime();\n nextFrame();\n }", "function start_capture(){\n socket.emit('start capture');\n //TODO add a visible timer\n $('#startstopbutton').html('Stop');\n $('#log').html('');\n numbers_received = [];\n}", "function loopRecorder() {\r\n\tmediaRecorder.stop();\r\n\tmediaRecorder.start();\t\r\n var d = new Date();\r\n console.log('mediaRecorder.start() '+d.getTime())\t\r\n}", "function startRecording() {\n chunks = [];\n recorder.start();\n setTimeout(stopRecording, 5000);\n}", "async function startCapture() {\n try {\n captureStream = await navigator.mediaDevices.getDisplayMedia();\n videoElem.srcObject = captureStream;\n videoElem.onloadedmetadata = () => videoElem.play();\n } catch (err) {\n console.error('Error: ' + err);\n }\n return captureStream;\n}", "function captureImage() {\n images[initialSecond] = capture.get(0, 0, imgWidth, imgHeight); // capture an image and put it into the array\n initialSecond = initialSecond == 59 ? 0 : initialSecond + 1; // increase the second by one, or set to 0 if already at 59\n}", "function startLightSensorWatch() {\n 'use strict';\n setInterval(function () {\n var a = lightA0.read();\n console.log(\"Light: \" + a);\n \n // the box is open, record video now\n if( a > 200 && isRecording == false && isOpenned == true ) {\n recordVideo(); \n }\n\n // var resistance = (1023 - a) * 10000 / a; //get the resistance of the sensor;\n // console.log(\"resistence: \" + resistance);\n \n // socket.emit(\"message\", \"opened\");\n // socket.emit(\"message\", \"closed\");\n \n }, 2000);\n}", "function startRecording() {\n // use MediaStream Recording API\n recorder = new MediaRecorder(localStream, { mimeType: 'video/webm;codecs=vp9' });\n let counter = 0;\n\n // fires every one second and passes an BlobEvent\n recorder.ondataavailable = event => {\n socket.emit('recording data', { chunk: event.data, counter: counter }); // send data\n console.log('data available');\n };\n recorder.onstop = event => {\n console.log('Record stoped');\n if (isRecording) {\n socket.emit('recording continue', { chunk: event.data, counter: counter }); // send data\n counter++;\n recorder.start(1000);\n }\n }\n // make data available event fire every one second\n recorder.start(1000);\n isRecording = true;\n console.log('Start recording');\n enabelElement('stop_recording');\n}", "function captureAndBuffer () {\n // Calculate time elapsed since recording started\n if(!timer) {\n timer = new Date();\n } else {\n var then = timer;\n timer = new Date();\n timeElapsed += timer - then;\n }\n\n // Throw timer event\n if(recorder.ontimer) {\n recorder.ontimer(timeElapsed);\n }\n\n if(justAudio) { // Just audio, nothing to capture buddy\n return;\n }\n \n // Send frame to worker\n worker.postMessage({type: 'captureFrame', frame: captureFrame()});\n }", "function VideoCaptureFlight(stream, n, spacing_ms) {\n let captures = [];\n let interval = setInterval(function() {\n let new_capture;\n try {\n new_capture = new VideoCapture(stream);\n } catch (error) {\n console.log(\"Failed to create VideoCapture: \" + error);\n clearInterval(interval);\n }\n if (captures.length >= n) {\n captures[0].stop();\n for (let i = 0; i < captures.length - 1; ++i) {\n captures[i] = captures[i + 1];\n }\n captures[captures.length - 1] = new_capture;\n } else {\n captures.push(new_capture);\n }\n }, spacing_ms);\n\n this.stop = function(cb) {\n captures[0].stop(cb);\n };\n}", "capture(duration = 30, predelay = 0) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.replayBuffer) {\n return Promise.reject(new Error('Replay buffer has not been started'));\n }\n const endTime = this.replayBuffer.realDuration.clone()\n .subtract(predelay, 's');\n const startTime = endTime.clone()\n .subtract(duration, 's');\n yield this.replayBuffer.contains(endTime);\n const offset = startTime.format('HH:mm:ss.sss', { trim: false });\n const file = `${this.replayBuffer.prefix}-capture-${shortid_1.default.generate()}.mp4`;\n const outputFile = path.join(this.outputPath, file);\n const inputFile = path.join(this.replayBuffer.outputPath, this.replayBuffer.outputFile);\n const chain = fluent_ffmpeg_1.default();\n return new Promise((resolve, reject) => {\n chain.input(inputFile)\n .inputOptions([\n '-f hls',\n '-live_start_index 3'\n ])\n .output(outputFile)\n .outputOptions([\n '-copyts',\n `-ss ${offset}`,\n `-t ${duration}`,\n '-c copy'\n ])\n // .on('start', cmd => console.log('Start capture', cmd))\n // .on('progress', c => console.log('progress', c))\n .on('end', () => resolve(outputFile))\n .on('error', reject)\n // .on('stderr', l => console.log(l))\n .run();\n });\n });\n }", "function takeSampleShot( m, listener ){\n var w = m.sampleWaitTime;\n var p = m.splitPositions;\n var s = m.sampleShots;\n var dom = m.dom;\n var l = m.splitLength;\n var b = m.blockLength;\n var i = 0;\n\n //Create canvas for take shot\n var cnv = document.createElement( \"canvas\" );\n cnv.width = m.width;\n cnv.height = m.height;\n var ctx = cnv.getContext( '2d' );\n \n //Seek media to zero\n dom.currentTime = 0;\n \n (function(){\n var f = arguments.callee;\n dom.currentTime = p[i];\n dom.play();\n setTimeout( function(){\n //dom.pause();\n }, w/2 );\n setTimeout( function(){\n \n //to avoid issue( the first frame does not be captured ), render additional one frame\n ctx.drawImage( dom, 0, 0, 1, 1 );\n \n //Render frame on canvas and capture it\n ctx.drawImage( dom, 0, 0, m.width, m.height );\n s.push( ctx.getImageData( 0, 0, m.width, m.height ) );\n \n i++;\n \n //Repeat phase (use timer not to block browser content rendering)\n if( i < l ){\n setTimeout( f, 10 );\n \n //Move to netxt phase\n }else{\n dom.pause();\n listener( m );\n }\n \n }, w );\n \n //Show progress\n setProgress( 'Capturing frame shot...', i / l );\n \n })();\n \n}", "function startCapture() {\n // Use the navigator to grab user media: webcam\n navigator.getUserMedia({\n video: {}\n },\n // successCallback\n function (localMediaStream) {\n video.srcObject = localMediaStream;\n },\n // errorCallback\n function (err) {\n console.log(\"The following error occured: \" + err);\n }\n )\n}", "start() {\n const stream = this.canvas.captureStream(this.framerate)\n const options = { mimeType: \"video/webm; codecs=vp8\" }\n\n this.mediaRecorder = new MediaRecorder(stream, options)\n this.mediaRecorder.ondataavailable = this.handleDataAvailable.bind(this)\n this.mediaRecorder.start()\n }", "function initRecord(){\r\n console.log( \"ready!\" );\r\n canvas = document.querySelector('canvas');\r\n stream = canvas.captureStream(24);\r\n console.log('Started stream capture from canvas element: ', stream); \r\n}", "function YInputCapture_get_immediateCapture(msDuration)\n {\n var snapUrl; // str;\n var snapData; // bin;\n var snapStart; // int;\n if (msDuration < 1) {\n msDuration = 20;\n }\n if (msDuration > 1000) {\n msDuration = 1000;\n }\n snapStart = parseInt((-msDuration) / (2));\n snapUrl = \"snap.bin?t=\"+String(Math.round(snapStart))+\"&d=\"+String(Math.round(msDuration));\n\n snapData = this._download(snapUrl);\n return new YInputCaptureData(this, snapData);\n }", "function startRecording() {\n // Access the Microphone using the navigator.getUserMedia method to obtain a stream\n navigator.mediaDevices.getUserMedia({ audio: true }).then(stream => {\n // Expose the stream to be accessible globally\n audio_stream = stream;\n // Create the MediaStreamSource for the Recorder library\n var input = audio_context.createMediaStreamSource(stream);\n console.log('Media stream succesfully created');\n\n // Initialize the Recorder Library\n recorder = new Recorder(input);\n console.log('Recorder initialised');\n\n // Start recording !\n recorder && recorder.record();\n console.log('Recording...');\n\n // Disable Record button and enable stop button !\n document.getElementById(\"start-btn\").disabled = true;\n document.getElementById(\"stop-btn\").disabled = false;\n }, function (e) {\n console.error('No live audio input: ' + e);\n });\n}", "resumeCapture() {\n this._stopped = false;\n }", "onRecording() {\n recorder.start();\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Determine whether the given properties match those of a `KeySAMPTProperty`
function CfnFunction_KeySAMPTPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); errors.collect(cdk.propertyValidator('keyId', cdk.requiredValidator)(properties.keyId)); errors.collect(cdk.propertyValidator('keyId', cdk.validateString)(properties.keyId)); return errors.wrap('supplied properties not correct for "KeySAMPTProperty"'); }
[ "function CfnFunction_KeySAMPTPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('keyId', cdk.requiredValidator)(properties.keyId));\n errors.collect(cdk.propertyValidator('keyId', cdk.validateString)(properties.keyId));\n return errors.wrap('supplied properties not correct for \"KeySAMPTProperty\"');\n}", "hasProperty(aProperty){\n for(let i = 0; i < this._properties.length; i++){\n let prop = this._properties[i];\n if(aProperty.matches(prop)){\n return true;\n }\n }\n return false;\n }", "function validateProperties(props) {\n let validProps = getProperties();\n for (let i in props) {\n if (!validProps.includes(props[i])) {\n return false;\n }\n }\n return true;\n}", "function propertiesEquals(objA, objB, properties) {\n var i, property;\n\n for (i = 0; i < properties.length; i++) {\n property = properties[i];\n\n if (!equals(objA[property], objB[property])) {\n return false;\n }\n }\n\n return true;\n}", "matches(aProperty){\n if(aProperty.name == this.name){\n return true;\n } else {\n for(let i = 0; i < this.aliases.length; i++){\n let myAlias = this.aliases[i];\n if(aProperty.hasAlias(myAlias)){\n return true;\n }\n }\n }\n return false;\n }", "function check_properties(search_specs, possible_keys) {\n for (let spec in search_specs) {\n if (!possible_keys.includes(spec)) {\n throw [`no property '${spec}' for given type`];\n }\n }\n}", "function hasSamePropertiesValue(properties1, properties2) {\n for (var property in properties1) {\n if (properties1.hasOwnProperty(property)) {\n if (properties1[property] !== properties2[property]) return false;\n }\n }\n\n return true;\n }", "function TermIs(term, listOfProperties) {\n\tvar hits = 0;\n\n\tfor (var i = 0; i < listOfProperties.length; i++) {\n\t\tif (term.pos.hasOwnProperty(listOfProperties[i]))\n\t\t\thits++;\n\t}\n\n\tif (hits === listOfProperties.length)\n\t\treturn true;\n\n\treturn false;\n}", "function hasProperties(actual, expected) {\n for (var k in expected) {\n var v = expected[k];\n if (!(k in actual))\n return false;\n if (Object(v) === v) {\n if (!hasProperties(actual[k], v))\n return false;\n } else {\n if (actual[k] !== v)\n return false;\n }\n }\n return true;\n}", "function hasPropsAndVals(obj, kv) {\n if (typeof (obj) !== 'object' || typeof (kv) !== 'object') {\n return (false);\n }\n\n if (Object.keys(kv).length === 0) {\n return (true);\n }\n\n return (Object.keys(kv).every(function (k) {\n return (obj[k] && obj[k] === kv[k]);\n }));\n}", "function checkSameProps(properties, qParams, model) {\n var result = INCLUDE;\n\n _.each(properties, function(property) {\n if (_.has(qParams, property) && qParams[property] !== model.get(property)) {\n result = EXCLUDE;\n }\n });\n\n return result;\n }", "function CfnSqlInjectionMatchSet_FieldToMatchPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('data', cdk.validateString)(properties.data));\n errors.collect(cdk.propertyValidator('type', cdk.requiredValidator)(properties.type));\n errors.collect(cdk.propertyValidator('type', cdk.validateString)(properties.type));\n return errors.wrap('supplied properties not correct for \"FieldToMatchProperty\"');\n}", "function matchTransitionProperty(subject, property) {\n if (property === \"all\") {\n return true;\n }\n var sub = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__removeVendorPrefix__[\"a\" /* default */])(subject);\n var prop = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__removeVendorPrefix__[\"a\" /* default */])(property);\n if (sub.length < prop.length) {\n return false;\n }\n else if (sub.length === prop.length) {\n return sub === prop;\n }\n return sub.substr(0, prop.length) === prop;\n}", "function containsAllowedProps(properties) {\n if (properties === null || (typeof properties === 'undefined' ? 'undefined' : _typeof(properties)) !== 'object') {\n return false;\n }\n return Object.entries(properties).some(function (property) {\n var key = property[0];\n var value = property[1];\n if (typeof value === 'string') {\n return key === 'style' || key === 'src' || key === 'href';\n } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && key === 'attributes') {\n return 'class' in properties.attributes;\n }\n });\n}", "function matchTransitionProperty(subject, property) {\r\n if (property === \"all\") {\r\n return true;\r\n }\r\n var sub = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__removeVendorPrefix__[\"a\" /* default */])(subject);\r\n var prop = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__removeVendorPrefix__[\"a\" /* default */])(property);\r\n if (sub.length < prop.length) {\r\n return false;\r\n }\r\n else if (sub.length === prop.length) {\r\n return sub === prop;\r\n }\r\n return sub.substr(0, prop.length) === prop;\r\n}", "function CfnRule_MatchPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('httpMatch', cdk.requiredValidator)(properties.httpMatch));\n errors.collect(cdk.propertyValidator('httpMatch', CfnRule_HttpMatchPropertyValidator)(properties.httpMatch));\n return errors.wrap('supplied properties not correct for \"MatchProperty\"');\n}", "function CfnRule_PathMatchPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('caseSensitive', cdk.validateBoolean)(properties.caseSensitive));\n errors.collect(cdk.propertyValidator('match', cdk.requiredValidator)(properties.match));\n errors.collect(cdk.propertyValidator('match', CfnRule_PathMatchTypePropertyValidator)(properties.match));\n return errors.wrap('supplied properties not correct for \"PathMatchProperty\"');\n}", "matches(text, props) {\n for (var key in props) {\n if (key === 'text') {\n continue;\n }\n\n if (!text.hasOwnProperty(key) || text[key] !== props[key]) {\n return false;\n }\n }\n\n return true;\n }", "matches(text, props) {\n for (var key in props) {\n if (key === \"text\") {\n continue;\n }\n if (!text.hasOwnProperty(key) || text[key] !== props[key]) {\n return false;\n }\n }\n return true;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new StatsDisplay object. Use this class to create a field in the topleft corner that displays the current frames per second and total number of elements processed in the System.animLoop. Note: StatsDisplay will not function in browsers whose Date object does not support Date.now(). These include IE6, IE7, and IE8.
function StatsDisplay() { 'use strict'; var labelContainer, label; /** * Frames per second. * @private */ this._fps = 0; /** * The current time. * @private */ if (Date.now) { this._time = Date.now(); } else { this._time = 0; } /** * The time at the last frame. * @private */ this._timeLastFrame = this._time; /** * The time the last second was sampled. * @private */ this._timeLastSecond = this._time; /** * Holds the total number of frames * between seconds. * @private */ this._frameCount = 0; /** * A reference to the DOM element containing the display. * @private */ this._el = document.createElement('div'); this._el.id = 'statsDisplay'; this._el.className = 'statsDisplay'; this._el.style.color = 'white'; /** * A reference to the textNode displaying the total number of elements. * @private */ this._totalElementsValue = null; /** * A reference to the textNode displaying the frame per second. * @private */ this._fpsValue = null; // create 3dTransforms label labelContainer = document.createElement('span'); labelContainer.className = 'statsDisplayLabel'; label = document.createTextNode('trans3d: '); labelContainer.appendChild(label); this._el.appendChild(labelContainer); // create textNode for totalElements this._3dTransformsValue = document.createTextNode(exports.System.supportedFeatures.csstransforms3d); this._el.appendChild(this._3dTransformsValue); // create totol elements label labelContainer = document.createElement('span'); labelContainer.className = 'statsDisplayLabel'; label = document.createTextNode('total elements: '); labelContainer.appendChild(label); this._el.appendChild(labelContainer); // create textNode for totalElements this._totalElementsValue = document.createTextNode('0'); this._el.appendChild(this._totalElementsValue); // create fps label labelContainer = document.createElement('span'); labelContainer.className = 'statsDisplayLabel'; label = document.createTextNode('fps: '); labelContainer.appendChild(label); this._el.appendChild(labelContainer); // create textNode for fps this._fpsValue = document.createTextNode('0'); this._el.appendChild(this._fpsValue); document.body.appendChild(this._el); /** * Initiates the requestAnimFrame() loop. */ this._update(this); }
[ "function StatsDisplay() {\n\n var labelContainer, label;\n\n this.name = 'StatsDisplay';\n\n /**\n * Set to false to stop requesting animation frames.\n * @private\n */\n this._active = true;\n\n /**\n * Frames per second.\n * @private\n */\n this._fps = 0;\n\n /**\n * The current time.\n * @private\n */\n if (Date.now) {\n this._time = Date.now();\n } else {\n this._time = 0;\n }\n\n /**\n * The time at the last frame.\n * @private\n */\n this._timeLastFrame = this._time;\n\n /**\n * The time the last second was sampled.\n * @private\n */\n this._timeLastSecond = this._time;\n\n /**\n * Holds the total number of frames\n * between seconds.\n * @private\n */\n this._frameCount = 0;\n\n /**\n * A reference to the DOM element containing the display.\n * @private\n */\n this.el = document.createElement('div');\n this.el.id = 'statsDisplay';\n this.el.className = 'statsDisplay';\n this.el.style.backgroundColor = 'black';\n this.el.style.color = 'white';\n this.el.style.fontFamily = 'Helvetica';\n this.el.style.padding = '0.5em';\n this.el.style.opacity = '0.5';\n this.el.style.position = 'fixed';\n this.el.style.top = 0;\n this.el.style.left = 0;\n\n /**\n * A reference to the textNode displaying the total number of elements.\n * @private\n */\n this._totalElementsValue = null;\n\n /**\n * A reference to the textNode displaying the frame per second.\n * @private\n */\n this._fpsValue = null;\n\n // create totol elements label\n labelContainer = document.createElement('span');\n labelContainer.className = 'statsDisplayLabel';\n labelContainer.style.marginLeft = '0.5em';\n label = document.createTextNode('total elements: ');\n labelContainer.appendChild(label);\n this.el.appendChild(labelContainer);\n\n // create textNode for totalElements\n this._totalElementsValue = document.createTextNode('0');\n this.el.appendChild(this._totalElementsValue);\n\n // create fps label\n labelContainer = document.createElement('span');\n labelContainer.className = 'statsDisplayLabel';\n labelContainer.style.marginLeft = '0.5em';\n label = document.createTextNode('fps: ');\n labelContainer.appendChild(label);\n this.el.appendChild(labelContainer);\n\n // create textNode for fps\n this._fpsValue = document.createTextNode('0');\n this.el.appendChild(this._fpsValue);\n\n document.body.appendChild(this.el);\n\n /**\n * Initiates the requestAnimFrame() loop.\n */\n this._update(this);\n}", "function StatsDisplay() {\n\n var labelContainer, label;\n\n this.name = 'StatsDisplay';\n\n /**\n * Set to false to stop requesting animation frames.\n * @private\n */\n this._active = true;\n\n /**\n * Frames per second.\n * @private\n */\n this._fps = 0;\n\n /**\n * The current time.\n * @private\n */\n if (Date.now) {\n this._time = Date.now();\n } else {\n this._time = 0;\n }\n\n /**\n * The time at the last frame.\n * @private\n */\n this._timeLastFrame = this._time;\n\n /**\n * The time the last second was sampled.\n * @private\n */\n this._timeLastSecond = this._time;\n\n /**\n * Holds the total number of frames\n * between seconds.\n * @private\n */\n this._frameCount = 0;\n\n /**\n * A reference to the DOM element containing the display.\n * @private\n */\n this.el = document.createElement('div');\n this.el.id = 'statsDisplay';\n this.el.className = 'statsDisplay';\n this.el.style.backgroundColor = 'black';\n this.el.style.color = 'white';\n this.el.style.fontFamily = 'Helvetica';\n this.el.style.padding = '0.5em';\n this.el.style.opacity = '0.5';\n this.el.style.position = 'absolute';\n this.el.style.left = '0';\n this.el.style.top = '0';\n this.el.style.width = '220px';\n\n /**\n * A reference to the textNode displaying the total number of elements.\n * @private\n */\n this._totalElementsValue = null;\n\n /**\n * A reference to the textNode displaying the frame per second.\n * @private\n */\n this._fpsValue = null;\n\n // create totol elements label\n labelContainer = document.createElement('span');\n labelContainer.className = 'statsDisplayLabel';\n labelContainer.style.marginLeft = '0.5em';\n label = document.createTextNode('total elements: ');\n labelContainer.appendChild(label);\n this.el.appendChild(labelContainer);\n\n // create textNode for totalElements\n this._totalElementsValue = document.createTextNode('0');\n this.el.appendChild(this._totalElementsValue);\n\n // create fps label\n labelContainer = document.createElement('span');\n labelContainer.className = 'statsDisplayLabel';\n labelContainer.style.marginLeft = '0.5em';\n label = document.createTextNode('fps: ');\n labelContainer.appendChild(label);\n this.el.appendChild(labelContainer);\n\n // create textNode for fps\n this._fpsValue = document.createTextNode('0');\n this.el.appendChild(this._fpsValue);\n\n document.body.appendChild(this.el);\n\n /**\n * Initiates the requestAnimFrame() loop.\n */\n this._update(this);\n}", "displayStats() {\n const stats = new Stats();\n\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n stats.dom.style.position = \"absolute\";\n stats.dom.style.top = \"60px\";\n stats.dom.style.left = \"auto\";\n stats.dom.style.right = \"10px\";\n\n this.stats = stats;\n document.body.appendChild(this.stats.dom);\n }", "createStats() {\n if (this.showStats) {\n this.stats = new Stats();\n this.stats.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom\n this.container.append( this.stats.dom );\n }\n }", "function _createStats() {\n this.statsSurface = new Surface({\n size: [undefined, undefined],\n content: \" \\\n <table id='stats_table'> \\\n <tr class='even'> \\\n <td class='left_cell'> \\\n Average \\\n </td> \\\n <td class='right_cell'> \\\n 0 \\\n <span class='small'>sec</span> \\\n </td> \\\n </tr> \\\n <tr class='odd'> \\\n <td class='left_cell'> \\\n Median \\\n </td> \\\n <td class='right_cell'> \\\n 0 \\\n <span class='small'>sec</span> \\\n </td> \\\n </tr> \\\n <tr class='even'> \\\n <td class='left_cell'> \\\n 90th Percentile \\\n </td> \\\n <td class='right_cell'> \\\n 0 \\\n <span class='small'>sec</span> \\\n </td> \\\n </tr> \\\n <tr class='odd'> \\\n <td class='left_cell'> \\\n Fastest \\\n </td> \\\n <td class='right_cell'> \\\n 0 \\\n <span class='small'>sec</span> \\\n </td> \\\n </tr> \\\n <tr class='even'> \\\n <td class='left_cell'> \\\n Slowest \\\n </td> \\\n <td class='right_cell'> \\\n 0 \\\n <span class='small'>sec</span> \\\n </td> \\\n </tr> \\\n </table> \\\n \\\n \",\n properties: {\n textAlignt: 'center',\n paddingTop: '5px',\n backgroundColor: '#E6E6F0',\n },\n });\n\n var statsModifier = new StateModifier({\n origin: [0.5, 0],\n align: [0.5, 0.5],\n });\n\n this.layout.content.add(statsModifier).add(this.statsSurface);\n }", "function initStats() {\n\t\t_stats = new Stats();\n\t\t_stats.domElement.style.position = \"absolute\";\n\t\t_stats.domElement.style.top = \"8px\";\n\t\t_stats.domElement.style.zIndex = 100;\n\t\tdocument.getElementById(\"container\").appendChild(_stats.domElement);\n\t}", "function showStats( show ) \n\t{\n\t\tif( show )\n\t\t{\n\t\t\t_stats = new Stats();\n\t\t\t_stats.setMode(2); // 0: fps, 1: ms\n\t\t\t// Align top-left\n\t\t\t_stats.domElement.style.position = 'absolute';\n\t\t\t_stats.domElement.style.right = '0px';\n\t\t\t_stats.domElement.style.top = '0px';\n\t\t\tdocument.body.appendChild( _stats.domElement );\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdocument.body.removeChild( _stats.domElement );\n\t\t\t_stats = null;\n\t\t}\n\t}", "function renderStatsDisplay() {\n setSampleStats();\n setMinStats();\n setMeanStats();\n setMaxStats();\n setMedianStats();\n setTotalStats();\n setCyclesStats();\n}", "function add_stats() {\n\n // Creates the Stats Object\n // (Statistics for the Rendering Process)\n stats = new Stats();\n\n // Adds the Stats to the Document\n // (Statistics for the Rendering Process)\n document.body.appendChild(stats.dom);\n\n // Sets the Position of the Stats\n // (Statistics for the Rendering Process),\n // attaching it to the bottom-left corner of the Document\n stats.dom.style.bottom = 0;\n stats.dom.style.left = 0;\n\n}", "updateRenderStats(){\n\t\tif (this.renderStatsElement === undefined){\n\t\t\treturn;\n\t\t}\n\t\tthis.renderStatsElement.innerHTML = \"fps:\" + this.renderStats.getFps() + \" frame:\" + this.renderStats.getFrame() + \" running:\" + this.continueAnimation;\n\t}", "function addStatsObject() {\n stats = new Stats();\n stats.setMode(0);\n stats.domElement.style.position = 'absolute';\n stats.domElement.style.left = '0px';\n stats.domElement.style.top = '0px';\n document.body.appendChild(stats.domElement);\n}", "function addStatsObject() {\n stats = new Stats();\n stats.setMode(0);\n stats.domElement.style.position = 'absolute';\n stats.domElement.style.left = '0px';\n stats.domElement.style.top = '0px';\n document.body.appendChild( stats.domElement );\n }", "function renderStatistics() {\r\n if (statistics) {\r\n ctx2d.font = \"bold 12px sans-serif\";\r\n //ctx2d.fillStyle = \"white\";\r\n ctx2d.fillStyle = \"black\";\r\n ctx2d.fillRect(10, 10, 240, 100);\r\n //ctx2d.fillStyle = \"black\";\r\n ctx2d.fillStyle = \"white\";\r\n ctx2d.fillText(\"Frame Rate: \" + statistics.frameRate().toFixed(2), 15, 25);\r\n ctx2d.fillText(\"Average Frame Rate: \" + statistics.averageFrameRate().toFixed(2),\r\n 15, 40);\r\n ctx2d.fillText(\"Round trip: \" + statistics.roundTrip() + \" ms - Max: \" + statistics.maxRoundTrip() + \" ms\",\r\n 15, 55);\r\n ctx2d.fillText(\"Server work time: \" + statistics.serverWorkTime() + \" ms - Max: \" + statistics.maxServerWorkTime() + \" ms\",\r\n 15, 70);\r\n ctx2d.fillText(\"Minimum Frame Rate: \" + statistics.minFrameRate().toFixed(2),\r\n 15, 85);\r\n ctx2d.fillText(\"Loading time: \" + statistics.trueLoadTime(),\r\n 15, 100);\r\n }\r\n }", "function renderStatistics() {\n if (statistics) {\n ctx2d.font = \"bold 12px sans-serif\";\n //ctx2d.fillStyle = \"white\";\n ctx2d.fillStyle = \"black\";\n ctx2d.fillRect(10, 10, 240, 100);\n //ctx2d.fillStyle = \"black\";\n ctx2d.fillStyle = \"white\";\n ctx2d.fillText(\"Frame Rate: \" + statistics.frameRate().toFixed(2), 15, 25);\n ctx2d.fillText(\"Average Frame Rate: \" + statistics.averageFrameRate().toFixed(2),\n 15, 40);\n ctx2d.fillText(\"Round trip: \" + statistics.roundTrip() + \" ms - Max: \" + statistics.maxRoundTrip() + \" ms\",\n 15, 55);\n ctx2d.fillText(\"Server work time: \" + statistics.serverWorkTime() + \" ms - Max: \" + statistics.maxServerWorkTime() + \" ms\",\n 15, 70);\n ctx2d.fillText(\"Minimum Frame Rate: \" + statistics.minFrameRate().toFixed(2),\n 15, 85);\n ctx2d.fillText(\"Loading time: \" + statistics.trueLoadTime(),\n 15, 100);\n }\n }", "function setupFPS() {\n stats.showPanel(0); // 0: fps, 1: ms, 2: mb, 3+: custom\n if (guiState.showFps) {\n document.body.appendChild(stats.dom);\n }\n}", "function initStatsContainer() {\n stats = new Stats();\n stats.domElement.style.position = 'absolute';\n stats.domElement.style.bottom = '10px';\n stats.domElement.style.zIndex = 600;\n container.appendChild( stats.domElement );\n}", "display_stats() { \n\t\n\t\tstats[0].textContent = this.make + \" \" + this.model + \" \" + this.year;\n\t\tstats[1].textContent = this.mpg;\n\t\tstats[2].textContent = this.current_fuel;\n\t\tstats[3].textContent = this.max_fuel_capacity;\n\t\tstats[4].textContent = this.odometer;\n\t\tstats[5].textContent = this.passengers.length;\n\t\tstats[6].textContent = this.seats;\n\t}", "makeFPSCounter() {\n this.fpsCounter = new PointText({\n point: [10, 20],\n content: \"FPS: \",\n fillColor: \"white\",\n fontSize: 10\n });\n }", "__renderFPS() {\n this._fpsBox.innerHTML = `${this._minFPS} / ${this._fps} / ${this._maxFPS}`;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
NaiveBayes Classifier This is a naivebayes classifier that uses Laplace Smoothing. Takes an (optional) options object containing: `tokenizer` => custom tokenization function
function Bayes(options) { // set options object this.options = {}; if (typeof options !== 'undefined') { if (!options || typeof options !== 'object' || Array.isArray(options)) { throw new TypeError('Bayes got invalid `options`: `' + options + '`. Pass in an object.'); } this.options = options; } this.tokenizer = this.options.tokenizer || defaultTokenizer; if (this.options.tokenizer === "Chinese") { this.tokenizer = ChineseTokenizer; } //initialize our vocabulary and its size this.vocabulary = {}; this.vocabularySize = 0; //number of documents we have learned from this.totalDocuments = 0; //document frequency table for each of our categories //=> for each category, how often were documents mapped to it this.docCount = {}; //for each category, how many words total were mapped to it this.wordCount = {}; //word frequency table for each category //=> for each category, how frequent was a given word mapped to it this.wordFrequencyCount = {}; //hashmap of our category names this.categories = {}; }
[ "function Naivebayes (options) {\n\t// set options object\n\tthis.options = {}\n\tif (typeof options !== 'undefined') {\n\t\tif (!options || typeof options !== 'object' || Array.isArray(options)) {\n\t\t\tthrow TypeError('NaiveBayes got invalid `options`: `' + options + '`. Pass in an object.')\n\t\t}\n\t\tthis.options = options\n\t}\n\n\tthis.tokenizer = this.options.tokenizer || defaultTokenizer\n\n\t//initialize our vocabulary and its size\n\tthis.vocabulary = {}\n\tthis.vocabularySize = 0\n\n\t//number of documents we have learned from\n\tthis.totalDocuments = 0\n\n\t//document frequency table for each of our categories\n\t//=> for each category, how often were documents mapped to it\n\tthis.docCount = {}\n\n\t//for each category, how many words total were mapped to it\n\tthis.wordCount = {}\n\n\t//word frequency table for each category\n\t//=> for each category, how frequent was a given word mapped to it\n\tthis.wordFrequencyCount = {}\n\n\t//hashmap of our category names\n\tthis.categories = {}\n}", "function Naivebayes (options) {\n // set options object\n this.options = {}\n if (typeof options !== 'undefined') {\n if (!options || typeof options !== 'object' || Array.isArray(options)) {\n throw TypeError('NaiveBayes got invalid `options`: `' + options + '`. Pass in an object.')\n }\n this.options = options\n }\n\n this.tokenizer = this.options.tokenizer || defaultTokenizer\n\n //initialize our vocabulary and its size\n this.vocabulary = {}\n this.vocabularySize = 0\n\n //number of documents we have learned from\n this.totalDocuments = 0\n\n //document frequency table for each of our categories\n //=> for each category, how often were documents mapped to it\n this.docCount = {}\n\n //for each category, how many words total were mapped to it\n this.wordCount = {}\n\n //word frequency table for each category\n //=> for each category, how frequent was a given word mapped to it\n this.wordFrequencyCount = {}\n\n //hashmap of our category names\n this.categories = {}\n}", "function naiveBayes(inputDocument, authors){\n\tvar docTokenized = tokenizer(inputDocument.content);\n\tvar maxTotal = 0;\n\tvar maxAuthor = \"\";\n\tfor(var author in authors){\n\t\tvar total = 0;\n\t\tfor(var j=0; j<docTokenized.length; j++){ \n\t\t\tif(typeof docTokenized[j] == \"undefined\" || docTokenized[j] == \"\")\n\t\t\t\tcontinue;\n\t\t\ttotal += authors[author].getWordProb(docTokenized[j]);\t\t\t\n\t\t}\n\t\tif(total >= maxTotal){\n\t\t\tmaxTotal = total;\n\t\t\tmaxAuthor = author;\n\t\t}\n\t}\n\tinputDocument.predictedAuthor = maxAuthor;\n}", "function AddFeatureLabel() {\r\n DataSet.forEach(data => {\r\n\r\n let sentence = data.sentence\r\n let label = data.class\r\n\r\n // sentence = sentence.toLowerCase();\r\n // sentence = sentence.\r\n\r\n NaiveBayesModel.addDocument(data.sentence.toLocaleLowerCase().replace('#', '').replace(/\\@\\w\\w+\\s?/g, '').replace(/(?:https?|ftp):\\/\\/[\\n\\S]+/g, '').replace(/[^\\w\\s]|_/g, \"\")\r\n .replace(/\\s+/g, \" \"), data.class)\r\n\r\n // console.log(data.sentence.replace(/\\@\\w\\w+\\s?/g, '').replace(/(?:https?|ftp):\\/\\/[\\n\\S]+/g, ''))\r\n }, () => {\r\n console.log(\"Adding Features and Label Done\")\r\n });\r\n\r\n}", "function trainClassifier() {\n console.log('\\nBeginning training now...');\n // begin training\n startTime = Date.now();\n bayesClassifier.train();\n // calculate training time (ms)\n const trainingTime = ((Date.now() - startTime) / 1000).toFixed(2);\n console.log('\\nNaive Bayes classifier training completed in ' + trainingTime + ' seconds');\n saveClassifier();\n}", "trainClassifier() {\n // Train classifier\n this._trainingSet = this.prepTrainingData();\n this._bayes.setTraining(this._trainingSet);\n this._bayes.train();\n }", "train() {\n // it's possible that we'll never come across appropriate values for m and b\n for (let i = 0; i < this.options.iterations; i++) {\n this.gradientDescent()\n }\n }", "async train(files, options) {\n const mergedOptions = Object.assign(Object.assign({}, this.defaultTrainOptions), options);\n const trainer = trainers_1.bpeTrainer(Object.assign(Object.assign({}, mergedOptions), { initialAlphabet: pre_tokenizers_1.byteLevelAlphabet() }));\n this.tokenizer.train(trainer, files);\n }", "train(){\n console.log(\"training...\");\n this.dt = new ml.DecisionTree({\n data : this.dataArray,\n result : this.resultArray\n });\n \n this.dt.build();\n\n }", "train(features, labels) {\n\t\tif (this.model == null) {\n\t\t\tconsole.log(\"Model has not been initialized or loaded\")\n\t\t\treturn;\n\t\t}\n\t\t// Ensure that the features and labels have the same length\n\t\tif (features.length != labels.length) {\n\t\t\tconsole.log(\"Training requires that each feature set have matching labels\")\n\t\t\treturn;\n\t\t}\n\n\t\t// Normalize labels\n\t\tlet max = 100;\n\t\tlet min = -100;\n\t\tfor (let i = 0; i < labels.length; i++) {\n\t\t\tlet val = labels[i][0];\n\t\t\tlet norm = (val - min)/(max - min);\n\t\t\tlabels[i][0] = norm;\n\t\t}\n\t\t\n\t\tlet epochs = 0;\n\t\tlet continueTrain = true;\n\t\tlet bestSSE = Infinity;\n\t\tlet epochsSinceImprovement = 0;\n\t\tlet noImprovementThreshold = 5;\n\t\tlet bestModel = null;\n\n\t\tlet startTime = Date.now();\n\t\twhile(continueTrain) {\n\t\t\t// Train on each instance of the training set\n\t\t\tlet SSE = 0;\n\t\t\tfor (let f = 0; f < features.length; f++) {\n\t\t\t\tvar x = this.getModelOutput(features[f]);\n\t\t\t\tSSE += this.calculateError(x, labels[f], true);\n\t\t\t}\n\n\t\t\t// Test stopping criteria\n\t\t\tepochs++;\n\t\t\tif (this.validationSet != null) {\n\t\t\t\tlet validationSSE = this.validate();\n\t\t\t\tif (validationSSE < bestSSE) {\n\t\t\t\t\tepochsSinceSSE = 0;\n\t\t\t\t\tbestSSE = validationSSE;\n\t\t\t\t\tbestModel = Object.assign({}, this.model);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tepochsSinceImprovement++;\n\t\t\t\t\tif (epochsSinceImprovement > noImprovementThreshold) {\n\t\t\t\t\t\tcontinueTrain = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tbestModel = Object.assign({}, this.model);\n\t\t\t\tif (epochs >= 20)\n\t\t\t\t\tcontinueTrain = false;\n\t\t\t}\n\n\t\t\t// Report epoch\n\n\t\t}\n\t\t//console.log(\"Training ended after \" + (Date.now() - startTime)/1000 + \" seconds\")\n\t}", "function trainModelamzn() {\r\n const trainingOptionsamzn = {\r\n epochs: 50, // 50 times\r\n batchSize: 10\r\n }\r\n nnetamzn.train(trainingOptionsamzn, whileTrainingamzn, finishedTrainingamzn);\r\n}", "function trainModelfb() {\r\n const trainingOptionsfb = {\r\n epochs: 50, // 50 times\r\n batchSize: 10\r\n }\r\n nnetfb.train(trainingOptionsfb, whileTrainingfb, finishedTrainingfb);\r\n}", "function train(perceptron,trainData) {\n let label1 = convertLetterToNumber(perceptron.label1);\n let label2 = convertLetterToNumber(perceptron.label2);\n for (let index = 0 ; index < trainData.length ; index++){\n let yLabel = trainData[index][0];\n if(yLabel === label1 || yLabel === label2) {\n let isPassTrashold = prediction(perceptron, trainData[index]);\n let isLabel1 = (isPassTrashold && label1 === yLabel);\n let isLabel2 = (!isPassTrashold && label1 !== yLabel);\n if (!(isLabel1 || isLabel2)) {\n if (label1 === yLabel) {\n for (let i = 0, j = 1; i < trainData.length; i++ , j++) {\n perceptron.weights[i] += trainData[index][j];\n }\n } else {\n for (let i = 0, j = 1; i < trainData.length; i++ , j++) {\n perceptron.weights[i] -= trainData[index][j] ;\n }\n }\n }\n }\n }\n}", "function train(data) {\n let net = new brain.NeuralNetwork();\n net.train(processTrainingData(data, {\n errorThresh: 0.005, // error threshold to reach\n iterations: 20000, // maximum training iterations\n log: true, // console.log() progress periodically\n logPeriod: 10, // number of iterations between logging\n learningRate: 0.1 // learning rate\n}));\n trainedNet = net.toFunction();\n\tdocument.getElementById(\"rslts\").innerHTML = \"Training complete.\";\n\t\n}", "function trainFromHTML(body, ans) {\n var doc = parse5.parse(body); // Parse the HTML\n var wordInfo = getWordInfo(doc);\n\n var candidates = generateCandidates(wordInfo);\n\n //train the NN to be better at identifying each feature\n for (var i = 0; i < 4000; i++) {\n for (var candidate in candidates) {\n var inNode = nnlib.genInputNodes(candidates[candidate].words);\n for (var target in ans) {\n var prob = nnlib.predict(config.cfg.nns[target], inNode);\n if (ans[target].indexOf(candidates[candidate].raw) != -1) nnlib.propagateBack(config.cfg.nns[target], 1);\n else nnlib.propagateBack(config.cfg.nns[target], 0);\n } \n }\n }\n}", "constructor(label){\n // Affect the members\n this.label = label;\n this.totalData = [];\n this.trainingData = [];\n this.testingData = [];\n this.trainingLabels = [];\n this.testingLabels = [];\n }", "function train() {\n\n //(1)DT algorithm===============================================================================\n console.log(\"start the decision tree algorithm***************************\");\n var xtree = trainingSetX;\n /*console.log(\"xtree+++++++++++++++++\");\n console.log(xtree);*/\n //console.log(trainingSetYNum);\n var result2 = [];\n var resYCal = [];\n var classifier = new ml.DecisionTree({\n data: xtree,\n result: trainingSetYCal\n });\n classifier.build();\n\n for (var i = 0; i < testSetX.length; i++) {\n result2.push(classifier.classify(testSetX[i]));\n }\n //console.log(\"Object.keys(result2[0]\");\n\n\n //console.log(\"decision tree prediction testSetY: \");\n for (var i = 0; i < result2.length; i++) {\n resYCal.push(Object.keys(result2[i])[0]);\n }\n\n var predictionError = error(resYCal, testSetYCal);\n var treepredict = classifier.classify(todayActi);\n classifier.prune(1.0);\n //dt.print();\n /* console.log(\"resYCal++++++++++++++++++++++++\");\n console.log(resYCal);\n console.log(\"testSetYCal+++++++++++++++++++\");\n console.log(testSetYCal);\n console.log('Decision Tree algorithm result = ${predict}------------------');\n console.log(predict);*/\n // console.log(\"sleep quality will be:=======\");\n //console.log(Object.keys(treepredict)[0]);\n var tree_accuracy = Math.round((testSetLength - predictionError) / testSetLength * 100);\n /* console.log(\"decision tree prediction accuracy will be: test length-${testSetLength} and number of wrong predictions - ${predictionError}\");\n console.log(testSetLength);\n console.log(predictionError);\n console.log(tree_accuracy);*/\n\n // (2) svm suppourt vector machine===================================================================================\n\n console.log(\"start the SVM algorithm, this one is pretty slow***********************************\");\n var svmResult = [];\n var xsvm = xtree.map(function (subarray) {\n return subarray.slice(0, 8);\n });\n\n /* console.log(\"trainingsetx:++++++++++++++++ in svm\");\n console.log(xsvm);\n console.log(\"trainingSetYBin:+++++++++++in svm\");\n console.log(trainingSetYBin);*/\n var svm = new ml.SVM({\n x: xsvm,\n y: trainingSetYBin\n\n });\n svm.train({\n C: 1.1, // default : 1.0. C in SVM.\n tol: 1e-5, // default : 1e-4. Higher tolerance --> Higher precision\n max_passes: 20, // default : 20. Higher max_passes --> Higher precision\n alpha_tol: 1e-5, // default : 1e-5. Higher alpha_tolerance --> Higher precision\n\n kernel: {type: \"polynomial\", c: 1, d: 5}\n });\n\n for (var i = 0; i < testSetX.length; i++) {\n svmResult.push(svm.predict(testSetX[i]));\n }\n /* console.log(\"svmResult-----------------array\");\n console.log(svmResult);*/\n\n var predictionError = error(svmResult, testSetYBin);\n var svm_accuracy = Math.round((testSetLength - predictionError) / testSetLength * 100);\n var svmpredict = svm.predict(todayActi);\n let svmpredictRel;\n if (svmpredict == 1) {\n svmpredictRel = 'good';\n }\n if (svmpredict == -1) {\n svmpredictRel = 'fair or poor';\n }\n\n // (3) KNN (K-nearest neighbors)===================================================================================\n\n console.log(\"start KNN algorithm ****************************************\");\n\n var knnResult = [];\n var knnResult2 = [];\n let Rel;\n var xknn = xtree.map(function (subarray) {\n return subarray.slice(0, 8);\n });\n var knn = new ml.KNN({\n data: xknn,\n result: trainingSetYNum\n });\n for (var i = 0; i < testSetX.length; i++) {\n var y = knn.predict({\n x: testSetX[i],\n k: 1,\n weightf: {type: 'gaussian', sigma: 10.0},\n distance: {type: 'euclidean'}\n });\n if (y > 97) {\n Rel = 'good';\n }\n else if (y > 93 && y <= 97) {\n Rel = 'fair';\n }\n else {\n Rel = 'poor';\n }\n knnResult2.push(Rel);\n\n knnResult.push(y);\n }\n /* console.log(\"knn predict test y: \");\n console.log(knnResult2);\n console.log(knnResult);*/\n\n\n var predictionError = error(knnResult2, testSetYCal);\n var knn_accuracy = Math.round((testSetLength - predictionError) / testSetLength * 100);\n\n var knnpredict = knn.predict({\n\n x: todayActi,\n k: 1,\n weightf: {type: 'gaussian', sigma: 10.0},\n distance: {type: 'euclidean'}\n\n });\n\n let knnpredictRel;\n if (knnpredict > 97) {\n knnpredictRel = 'good';\n }\n else if (knnpredict > 93 && knnpredict <= 97) {\n knnpredictRel = 'fair';\n }\n else {\n knnpredictRel = 'poor';\n }\n\n\n // (4) MLP algorithm===================================================================================\n\n /* console.log(\"start MLP (Multi-Layer Perceptron)================================================\");\n\n var mlpResult = [];\n // let Rel;\n var xmlp = xtree.map(function (subarray) {\n return subarray.slice(0, 8);\n });\n console.log(xmlp);\n var mlp = new ml.MLP({\n 'input': xmlp,\n 'label': trainingSetYBin,\n 'n_ins': 8,\n 'n_outs': 1,\n 'hidden_layer_sizes': [4, 4, 5]\n });\n\n mlp.set('log level', 1); // 0 : nothing, 1 : info, 2 : warning.\n\n mlp.train({\n 'lr': 0.6,\n 'epochs': 800\n });\n for (var i = 0; i < testSetX.length; i++) {\n mlpResult.push(mlp.predict(testSetX[i]));\n\n }\n console.log(mlpResult);*/\n\n\n //return results\n return [Object.keys(treepredict)[0], tree_accuracy, svmpredictRel, svm_accuracy, knnpredictRel, knn_accuracy];\n\n\n }", "train(input, target) {\r\n this.feedForward(input);\r\n this.backPropagation(input, target);\r\n }", "function train(title, recommendBool){\n var classification = recommendBool ? \"recommend\" : \"not\";\n NewsRanker.train(getFeatures(title), classification);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get the policy for the user.
function getPolicy(user, context, cb) { request.post({ url: EXTENSION_URL + "/api/users/" + user.user_id + "/policy/" + context.clientID, headers: { "x-api-key": API_KEY }, json: { connectionName: context.connection || user.identities[0].connection, groups: user.groups }, timeout: 5000 }, cb); }
[ "function getPolicy(user, context, cb) {\n request.post({\n url: EXTENSION_URL + \"/api/users/\" + user.user_id + \"/policy/\" + context.clientID,\n headers: {\n \"x-api-key\": \"0bce7e8cf6a89bdc2b913d51b39324dbb72fbcbcca1e800c82b30da137faf3b9\"\n },\n json: {\n connectionName: context.connection || user.identities[0].connection,\n groups: user.groups\n },\n timeout: 5000\n }, cb);\n }", "function getPolicy(user, context, cb) {\n request.post({\n url: EXTENSION_URL + \"/api/users/\" + user.user_id + \"/policy/\" + context.clientID,\n headers: {\n \"x-api-key\": configuration.AUTHZ_EXT_API_KEY\n },\n json: {\n connectionName: context.connection || user.identities[0].connection,\n groups: parseGroups(user.groups)\n },\n timeout: 5000\n }, cb);\n }", "getPolicy() {\n return __awaiter(this, void 0, void 0, function* () {\n return this.getNamedPolicy('p');\n });\n }", "get policy() {\n return this.getStringAttribute('policy');\n }", "function getPolicy() {\n if (policy === undefined) {\n policy = null;\n\n if (_global.trustedTypes) {\n try {\n policy = _global.trustedTypes.createPolicy('angular', {\n createHTML: function createHTML(s) {\n return s;\n },\n createScript: function createScript(s) {\n return s;\n },\n createScriptURL: function createScriptURL(s) {\n return s;\n }\n });\n } catch (_a) {// trustedTypes.createPolicy throws if called with a name that is\n // already registered, even in report-only mode. Until the API changes,\n // catch the error not to break the applications functionally. In such\n // cases, the code will fall back to using strings.\n }\n }\n }\n\n return policy;\n }", "getPolicy() {\n return self.glitchApi().getProjectPolicy(self.currentProjectId());\n }", "function getPolicy() {\n if (policy === undefined) {\n policy = null;\n if (global.trustedTypes) {\n try {\n policy = global.trustedTypes.createPolicy('angular', {\n createHTML: (s) => s,\n createScript: (s) => s,\n createScriptURL: (s) => s,\n });\n }\n catch {\n // trustedTypes.createPolicy throws if called with a name that is\n // already registered, even in report-only mode. Until the API changes,\n // catch the error not to break the applications functionally. In such\n // cases, the code will fall back to using strings.\n }\n }\n }\n return policy;\n}", "function getPolicy() {\n if (policy === undefined) {\n policy = null;\n if (_global.trustedTypes) {\n try {\n policy = _global.trustedTypes.createPolicy('angular', {\n createHTML: (s) => s,\n createScript: (s) => s,\n createScriptURL: (s) => s,\n });\n }\n catch (_a) {\n // trustedTypes.createPolicy throws if called with a name that is\n // already registered, even in report-only mode. Until the API changes,\n // catch the error not to break the applications functionally. In such\n // cases, the code will fall back to using strings.\n }\n }\n }\n return policy;\n}", "function getPolicy() {\n if (policy === undefined) {\n policy = null;\n if (_global.trustedTypes) {\n try {\n policy = _global.trustedTypes.createPolicy('angular#unsafe-bypass', {\n createHTML: s => s,\n createScript: s => s,\n createScriptURL: s => s\n });\n } catch {\n // trustedTypes.createPolicy throws if called with a name that is\n // already registered, even in report-only mode. Until the API changes,\n // catch the error not to break the applications functionally. In such\n // cases, the code will fall back to using strings.\n }\n }\n }\n return policy;\n}", "policyId() {\n if (this._options.policy) {\n return Promise.resolve(this._options.policy);\n } else {\n return this.policies().then(policiesObject => {\n if (policiesObject.policies.length > 1) {\n throw 'You have more than one security policy. Please provide a policy to work with.';\n } else {\n return Promise.resolve(policiesObject.policies[0].policyId);\n }\n });\n }\n }", "function getPolicy(layer) {\n\treturn layer[OWNER_POLICY];\n}", "getPolicy (name) {\n if (!this.policies || !this.policies[name]) {\n console.log(`JsDataServerSetup.getPolicy() policies do not exist or cannot find policy ${name}`)\n throw new Error()\n } else if (typeof this.policies[name] !== 'function') {\n console.log(`JsDataServerSetup.getPolicy() policy ${name} is not a middleware method ie: (req, res, next) => { ... }`)\n throw new Error()\n }\n return this.policies[name]\n }", "getPolicy(billingAccountId, options) {\n return this.client.sendOperationRequest({ billingAccountId, options }, getPolicyOperationSpec);\n }", "get policyId() {\n return this.getStringAttribute('policy_id');\n }", "function fetchPolicy(id) {\n const request = lookup('service:request');\n return request.promiseRequest({\n modelName: 'policy',\n method: 'fetchPolicy',\n query: { data: id }\n });\n}", "function tryInitFromUserPolicy() {\n var defaultPolicy = DEFAULT_POLICIES[$scope.policyId];\n // the user may not have a policy, so set/use a default if needed\n if (!$rootScope.wallets.current.hasPolicy()) {\n return setPolicyData(defaultPolicy);\n }\n var policy = _.filter($rootScope.wallets.current.data.admin.policy.rules, function (policyRule, idx) {\n return policyRule.id === BG_DEV.WALLET.BITGO_POLICY_IDS[$scope.policyId];\n })[0];\n var userPolicy = policy || defaultPolicy;\n setPolicyData(userPolicy);\n }", "subscriptionThrottlingPolicyGet(policyId) {\n return this.client.then((client) => {\n return client.apis['Subscription Policy (Individual)'].get_throttling_policies_subscription__policyId_(\n { policyId: policyId },\n this._requestMetaData(),\n );\n });\n }", "applicationThrottlingPolicyGet(policyId) {\n return this.client.then((client) => {\n return client.apis['Application Policy (Individual)'].get_throttling_policies_application__policyId_(\n { policyId: policyId },\n this._requestMetaData(),\n );\n });\n }", "getPermissionsForUser(user) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.getFilteredPolicy(0, user);\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
postUpload controller for route POST /files Creates a file or a folder on the path `/temp/files_manager/` containing data. Header params: xtoken: connection token created when user signsin JSON body: name: name of the file type: folder | file | image parentId: id of the parent folder or zero for current folder isPublic: true | false data: base64 encoded string to decode as the file's content
async function postUpload(req, res) { const key = req.headers['x-token']; // get token from header const userId = await redisClient.get(`auth_${key}`); let user = ''; // find connected user if (userId) user = await dbClient.client.collection('users').findOne({ _id: ObjectId(userId) }); // MIGHT NEED TO GUARD USER const { name } = req.body; // name if (!name) res.status(400).json({ error: 'Missing name' }); const { type } = req.body; // type if (!type || !['folder', 'image', 'file'].includes(type)) res.status(400).json({ error: 'Missing type' }); let path = '/tmp/files_manager'; // create file/folder in this path const parentId = req.body.parentId || 0; // parentId if (parentId !== 0) { const parentFile = await dbClient.client.collection('files').findOne({ _id: ObjectId(parentId) }); if (!parentFile) { res.status(400).json({ error: 'Parent not found' }); return; } if (parentFile.type !== 'folder') { res.status(400).json({ error: 'Parent is not a folder' }); return; } path = parentFile.localPath; } const isPublic = req.body.isPublic || false; // isPublic let { data } = req.body; // data if (!data && type !== 'folder') res.status(400).json({ error: 'Missing data' }); else if (data) data = Buffer.from(data, 'base64').toString(); // decode data const file = uuidv4(); path += `/${file}`; // check if /tmp/files_manager exists, if not create it if (!fs.existsSync('/tmp/files_manager')) fs.mkdirSync('/tmp/files_manager'); if (type === 'folder') fs.mkdirSync(path); else fs.writeFileSync(path, data); // save document on db const docFile = await dbClient.client.collection('files').insertOne({ userId: user._id, name, type, isPublic, parentId, localPath: path, }); if (docFile) { res.json({ id: docFile.ops[0]._id, userId: docFile.ops[0].userId, name, type, isPublic, parentId, }); } }
[ "function upload(filename, filedata) {\n // By calling the files action with POST method in will perform \n // an upload of the file into Backand Storage\n return $http({\n method: 'POST',\n url : Backand.getApiUrl() + baseActionUrl + objectName,\n params:{\n \"name\": filesActionName\n },\n headers: {\n 'Content-Type': 'application/json'\n },\n // you need to provide the file name and the file data\n data: {\n \"filename\": filename,\n \"filedata\": filedata.substr(filedata.indexOf(',') + 1, filedata.length) //need to remove the file prefix type\n }\n });\n }", "function upload(filename, filedata) {\n\t\t\t\t// By calling the files action with POST method in will perform \n\t\t\t\t// an upload of the file into Backand Storage\n\t\t\t\t\tconsole.log(filename);\n\t\t\t\t\tconsole.log(filedata);\n\t\t\t\t\treturn $http({\n\t\t\t\t\t method: 'POST',\n\t\t\t\t\t url : Backand.getApiUrl() + baseActionUrl + objectName,\n\t\t\t\t\t params:{\n\t\t\t\t\t\t\"name\": filesActionName\n\t\t\t\t\t },\n\t\t\t\t\t headers: {\n\t\t\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t\t },\n\t\t\t\t\t // you need to provide the file name and the file data\n\t\t\t\t\t data: {\n\t\t\t\t\t\t\"filename\": filename,\n\t\t\t\t\t\t\"filedata\": filedata.substr(filedata.indexOf(',') + 1, filedata.length) //need to remove the file prefix type\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t }", "function postFiles(fullPath, response, request, match){\n request.setEncoding('binary');\n request.body = []; \n request.on('data', function (chunk) {\n request.body += chunk;\n });\n \n request.on('end', function () {\n fs.writeFile(fullPath, request.body, 'binary', function(err){\n if (err){ throw err};\n log('action', request, 'Writing of the file complete: ' , fullPath);\n response.writeHead(200, {'content-type':'text/plain'}); \n\t\t \t response.write(\"\\nFile Successfully Uploaded \");\n \t \t \tresponse.end();\n \t \t \t//updateList(); Optional\n });\n });\n}", "function doPostPostOnGroupWithFile($http, url, opt, files, callback){\n var fd = new FormData();\n angular.forEach(files, function(file) {\n fd.append('post_media[]', file);\n });\n fd.append('reqObj', angular.toJson(opt));\n \n $http({\n method: \"POST\",\n url: url,\n data : fd,\n headers: {'Content-Type': undefined}, \n transformRequest: angular.identity,\n })\n .success( function(data){\n callback(data);\n })\n .error(function(data){\n if(!checkTokenNotExpired(data)) {\n callback(data);\n }\n });\n}", "async uploadFiles(files, project) {\n var file, filepath;\n for (var i = 0; i < files.length; i++) {\n file = files.item(i);\n //see if it is a marxan data file\n if (file.name.slice(-4) === \".dat\") {\n const formData = new FormData();\n formData.append(\"user\", this.state.owner);\n formData.append(\"project\", project);\n //the webkitRelativePath will include the folder itself so we have to remove this, e.g. 'Marxan project/input/puvspr.dat' -> '/input/puvspr.dat'\n filepath = file.webkitRelativePath.split(\"/\").slice(1).join(\"/\");\n formData.append(\"filename\", filepath);\n formData.append(\"value\", file);\n this.log({\n method: \"uploadFiles\",\n status: \"Uploading\",\n info: \"Uploading: \" + file.webkitRelativePath,\n });\n await this._post(\"uploadFile\", formData);\n }\n }\n }", "async uploadPostImage () {\n const {ctx} = this\n try {\n const result = await ctx.service.post.savePostImage()\n ctx.body = {\n status: 'success',\n msg: 'store the files successfully',\n data: result\n }\n } catch (e) {\n ctx.body = {\n status: 'failed',\n msg: e\n }\n }\n }", "submitFiles() {\n\t\t\t/*\n\t\t\t Initialize the form data\n\t\t\t*/\n\t\t\tlet formData = new FormData();\n\n\t\t\t/*\n\t\t\t Iteate over any file sent over appending the files\n\t\t\t to the form data.\n\t\t\t*/\n\t\t\tfor (var i = 0; i < this.files.length; i++) {\n\t\t\t\tlet file = this.files[i];\n\n\t\t\t\tformData.append('files[' + i + ']', file);\n\t\t\t}\n\n\t\t\t// Add Path\n\t\t\t//formData.append(\"path\", \"test\");\n\n\t\t\t/*\n\t\t\t Make the request to the POST /multiple-files URL\n\t\t\t*/\n\t\t\tsuccess = false;\n\t\t\taxios.post(uri_wirbelwind_box + this.item.path,\n\t\t\t\tformData,\n\t\t\t\t{\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t'Content-Type': 'multipart/form-data'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t).then(function () {\n\t\t\t\tconsole.log('SUCCESS!!');\n\t\t\t})\n\t\t\t\t.catch(function () {\n\t\t\t\t\tconsole.log('FAILURE!!');\n\t\t\t\t});\n\n\t\t\tthis.loadChildren();\n\t\t}", "function uploadFiles(nodeRef, files, comment) {\n var formData = new FormData();\n formData.append('nodeRef', nodeRef);\n return _uploadFiles('/api/openesdh/files', formData, files, comment);\n }", "async createMultipartUpload(filename, options) {\n const path = options.dashboard && options.widget ? `/data/files/${options.dashboard}/${options.widget}` : `/files`;\n const result = await this.doRequest({\n path,\n method: \"POST\",\n body: {\n multipart_action: \"start\",\n filename,\n public: options.isPublic,\n contentType: options.contentType,\n },\n });\n return result;\n }", "function uploadfileobject(token, obj){\n\n fileinstance.save(obj, function(err, body){\n if(err){\n return res.json({'error': err.message})\n }else{\n const fileid = body._id\n storers.find({'phoneID': token}, function(err, body){\n if(body){\n return res.json({'err': err.message})\n }else{\n console.log(body)\n body.files.push(fileid)\n body.save(function(err, body){\n //NOW ADD THE FILENAME TO THE USER SCHEMA\n posters.find({'uid': uid}, function(err, body){\n if(err){\n return res.json({'error': err.message})\n }else{\n body.files.push(req.body['filename'], function(err, body){\n if(err){\n return res.json({'callback': false})\n }else{\n const message = 'successfully added ' + req.body['filename'] + ' to onyx drive'\n return res.status(200).json({'callback':{'message': message, 'body': body.files}})\n }\n })\n }\n })\n })\n }\n })\n }\n })\n }", "function doPostPostOnGroupWithFile($http, url, opt, files, callback){\n var fd = new FormData();\n angular.forEach(files, function(file) {\n fd.append('post_media[]', file);\n });\n fd.append('reqObj', angular.toJson(opt));\n \n $http({\n method: \"POST\",\n url: url,\n data : fd,\n headers: {'Content-Type': undefined}, \n transformRequest: angular.identity,\n })\n .success( function(data){\n callback(data);\n })\n .error(function(data, status, headers, config){\n callLogServiceOnError($http, url, status, {reqObj: opt}, 'application/x-www-form-urlencoded; charset=UTF-8', data, config);\n if(status === 403) { // Check if the request is valid not by hacker \n if(data.code == 1045 && data.message == \"TRIAL_EXPIRED\"){\n if(TrailExpiredModal){\n angular.element(document.getElementById('AppController')).scope().checkTrialExpired();\n }\n }else{\n notAuthorizedThisRequest();\n }\n } else if(status === 401) {\n accessTokenExpiredLogout();\n }else if(!checkTokenNotExpired(data)) {\n callback(data);\n }\n });\n}", "function postFiles(audio, video) {\n console.log(\"Posting files to the server\");\n // getting unique identifier for the file name\n fileName = generateRandomString();\n\n // this object is used to allow submitting multiple recorded blobs\n var files = {};\n\n // recorded audio blob\n files.audio = {\n name: fileName + '.' + audio.blob.type.split('/')[1],\n type: audio.blob.type,\n contents: audio.dataURL\n };\n\n files.video = {\n name: fileName + '.' + video.blob.type.split('/')[1],\n type: video.blob.type,\n contents: video.dataURL\n };\n\n\n files.uploadOnlyAudio = !video;\n console.log(\"Unable to locate files\");\n\n videoElement.src = '';\n videoElement.poster = '/ajax-loader.gif';\n\n xhr('/upload', JSON.stringify(files), function(_fileName) {\n var href = location.href.substr(0, location.href.lastIndexOf('/') + 1);\n videoElement.src = href + 'uploads/' + _fileName;\n videoElement.play();\n videoElement.muted = false;\n videoElement.controls = true;\n\n var h2 = document.createElement('h2');\n h2.innerHTML = '<a href=\"' + videoElement.src + '\">' + videoElement.src + '</a>';\n document.body.appendChild(h2);\n });\n\n if (mediaStream) mediaStream.stop();\n }", "function uploadFile() {\n dropbox({\n resource: 'files/upload',\n parameters: {\n path: `/${filename}`,\n },\n readStream: fs.createReadStream('temp.png'),\n }, (error) => {\n if (error) {\n throw error;\n }\n createLinkAndSaveToDatabase();\n });\n}", "uploadFile(file) {\r\n\t\t\t\t/*.....*/\r\n this.$store.dispatch('postRouteKML', data);\r\n }", "function UploadFile(file, user) {\n var fd = new FormData();\n fd.append('id', user._id);\n fd.append('username', user.username);\n fd.append('myfile', file.upload);\n return $http.post('/api/users/upload', fd, {\n transformRequest: angular.identity,\n headers: { 'Content-Type': undefined}}).then(handleSuccess, handleError);\n }", "function CreateFileAndFolderApi() {\n // Currently, only one meter per page (i.e. accurate reporting of only one\n // ...upload at a time)\n // TODO - Dynamically add progress meter elems to page per upload started\n var meter = createProgressMeter();\n\n /**\n * Url to REST API for current auth\n */\n function restApi(action, moreParams) {\n return boxApi.url + \"rest?action=\" + action + \"&api_key=\" + boxApi.apiKey\n + \"&auth_token=\" + boxApi.authToken + \"&\" + (moreParams || \"\");\n }\n\n /**\n * Url to which to upload files\n *\n * If no valid folder is provided, root is assumed\n */\n function uploadUrl(folder) {\n // Folder exists (@id), just created (folder_id), or root (0)\n var folderId = folder['@id'] || folder['folder_id'] || '0';\n\n return boxApi.url + \"upload/\" + boxApi.authToken + \"/\" + folderId;\n }\n\n /**\n * The meter that will show the progress of the upload\n */\n function createProgressMeter() {\n var meterWrap = jQuery(\".meter-wrap\");\n\n return {\n grow : function(percent) {\n $('.meter-value').css('width', percent + '%');\n $('.meter-text').text(percent + '%');\n },\n show : function() {\n meterWrap.show();\n },\n hide : function() {\n //meterWrap.hide('medium');\n meterWrap.hide('slow');\n $('.meter-value').css('width', '0');\n $('.meter-text').text('');\n }\n };\n }\n\n /**\n * Simple object to manage current estimation of the upload progress\n */\n function CreateEstimationMetric() {\n return {\n total : 0,\n percentage : function(progress) {\n if (this.total == 0) return 0;\n\n return Math.ceil(100, parseInt((progress / this.total) * 100));\n }\n };\n }\n\n /**\n * Extract the requested files for upload from drop event\n */\n function extractFiles(evt) {\n var files = evt.originalEvent.dataTransfer.files;\n\n // @TODO determine if we want to check for file.size > LIMIT\n\n if (files.length < 1) {\n boxApi.dbg(\"No files found in event. Nothing dragged?\");\n return null;\n }\n\n return files;\n }\n\n /**\n * Return a function that will calculate the estimated completion based on\n * data in an upload event\n */\n function CreateProgressTicker(estimationMetrics) {\n return function(uploadEvt) {\n boxApi.dbg('Progress on upload. File size uploaded: ' + uploadEvt.loaded);\n\n var percent = estimationMetrics.percentage(uploadEvt.loaded);\n meter.grow(percent);\n }\n }\n\n /**\n * XHR completed, process it and send return to the callback function\n */\n function xhrComplete(xhr, callback) {\n meter.hide();\n\n if (xhr.status !== 200) {\n boxApi.dbg('Upload returned bad status ' + xhr.status);\n boxApi.dbg('Response: ' + (xhr.responseText || ''));\n\n return;\n }\n\n var json = goessner.parseXmlStringToJsonObj(xhr.responseText);\n\n if (!json) {\n boxApi.dbg('Could not parse xml response =(' + xhr.responseText);\n return;\n }\n\n var files = json.response.files;\n\n if (!files) {\n boxApi.dbg('Found no files in response');\n boxApi.dbg('xml: ' + xhr.responseText);\n return;\n }\n\n // Force an array if only one element\n if (!files.length) {\n files = [files.file];\n }\n\n var fileInfo = []\n for (var f=0; f < files.length; f += 1) {\n fileInfo.push({\n id : files[f]['@id'],\n name : files[f]['@file_name']\n });\n }\n\n // Send file info back out to caller\n callback(fileInfo);\n }\n\n /**\n * Uploads a collection of DOM File objects, then calls the\n * ...callback with the info of the uploaded files as input\n */\n function postFiles(files, folder, callback) {\n if (!files) return;\n\n var estimated = CreateEstimationMetric();\n\n boxApi.dbg('Attempting to upload ' + files.length + ' files.');\n\n // Add a form element for each file dropped\n var formData = new FormData();\n for (var f=0; f < files.length; f += 1) {\n boxApi.dbg('file: ' + files[f].name);\n formData.append(\"file\" + f, files[f]);\n\n estimated.total += files[f].fileSize;\n }\n\n // Upload the root box folder (in bvanevery, for bvanevery@box.net)\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", uploadUrl(folder), true);\n\n xhr.onload = function(xhr_completed_evt) {\n boxApi.dbg('XHR completed');\n\n xhrComplete(xhr, callback);\n };\n\n // Upload specific events\n var xhrUploader = xhr.upload;\n xhrUploader.addEventListener(\"progress\", CreateProgressTicker(estimated), false);\n\n meter.show();\n\n try\n {\n xhr.send(formData);\n }\n catch (e)\n {\n boxApi.dbg(e.description);\n boxApi.dbg(e);\n meter.hide();\n }\n }\n\n /**\n * API into folder specific things\n */\n function CreateFolderApi() {\n function lookupFolder(name, callback) {\n var url = restApi(\"get_account_tree\",\n \"folder_id=0&params[]=nofiles&params[]=nozip&params[]=onelevel\");\n\n $.get(url, function(data, textStatus, jqXHR) {\n var json = goessner.parseXmlStringToJsonObj(jqXHR.responseText);\n\n var tree = json.response.tree;\n\n // tree.folder = root id = 0\n tree.root = tree.folder;\n\n if (!tree.root.folders) {\n boxApi.dbg(\"No folders in root!\");\n return callback(null);\n }\n\n // Force an array if there is only one child of the root folde\n if (!tree.root.folders.folder.length) {\n tree.root.folders.folder = [tree.root.folders.folder];\n }\n\n // select where folder.name == name\n var foldersLen = tree.root.folders.folder.length;\n for (var f=0; f < foldersLen; f += 1) {\n var folder = tree.root.folders.folder[f];\n if (folder['@name'] == name) {\n return callback(folder);\n }\n }\n\n return callback(null);\n });\n }\n\n function createFolder(name, callback) {\n var urlSafeName = encodeURIComponent(name);\n var url = restApi(\"create_folder\",\n \"parent_id=0&share=0&name=\" + urlSafeName);\n\n $.get(url, function(data, textStatus, jqXHR) {\n var json = goessner.parseXmlStringToJsonObj(jqXHR.responseText);\n\n if (!json) {\n boxApi.dbg(\"Couldn't create folder \" + name);\n return;\n }\n\n callback(json.response.folder);\n });\n }\n\n /**\n * Find folder or create it, then send it to the callback method\n */\n function getOrCreateFolder(name, callback) {\n lookupFolder(name, function(folder){\n if (folder == null) {\n createFolder(name, callback);\n return;\n }\n\n callback(folder);\n });\n }\n\n function uploadFilesToFolder(evt, folderName, callback) {\n var files = extractFiles(evt);\n\n // No folder requested, just upload into root\n if (!folderName) {\n postFiles(files, {}, callback);\n return;\n }\n\n getOrCreateFolder(folderName, function(folder) {\n postFiles(files, folder, callback);\n });\n }\n\n // Public methods exposed for folder API\n return {\n uploadFilesToFolder : uploadFilesToFolder\n };\n }\n\n // The only method really needed is uploading files to a folder\n return CreateFolderApi();\n}", "function _uploadDocument() {\r\n vm.authorizationFile = $scope.content;\r\n vm.authorizationName = vm.myFile.name;\r\n vm.myFile = { authorizationFile: vm.authorizationFile, authorizationName: vm.authorizationName };\r\n\r\n restApi.uploadDocument(vm)\r\n .success(function (data, status, headers, config) {\r\n vm.myFile.authorizationID = data;\r\n vm.documentsList.push(vm.myFile);\r\n vm.myFile = null;\r\n })\r\n\r\n .error(function (error) {\r\n // alert(\"Something went wrong. Please try again.\");\r\n vm.toggleModal(\"error\");\r\n });\r\n }", "async function postFiles(conversation) {\n const path = config.filesPath;\n const files = [];\n const fileNames = fs.readdirSync(path);\n fileNames.forEach(name => {\n const file = new Circuit.File(path + name);\n files.push(file);\n });\n\n const item = await client1.addTextItem(conversation.convId, {\n content: 'test file upload',\n attachments: files\n });\n logger.info(`[APP]: Bot1 posted ${item.attachments.length} files to item ${item.itemId}`);\n }", "function uploadFilePublication(req, res) {\n var userId = req.user.sub; //En esta variable recojemos el id del usuario que este logeado en este momento\n var publicationId = req.params.id;\n\n if (req.files.file) { //si existe files , es decir si estamos enviando algun fichero podremos subir el fichero en si y guardarlo e la db\n var file_path = req.files.file.path; // sacamos el path completo de la imagen que queremos subir, image es el campo que estamos enviando por post y de ahi sacamos el campo path\n var files_split = file_path.split('\\\\'); //en la variable file_path se guarda un string con la ruta del archivo y esta separada por '\\' ej uploads\\users\\5MdupNps5rOyV8s8Ln5DvR90.png con la funcion split y declarandole las '\\' le decimos que corte las barras y al final queda algo como esto [ 'uploads', 'users', 'QMPHzXA0IJhALKIwXGBiL8l5.png' ]\n console.log(files_split);\n var fileName = files_split[2]; //en files split esta guardado un array [ 'uploads', 'users', 'QMPHzXA0IJhALKIwXGBiL8l5.png' ] e la variable fileName guardamos el indice 2, donde esta el nombre del fichero\n var ext_split = fileName.split('\\.'); // cortamos por el punto\n var fileExt = ext_split[1]; // guardamos la extencion del fichero, ej : png\n console.log(fileExt);\n //comparar si el userId que estoy recibiendo por la url es diferente al user id que yo tengo en la request, porque este metodo para actualizar datos lo vamos a usar cuando el propio usuario que se a creado su cuenta pueda modificarse sus propios datos\n if (userId != req.user.sub) {\n return removeFileOfUpload(res, file_path, 'No tiene permiso para actualizar los datos');//si el usuario que nos llega por url no es igual al is del usuario que tenemos en la request\n\n }\n if (fileExt == 'png' || fileExt == 'jpg' || fileExt == 'jpeg' || fileExt == 'mp4' || fileExt == 'avi') { //Si la extension del archivo que intentan subir es valido, entonces vamos a actualizar el objeto en la base de datos\n Publication.findOne({ \"user\": userId, \"_id\": publicationId }).exec((err, publication) => { //Fin devuelve un array por lo tanto no toma como que es un token incorrecto, pero haciendo findOne si el usuario no tiene permisos trae null y ahi si lo toma como incorrecto\n if (publication) {\n //actualizar documento del usuario logeado\n Publication.findByIdAndUpdate(publicationId, { file: fileName }, { new: true }, (err, publicationUpdate) => {\n if (err) return res.status(500).send({\n message: 'Error en la la peticion'\n });\n\n if (err) return res.status(404).send({\n message: 'No se ha podido actualizar el usuario'\n });\n return res.status(200).send({\n publication: publicationUpdate\n });\n });\n } else {\n return removeFileOfUpload(res, file_path, 'No tienes permisos');\n }\n\n });\n\n } else {\n //Eliminar fichero \n return removeFileOfUpload(res, file_path, 'Extension no valida');\n }\n } else {\n return res.status(200).send({\n message: 'no se han subido archivos'\n });\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Throw exception if `obj` is not a Position object
function requirePosition(obj) { if (!isPosition(obj)) throw AssertionException("Is not a position"); }
[ "function isPosition(obj)\n{\n try {\n return obj.isPosition === true;\n } catch (e) {\n return false;\n }\n}", "static isIPosition(obj) {\n return (obj\n && (typeof obj.lineNumber === 'number')\n && (typeof obj.column === 'number'));\n }", "static isIPosition(obj) {\n return (obj\n && (typeof obj.lineNumber === 'number')\n && (typeof obj.column === 'number'));\n }", "function checkNullPoint(ind, obj){\n if(obj[ind] === null){ return new simplePoint(this.x, this.y) }\n return new simplePoint(obj[ind].x, obj[ind].y)\n}", "function getLocation(obj) {\n if (obj == null) {\n return obj;\n }\n\n if (obj.primitive == \"point\" || obj.primitive == \"line\" ||\n obj.primitive == \"curve\" || obj.primitive == \"arc\") {\n return obj;\n }\n\n var location = createPoint(obj);\n\n if (location.Error) {\n location.Error = \"Invalid Location: expected point, line, curve or arc.\";\n }\n\n return location;\n}", "function assertObject(arg, obj, msg) {\n\tif (!isObject(arg, name)) {\n\t\tthrow new Error(msg ? msg : \"Argument asserted as object with name '\" + name + \"' but was not\");\n\t}\n}", "function validate(obj) {\n\t if( !obj )\n\t return false;\n\t if( typeof obj.x != 'number' ||\n\t typeof obj.y != 'number' ||\n\t typeof obj.w != 'number' ||\n\t typeof obj.h != 'number' )\n\t return false;\n\t if( isNaN(obj.x) || isNaN(obj.y) ||\n\t isNaN(obj.w) || isNaN(obj.h) )\n\t return false;\n\t if( obj.w < 0 || obj.h < 0 )\n\t return false;\n\t return true;\n\t }", "function checkCoords(elm)\n { \n if (elm.top == undefined) {\n throw 'Coordinates top point is not set';\n }\n \n if (elm.left == undefined) {\n throw 'Coordinates left point is not set';\n }\n }", "function assertObject(arg, obj, msg) {\n\tassertInitialized(arg, msg);\n\tif (obj) {\n\t\tif (!isObject(arg, obj)) throw new Error(msg ? msg : \"Argument asserted as object '\" + obj.name + \"' but was not\");\n\t} else {\n\t\tif (!isObject(arg)) throw new Error(msg ? msg : \"Argument asserted as object but was not\");\n\t}\n}", "function isMove(obj) {\n return Array.isArray(obj) && obj.length === 2 && isInteger(obj[0]) && isInteger(obj[1]);\n}", "function isTupleFromObj(obj) {\n return !!(obj && obj.val && (_.isString(obj.val) || _.isArray(obj.val) || _.isFunction(obj.val)));\n }", "function absPos(o) {\r\n var x, y, z;\r\n if (arguments.length > 2) {\r\n x = arguments[1];\r\n y = arguments[2];\r\n z = arguments[3];\r\n } else if (arguments.length == 2) {\r\n x = arguments[1].x;\r\n y = arguments[1].y;\r\n z = arguments[1].z;\r\n }\r\n return new Pos(absX(o, x), absY(o, y), objZ(o, z));\r\n}", "function ofTypeOrThrow(obj, type, error) {\n if (typeof obj == type || false) {\n return obj;\n } else {\n throw error || 'Invalid type: must be a ' + type;\n }\n }", "function requireMotion(obj)\n{\n if (!(isMotion(obj)))\n throw AssertionException(\"Is not a valid motion: \" + obj);\n}", "function getObjLoc(obj){\r\n\tif (obj)\r\n\t\treturn \"(\"+obj.offsetLeft+\",\"+obj.offsetTop+\",\"+obj.clientWidth+\"w,\"+obj.clientHeight+\"h)\";\r\n\telse\r\n\t\treturn obj;\r\n}", "function GetPositiveElement(obj) {\n\tvar thePos = false;\n\tfor (var p in obj) {\n\t\tif (obj[p].constructor == Object) {\n\t\t\tthePos = GetPositiveElement(obj[p]);\n\t\t} else if (obj[p] > 0) {\n\t\t\tthePos = p;\n\t\t}\n\t\tif (thePos !== false) break;\n\t}\n\treturn thePos;\n}", "check (position){\n return this._getThing (position.x, position.y);\n }", "function instance_position(x, y, object)\n{\n for(var i = 0; i < object.instances.length; i += 1)\n {\n var ins = object.instances[i];\n\n if(ins.point_inside(x, y))\n {\n return (ins);\n }\n }\n return (noone);\n}", "function findPos(obj) {\n var curLeft = curTop = 0;\n if (obj.offsetParent) {\n do {\n curLeft += obj.offsetLeft;\n curTop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n }\n return {x:curLeft, y:curTop};\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
CON ESTE PROCESO ENVIAMSO LOS ARCHIVOS AJAX A LA LIBRERIA DEL ING. WILLY input name archivito
function subirArchivosLibreriaInborca(inpFile){ var x = $("#documentos_cabecera"); var y = x.clone(); y.attr("id", "archivos"+fila); y.attr("name", "archivos"+fila+"[]"); $("#archivos_fila"+fila).html(y); var formData = new FormData(document.getElementById(inpFile)); $.ajax({ url: "http://ibnored.ibnorca.org/itranet/documentos/guardar_archivo.php", type: "post", dataType: "html", data: formData, cache: false, contentType: false, processData: false }).done(function(res){ console.log("transferencia satisfactoria"); }); }
[ "function CargarListaCamposArchivador() {\n\n lNombreArchivador = $(\"#DETALLE_PC_NOMBREARCHIVADOR\").val();\n\n $.ajax({\n url: \"../controladores/controladorCI.ashx?op=2100&NOMBREARCHIVADOR=\" + lNombreArchivador,\n method: \"POST\",\n dataType: \"json\",\n async: true,\n success: function (result) {\n\n if (result.toString().indexOf(\"ERROR\") == -1) {\n \n listaCamposArchivador = result;\n\n $(\"#DETALLE_PC_CAMPO\").empty();\n \n $.each(listaCamposArchivador, function () {\n $(\"#DETALLE_PC_CAMPO\").append($(\"<option> \" +\n \"</option>\").val(this[\"COLUMN_NAME\"]).html(this[\"COLUMN_NAME\"]));\n });\n\n $(\"#DETALLE_PC_CAMPO\").val($($(objTarea).children()[3]).html());\n\n \n\n //estadoFormulario = \"ingresando\";\n //idFormulario = result;\n //$(\"#idFormulario\").text(idFormulario);\n } else {\n //$(\"#lblError\").show();\n }\n\n },\n error: function (result) {\n\n //$(\"#lblError\").show();\n\n }\n });\n\n\n\n\n\n}", "function acionarDispositivo(dispositivo){\n\t//VEJO QUAL É O DIMER QUE FOI CLICADO PEGANDO A POSICAO DA LAMPADA\n\tvar posicao_lp = $(dispositivo).parent().parent().attr('posicao_lp');\n\t//VEJO QUAL É O COMODO DESSE DISPOSITIVO\n\tvar posicao_cd = $(dispositivo).parent().parent().parent().parent().attr('posicao_cd');\n\t\n\tvar funcao = 'funcao=lampada'+\n\t\t\t\t '&comando=' + $(dispositivo).attr('comando')+\n\t\t\t\t '&lp_id=' + objTabelaComodo.lista[posicao_cd].listaLampada[posicao_lp].lp_id;\n\t\n\t\n\tAJAX(SERVLET_DISPOSITIVO,funcao, function(retorno){\n\t\tretorno = JSon(retorno);\n\t\tconsole.log(retorno);\n\t\t//CASO OCORRA ALGUM ERRO\n\t\tif(!retorno){\n\t\t\talert(\"Ocorreu um erro interno ao servidor\");\n\t\t return; //IMPEDE QUE CONTINUE EXECUTANDO O CODIGO EM CASO DE ERRO\n\t\t}\n\t\tif (!empty(retorno.error)) {\n\t\t\talert(\"Ocorreu um erro ao buscar dispositivos\\n\"+\n\t\t\t\t \"Erro: \" + retorno.mensagem);\n\t\t return; //IMPEDE QUE CONTINUE EXECUTANDO O CODIGO EM CASO DE ERRO\n\t\t}\n\t});\t\n\n}", "function solicitar_archivos_thumnail(idFalla){\n // Se modifica el estado del thumnail durante la carga\n $(\"#imagenThumb\").attr(\"src\",\"app/views/res/generandoArchivos.svg\");\n window.nameSpaceCgi.transformarNubePtos(idFalla);\n }", "function salvarOrdenVersion(){\n var dataIds = $(\"#sortable\").sortable(\"toArray\");\n \n var url ='versiones.php';\n var arrParams = [];\n arrParams[0] = {\"name\":\"arrIdsVersiones\", \"val\":dataIds.join()};\n arrParams[1] = {\"name\":\"ordenVersiones\", \"val\":1};\n postDinamico(url, arrParams);\n}", "function ativarCliqueFecharArquivo() {\n\t\n\t$('.esconder-arquivo').click(function(){\n\n\t\t$('.visualizar-arquivo').fadeOut();\n\n\t\tvar arq_nome = $('.arquivo_nome_deletar').val();\n\n\t\t//$('.visualizar-arquivo').html(' ');\n\n\t\t//ajax\n\t\tvar url\t\t= '/deletararquivo',\n\t\t\ttype\t= 'POST',\n\t\t\tdata\t= {'arquivo': arq_nome}\n\t\t;\n\t\t\n\t\texecAjax1(type, url, data);\n\t});\n}", "function archiveData() {\n // var project_id = $('#' + prefix + 'project_name').val().split(\",\")[0];\n if(project_id == -1) {\n alert('Please select a project to archive');\n return;\n }\n\n var post_data = new FormData();\n post_data.append('project_id', project_id);\n $.ajax({\n url: 'https://wmsinh.org/data-story',\n data: post_data,\n processData: false,\n contentType: false,\n type: 'POST',\n success: function(data){\n alert(data);\n closeForm();\n }\n });\n }", "function ejecutarFiltro() {\n miFiltro = $(\"#id_estado\").val();\n var miUrl = miServidor + 'mascotaByStatus/' + miFiltro;\n cargarDatos(miUrl, true);\n}", "function buscar_proyecto_detalle(nombre) {\n var url = 'http://'+domain+'/Electricity/public/proyecto',\n $data = {nombre: nombre, tipo_busqueda: 'actualizar_proyecto'}; \n ajaxConsultar(url, $data, resultBusqueda);\n }", "function solucionarReferenciasArchivos() {\n\n //solo se ejecuta si la vista es de arbol\n if (_tipo_vista == \"tree\") {\n var res = \"\";\n $(\"a[href^='javascript:mostrarDialogoOpcionesArchivo']\").each(function () {\n\n var attributo_todo = $(this).attr(\"href\");\n var atributos = attributo_todo.split(\"|\");\n var nomfunc_js = atributos[0]; //nombre de la funcion\n var elem_id = atributos[1]; //id del elemento definido por un contador\n var arg1_js = atributos[2]; //ruta web relativa y nombre de archivo\n var arg2_js = atributos[3]; //nombre de archivo\n var fecha = atributos[4]; //fecha\n\n //si con tiene un icono de imagen\n if ($(this).find(\"img\").length > 0) {\n arg1_js = arg1_js.replace(/'/g, \"\\\\'\");\n\n var funcion_js = nomfunc_js + \"(\" + elem_id + \",'\" + arg1_js + \"','\" + arg2_js + \"')\";\n\n //agregamos un atributo con un valor. En este caso un segundo id\n $(this).attr(\"nid\", elem_id);\n\n $(this).attr(\"fecha\", fecha);\n\n //agregamos el link de la referencia\n $(this).attr(\"href\", funcion_js);\n }\n else {\n var ref = \"../Protegido/Contenedor\" + arg1_js;\n $(this).attr(\"href\", ref + _no_cache);\n $(this).attr(\"target\", \"_blank\");\n }\n\n });\n } //end if\n}", "function GuardarArchivoFirma(firma){\n\t\tvar mensaje=\"Procesando la información<br>Espere por favor\";\n\t\tjsShowWindowLoad(mensaje);\n\t\tvar ubicacion = \"anexos/firmas/\"; \n\t\tvar firma = firma;\t\n\t\t//var tercero = $(\"#txtTercero\").val();\t\n var archivos = document.getElementById(\"txtexaminararchivosFirma\");\n var archivo = archivos.files;\n if (typeof archivo[0] !== \"undefined\") {\n if (archivo[0].type == \"image/png\") {\n var data = new FormData();\n data.append('vid', archivo[0]);\n $.ajax({\n type: 'POST',\n url: \"../../controlador/fachada.php?clase=clsArchivo&oper=GuardarFirma&ubicacion=\"+ubicacion+\"&firma=\"+firma,\n data: data, //Le pasamos el objeto que creamos con los archivos\n contentType: false, //Debe estar en false para que pase el objeto sin procesar\n processData: false, //debe estar en false para que JQuery no procese los datos a enviar\n cache: false //Para que el formulario no guarde cache\n }).done(function(data) { \n \tif(data == \"A\"){\n\t \tjsRemoveWindowLoad();\n \t\tmostrarPopUpError(\"Archivo guardado satisfactoriamente\");\n\t }else{\n\t \tjsRemoveWindowLoad();\n \t\tmostrarPopUpConfirmacion(\"Error al guardar archivo\");\n\t }\n });\n } else {\n \tjsRemoveWindowLoad();\n mostrarPopUpConfirmacion('El formato de la imagen es incorrecto, debe ser PNG');\n }\n }else{\n \tjsRemoveWindowLoad();\n mostrarPopUpConfirmacion('Debe seleccionar un archivo para subir');\n }\n\t}", "function getArchive() {\n //buscar las tareas guardadas\n let todos = getLocalDataArchive();\n //iterar entre todos los elementos\n todos.forEach(function(todo) {\n createNewTodo(todo);\n\n });\n}", "function mostraAlunos() {\n\t\t\t\tstr = document.querySelector(\"#entradaNomeID\").value + document.querySelector(\"#entradaCPFID\").value;\n\t\t\t\tif(document.querySelector(\"#entradaNomeID\"))\n\t\t\t\tvar xmlhttp = new XMLHttpRequest();\n\t\t\t\txmlhttp.onreadystatechange = function() {\n\t\t\t\t\tif (this.readyState == 4 && this.status == 200) {\n\t\t\t\t\t\tdocument.querySelector(\"#tabela\").innerHTML = this.responseText;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\txmlhttp.open(\"GET\", \"PHJL-WEB-Procura-alunos.php?q=\" + str + \"&tipo=\" + tipoInput + \"&valorfiltro=\" + valorFiltro + \"&tipofiltro=\" + tipoFiltro, true);\n\t\t\t\txmlhttp.send();\n\t\t\t}", "function getlistaArchivos (memId){\n var datax = {\"Accion\":\"listar\",\n \"memoid\": memId\n };\n $.ajax({\n data: datax, \n type: \"GET\",\n dataType: \"json\", \n url: \"controllers/controllermemoarchivo.php\", \n })\n .done(function( data, textStatus, jqXHR ) {\n /*if ( console && console.log ) {\n console.log( \" data success getlistaArchivos : \"+ data.success \n + \" \\n data msg deptos : \"+ data.message \n + \" \\n textStatus : \" + textStatus\n + \" \\n jqXHR.status : \" + jqXHR.status );\n }*/\n var totalanexos=data.datos.length;\n $(\"#totalArch\").html(totalanexos);\n //Lista archivos del memo\n console.log('Total Archivos ' + data.datos.length);\n $(\"#verarchivoMemo\").html(\"\");\n $(\"#verlistaArchivosMemo\").html(\"\");\n\n for(var i=0; i<data.datos.length;i++){\n //console.log('id archivo : ' + data.datos[i].memoarch_id + ' Nombre archvo: ' + data.datos[i].memoarch_name);\n if(data.datos[i].memoarch_flag == 1){\n $(\"#msgarchivomemo\").show();\n fila2 = '<tr><td><a href=\"'+data.datos[i].memoarch_url+'\" target=\"_blank\">'+ data.datos[i].memoarch_name + '</a></td>';\n fila2 += '<td>' + returnFileSize(data.datos[i].memoarch_size)+'</td>';\n fila2 += '</tr>';\n $(\"#verarchivoMemo\").append(fila2);\n }else{\n fila3 = '<tr><td><a href=\"'+data.datos[i].memoarch_url+'\" target=\"_blank\">'+ data.datos[i].memoarch_name + '</a></td>';\n fila3 += '<td>' + returnFileSize(data.datos[i].memoarch_size) + '</td>';\n fila3 += '</tr>';\n $(\"#verlistaArchivosMemo\").append(fila3);\n }\n }\n })\n .fail(function( jqXHR, textStatus, errorThrown ) {\n if ( console && console.log ) {\n console.log( \" La solicitud getlistaarchivos ha fallado, textStatus : \" + textStatus \n + \" \\n errorThrown : \"+ errorThrown\n + \" \\n textStatus : \" + textStatus\n + \" \\n jqXHR.status : \" + jqXHR.status );\n }\n });\n }", "function mostrarInfoDeArchivos(archivos) {\n var archivosPermitidos = formatosAceptados();\n var listaInfoDeArchivos = document.getElementById('listaArchivos');\n for (var i = 0; i < archivos.length; i++) {\n var archivo = archivos[i];\n var extension = getExt(archivo.name);\n if(archivosPermitidos.includes(extension)) {\n var nuevoRecuadroInfoArchivo = generarBox2(archivo,extension);\n listaInfoDeArchivos.appendChild(nuevoRecuadroInfoArchivo);\n }\n else alert('El archivo '+archivo.name+' no es de un formato permitido');\n }\n}", "mostrar_urls(carpeta,detener,permiso)\n {\n // $(\"#template-upload\").html(this.script_add_jsFileUpload);\n // $(\"#template-download\").html(this.script_upload_jsFileUpload);\n\n // _limite_upload_activado_jsUpload = true;\n // let tempDocumentolistadoUrl = \"\";\n let URL = this.url+\"/\"+carpeta;\n $(this.tabla_archivos).html(\"\");\n $(this.seccion_carga).html(\"\");\n $(this.btn_carga).css(\"display\",\"none\");\n $(this.btn_carga)[0][\"onclick\"] = ()=>{this.subir_Archivo(carpeta);};\n let temp_data = 'URL='+this.url+\"/\"+carpeta;\n if(!this.contrato)\n temp_data += \"&SIN_CONTRATO\";\n $.ajax({\n url: '../Controller/ArchivoUploadController.php?Op=listarUrls',\n type: 'GET',\n data: temp_data,\n success:(todo)=>\n {\n if(todo[0].length!=0)\n {\n let obj = $(\"<table>\",{\"style\":'min-width:100%;max-width:100%'});\n let obj2 = $(\"<tr>\").html(\"<th class='table-header'>\"+this.title_date+\"</th><th class='table-header'>Nombre</th><th class='table-header'></th>\");\n let obj3 = $(\"<tbody>\");\n $(obj).html(obj2);\n $(obj).append(obj3);\n // tempDocumentolistadoUrl = \"<table class='tbl-qa'><tr><th class='table-header'>\"+this.titulo_fecha+\"</th><th class='table-header'>Nombre</th><th class='table-header'></th></tr><tbody>\";\n $.each(todo[0],(index,value)=>\n {\n // this.getFilesInfo(value,index,todo[1]);\n let nametmp = value.split(\"^-O-^-M-^-G-^\");\n let name = nametmp[1];\n let fecha = getFechaStamp(nametmp[0]);\n\n let fila = $(\"<tr>\",{\"class\":'table-row'}).append(\"<td>\"+fecha+\"</td>\");\n $(fila).append(\"<td><a download='\"+name+\"' href=\\\"\"+todo[1]+\"/\"+value+\"\\\" target='blank'>\"+name+\"</a></td>\");\n\n // ><td>\"+fecha+\"</td><td>}\";)\n // let nombre = $(\"<a>\",{\"download\":name,\"href\":todo[1]+\"/\"+value,\"target\":'blank'}).append(name);\n // tempDocumentolistadoUrl += \"<tr class='table-row'><td>\"+fecha+\"</td><td>\";\n // tempDocumentolistadoUrl += \"<a download='\"+name+\"' href=\\\"\"+todo[1]+\"/\"+value+\"\\\" target='blank'>\"+name+\"</a></td><td>\";\n if(permiso==1)\n {\n let btn = $(\"<button>\",{\"style\":\"font-size:x-large;color:#39c;background:transparent;border:none;\"}).append(\"<i class=\\\"fa fa-trash\\\"></i>\");\n btn[0][\"onclick\"] = ()=>{this.borrarArchivo(URL+\"/\"+value,carpeta)};\n $(fila).append($(\"<tb>\").append(btn));\n // tempDocumentolistadoUrl += \"<button style=\\\"font-size:x-large;color:#39c;background:transparent;border:none;\\\"\";\n // tempDocumentolistadoUrl += \"onclick='\"+()=>{this.borrarArchivo(\"\\\"\"+URL+\"/\"+value+\"\\\"\")};+\"'>\";\n // tempDocumentolistadoUrl += \"<i class=\\\"fa fa-trash\\\"></i></button>\";\n }\n $(obj3).append(fila);\n // tempDocumentolistadoUrl += \"</td></tr>\";\n });\n $(this.tabla_archivos).append(obj);\n // tempDocumentolistadoUrl += \"</tbody></table>\";\n }else\n $(this.tabla_archivos).append(\"No hay archivos agregados\");\n if(detener==1)\n {\n $(this.seccion_carga).html(this.modal_upload_file);\n $(this.btn_carga).css(\"display\",\"\");\n // let valor = this.limite_upload_activado?\n $('#fileupload').fileupload({\n url: '../View/',\n carpeta:carpeta,\n limite_upload_activado: this.limite_upload_activado,\n archivos_tam:1,\n fn_after_upload:(detener_temp)=>{this.mostrar_urls(carpeta,detener_temp,permiso)},\n fn_after_upload_user:()=>{this.after_upload({\"id\":carpeta});}\n });\n // }\n }\n // }\n // else\n // {\n // $('#DocumentolistadoUrlModal').html(\"\");\n // }\n // tempDocumentolistadoUrl = tempDocumentolistadoUrl + \"<br><input id='tempInputIdEvidenciaDocumento' type='text' style='display:none;' value='\"+id_evidencia+\"'>\"\n // tempDocumentolistadoUrl = tempDocumentolistadoUrl + \"<br><input id='tempInputIdParaDocumento' type='text' style='display:none;' value='\"+id_para+\"'>\";\n // console.log(tempDocumentolistadoUrl);\n // $(this.tabla_archivos).html(tempDocumentolistadoUrl);\n // $(\"#subirArchivos\").removeAttr(\"disabled\");\n $(this.objModal).modal();\n }\n });\n }", "function getArchiveList(apiurl) {\r\n\treturn $.ajax({\r\n\t\turl: apiurl,\r\n\t\theaders: getAuthHeader(),\r\n\t\tdataType:DEFAULT_DATATYPE\r\n\t}).always(function(){\r\n\r\n\t\t//Remove old list of arcchives, clear the form data hide the content information(no selected)\r\n\t\t$(\"#main-content\").hide();\r\n\t\t$(\"#form-content\").empty().hide();\r\n\r\n\t}).done(function (data, textStatus, jqXHR){\r\n\t\tif (DEBUG) {\r\n\t\t\tconsole.log (\"RECEIVED RESPONSE: data:\",data,\"; textStatus:\",textStatus)\r\n\t\t}\r\n\t\t//Extract the archives\r\n \tarchives = data.collection.items;\r\n\t\tfor (var i=0; i < archives.length; i++){\r\n\t\t\tvar archive = archives[i];\r\n\t\t\tvar archive_data = archive.data;\r\n\r\n\t\t\tfor (var j=0; j<archive_data.length;j++){\r\n\t\t\t\tif (archive_data[j].name==\"archiveId\"){\r\n\t\t\t\t\tarchive_id = archive_data[j].value;\r\n\t\t\t\t}\r\n\t\t\t\tif (archive_data[j].name==\"name\"){\r\n\t\t\t\t\tarchive_name = archive_data[j].value;\r\n\t\t\t\t}\r\n\t\t\t\tif (archive_data[j].name==\"organisationName\"){\r\n\t\t\t\t\tarchive_organsation = archive_data[j].value;\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t\t// Move extracted data to archive list\r\n\t\t\tappendArchiveToList(archive.href, archive_id, archive_name, archive_organsation);\r\n\t\t}\r\n\r\n\t\t// Show New archive-button\r\n\t\t$(\"#list-body\").append(makeButton(\"New archive\", apiurl, handleAddArchive));\r\n\r\n var edit_url = data.collection.href;\r\n var template = data.collection.template;\r\n\r\n // Show form for editing archive\r\n $form = createFormFromTemplate(edit_url, \"archive-form\", \"Save\", handleSaveNewArchive, template)\r\n\r\n // Add the form to DOM\r\n $(\"#form-content\").append($form);\r\n $(\"#form-content\").append(makeButton(\"Cancel\", apiurl, returnToPreviousView));\r\n displayMessage();\r\n\r\n\t}).fail(function (jqXHR, textStatus, errorThrown){\r\n\t\tif (DEBUG) {\r\n\t\t\tconsole.log (\"RECEIVED ERROR: textStatus:\",textStatus, \";error:\",errorThrown)\r\n\t\t}\r\n\t\t//Inform user about the error using an alert message.\r\n\t\talert (\"Could not fetch the list of archives. Please, try again\");\r\n\t});\r\n}", "function archivosusuario(id_expediente)\n{\n\t$.post('includes/archivos_user.php',{id_expediente:id_expediente},function(data){ $(\"#contenedor\").html(data); });\n}", "function comando(tipo){\n\t\t$.ajax({\n\t\t\turl: window.location.href+'comando/'+tipo,\n\t\t\t\tsuccess: function (e) {\n\t\t\t\t var resp = JSON.parse(e);\n\t\t\t\t $('.command').html(resp['resposta'])\n\t\t\t\t},\n\t\t\t\terror: function (e) {\n\t\t\t\t\talert(e)\n\t\t\t\t},\n\t\t\ttype: 'POST',\n\t\t\tcache: false,\n\t\t\tcontentType: false,\n\t\t\tprocessData: false\n\t\t});\n\t}", "function generaArchivoSQLRemitosActas( actas ){\n\n var archivo = devolverArrayElem(actas.lst_archivos, 'SCRIPT_SQL_REMITOS');\n\n if(archivo.imprime){\n\n //server_config.metodo = 'fs/generaArchivoRemitosActas';\n //var consulta = (server_config.host+server_config.puerto+server_config.api+server_config.metodo) ;\n const consulta = 'asd';\n /*\n basedatosservice\n .crudCreate( actas, consulta )\n .then(\n function procesarRespuesta( resData ){\n actas.results.push(resData);\n }\n );\n */\n }\n\n return ( $q.when(actas) );\n \n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
lookup module object from require()d command and derive name if module was not require()d and no name given, throw error
function moduleName (obj) { const mod = __webpack_require__(592)(obj) if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`) return commandFromFilename(mod.filename) }
[ "function moduleName (obj) {\n const mod = __webpack_require__(147)(obj)\n if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = __webpack_require__(665963)(obj)\n if (!mod) throw new Error('No command name given for module: ' + inspect(obj))\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = __webpack_require__(162)(obj)\n if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = __webpack_require__(/*! which-module */ \"./node_modules/which-module/index.js\")(obj)\n if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = __webpack_require__(568)(obj)\n if (!mod) throw new Error(`No command name given for module: ${inspect(obj)}`)\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\n const mod = require('which-module')(obj)\n if (!mod) throw new Error('No command name given for module: ' + inspect(obj))\n return commandFromFilename(mod.filename)\n }", "function moduleName (obj) {\r\n const mod = require('which-module')(obj)\r\n if (!mod) throw new Error('No command name given for module: ' + inspect(obj))\r\n return commandFromFilename(mod.filename)\r\n }", "function get_command(command_name){\n for(var module in command_dict)\n if(command_dict[module][command_name] != null) return {c:command_dict[module][command_name], m:module}\n return null;\n}", "function getModuleNameOfNode(context, node) {\n if (node.type === 'Identifier') {\n return getModuleNameOfIdentifier(context, node);\n }\n else {\n return getModuleNameFromRequire(node);\n }\n}", "function getModuleNameFromCallArgs(type, node, path) {\n if (node.arguments.length !== 1) {\n throw invalidRequireOf(type, node);\n }\n\n const nameExpression = node.arguments[0];\n\n // Try to evaluate the first argument of the require() statement.\n // If it can be statically evaluated, resolve it.\n const result = path.get('arguments.0').evaluate();\n if (result.confident && typeof result.value === 'string') {\n return [nameExpression, result.value];\n }\n return [nameExpression, null];\n}", "function findNormalizedModuleNameAsync(obj) {\n return __awaiter(this, void 0, void 0, function* () {\n // First, check the built-in modules\n const modules = yield getBuiltInModules();\n const key = modules.get(obj);\n if (key) {\n return key;\n }\n // Next, check the Node module require cache, which will store cached values\n // of all non-built-in Node modules loaded by the program so far. _Note_: We\n // don't pre-compute this because the require cache will get populated\n // dynamically during execution.\n for (const path of Object.keys(require.cache)) {\n if (require.cache[path].exports === obj) {\n // Rewrite the path to be a local module reference relative to the current working\n // directory.\n const modPath = upath.relative(process.cwd(), path);\n return \"./\" + modPath;\n }\n }\n // Else, return that no global name is available for this object.\n return undefined;\n });\n}", "function getModuleByCommand(modules, name) {\n\t\t\tfor(var i = 0; i < modules.length; i++) {\n\t\t\t\tif(modules[i].name == name)\n\t\t\t\t\treturn modules[i];\n\t\t\t}\n\t\t}", "static get(name) {\n const module = getModuleHandle(name);\n if (module.isNull())\n throw Error(name + ': Cannot find module');\n module.name = name || '[exe]';\n return module;\n }", "findCommand(name) {\n return this.modules.get(this.aliases.get(name.toLowerCase()));\n }", "function findModuleFromOptions(host, options) {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n if (!options.module) {\n var pathToCheck = (options.path || '') +\n (options.flat ? '' : '/' + core_1.strings.dasherize(options.name));\n return (0, core_1.normalize)(findModule(host, pathToCheck));\n }\n else {\n var modulePath = (0, core_1.normalize)('/' + options.path + '/' + options.module);\n var moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();\n if (host.exists(modulePath)) {\n return (0, core_1.normalize)(modulePath);\n }\n else if (host.exists(modulePath + '.ts')) {\n return (0, core_1.normalize)(modulePath + '.ts');\n }\n else if (host.exists(modulePath + '.module.ts')) {\n return (0, core_1.normalize)(modulePath + '.module.ts');\n }\n else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '.module.ts');\n }\n else {\n throw new Error(\"Specified module path \".concat(modulePath, \" does not exist\"));\n }\n }\n}", "function extractRequireModule(call, env) {\n\t\tif (!env.indexer) {\n\t\t\treturn;\n\t\t}\n\t\tif (call.type === \"CallExpression\" && call.callee.type === \"Identifier\" &&\n\t\t\tcall.callee.name === \"require\" && call[\"arguments\"].length === 1) {\n\n\t\t\tvar arg = call[\"arguments\"][0];\n\t\t\tif (arg.type === \"Literal\" && typeof arg.value === \"string\") {\n\t\t\t\t// we're in business\n\t\t\t\tvar summary = env.indexer.retrieveSummary(arg.value);\n\t\t\t\tif (summary) {\n\t\t\t\t\tvar typeName;\n\t\t\t\t\tvar mergeTypeName;\n\t\t\t\t\tif (typeof summary.provided === \"string\") {\n\t\t\t\t\t\tmergeTypeName = typeName = summary.provided;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// module provides a composite type\n\t\t\t\t\t\t// must create a type to add the summary to\n\t\t\t\t\t\tmergeTypeName = typeName = env.newScope();\n\t\t\t\t\t\tenv.popScope();\n\t\t\t\t\t}\n\t\t\t\t\tenv.mergeSummary(summary, mergeTypeName);\n\t\t\t\t\treturn typeName;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn;\n\t}", "function get_import_module_name( arg_index )\n{\n\treturn process.reserved.hostDependBindings.ida_get_import_module_name( arg_index );\n}", "function getModuleByName(moduleName){\n var deferred= Q.defer();\n moduleName = moduleName.toLowerCase();\n\n db.modules.findOne({name: moduleName}, function(err, aModule){\n if(err){\n deferred.reject(err);\n }\n else{\n deferred.resolve(aModule);\n }\n });\n\n return deferred.promise;\n}", "function loadModule(name) {\n if (moduleFns[name]) {\n var m = { exports: {} };\n modules[name] = m;\n\n console.log('load module', name);\n moduleFns[name](require, m.exports, m);\n\n return modules[name].exports;\n }\n\n throw 'module does not exists: ' + name;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Open delete group confirmation popup
deleteGroupClick() { if (gridActionNotify(this.strings, this.props.notifyToaster, this.refs.groupGrid.selectedRows.length, true)) { // pass custom payload with popup let payload = { confirmText: this.strings.DELETE_CONFIRMATION_MESSAGE, strings: this.strings.CONFIRMATION_POPUP_COMPONENT, onConfirm: this.deleteGroup }; this.props.openConfirmPopup(payload); } }
[ "function deleteRowGroup(ev, groupName) {\r\n response = confirm('Are you sure you want to delete the group \"' + groupName + '\"?\\nThis cannot be undone.');\r\n if (response) {\r\n $('#deleteRowGroupForm').submit();\r\n }\r\n}", "function cancelDeleteGroup() {\r\n\thideDeleteGroupTooltip(mDeleteGroupTooltipTarget);\r\n}", "function deleteScenarioConfirmationPopup() {\n\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\")\n\t\t\t\t\t\t\t\t\t\t.on(\"show\",\n\t\t\t\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario a.btn\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.on(\"click\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfunction(e) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.modal('hide');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\").on(\n\t\t\t\t\t\t\t\t\t\t\"hide\",\n\t\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario a.btn\").off(\"click\");\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\").on(\"hidden\",\n\t\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\").remove();\n\t\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t$(\"#bulkDeleteScenario\").modal({\n\t\t\t\t\t\t\t\t\t\"backdrop\" : \"static\",\n\t\t\t\t\t\t\t\t\t\"keyboard\" : true,\n\t\t\t\t\t\t\t\t\t\"show\" : true\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t}", "clickOnConfirmDelete() {\n commonActions.confirmAlert();\n }", "function deleteGroup (group) {\n // Confirm that user wants to delete message if not return\n swal({\n title: 'Deleting Group',\n text: 'Are you sure you want to delete your Group?', \n icon: 'warning',\n buttons: ['Cancel', 'Yes'],\n dangerMode: true\n })\n .then(function (value) {\n if (value == null) { // Escape deletion \n return\n } else { // Proceed with deletion \n \n // Remove message from UI\n group.parentElement.removeChild(group);\n // Remove message from Initiative object \n let id = group.id.replace('group', ''); // remove ui tag from id \n //console.log(\"group object in delete:\", id)\n currentInitiative.groups.delete(id); \n // Send updates to main\n let ipcInit = currentInitiative.pack_for_ipc();\n ipc.send('save', currentInitiativeId, ipcInit); \n };\n });\n}", "function viewDelete(workroot, id, btn_delete_id)\n{\n var viewDeleteModal = '<div id=\"modal-box\" class=\"box-contain margin-zero-auto\"><span>Are you sure want to delete?</span></div><div class=\"row form-btn\"><span id=\"HideButtondelete\"><button class=\"btn-outline btn-delete cursor-pointer\" name=\"deleteContact\" id=\"'+btn_delete_id+'\" data-contact-id=\"'+id+'\" type=\"button\"><span>Delete</span></button></span><button class=\"btn-outline btn-cancel cursor-pointer\" name=\"cancel\" type=\"button\"><span>Cancel</span></button></div>';\n openStaticDialog(workroot, viewDeleteModal, 'Delete','',false);\n}", "function confirmDeletion(){\n vex.dialog.open({\n message: \"Comment Has Been Deleted\",\n buttons:[\n $.extend({},vex.dialog.buttons.Yes,{text: \"OK\"})\n ],\n callback: function (data) {\n $(location).attr(\"href\", \"/\"); \n }\n });\n }", "clickOnConfirmDelete() {\n commonActions.click(this.deleteConfirmButton);\n }", "function openDeleteModal() {\n ModalDeleteService.deleteItem(vm.activeDepartment, vm.deleteDepartment);\n }", "function confirmDeleteGroupUser() {\n if (mdg_GroupUserList_obj.getSelectedArray() != null && mdg_GroupUserList_obj.getSelectedArray() != \"\") {\n return confirm(\"确认要删除选定组用户?\")\n }\n else {\n alert(\"请先选中记录,再进行删除组用户操作!\");\n return false;\n }\n}", "function deletePaymentGroup() {\n Merchant.delete('payment_group', vm.delete_payment_group.id).then(function (response) {\n vm.payment_groups.splice(delete_payment_group_index, 1);\n $(\"#delete-payment_group-modal\").modal('hide');\n });\n }", "function openBatchDeleteModal() {\n var deleteObjects = []\n ctrl.checkBox.forEach(function(testcase, index){\n if(!ctrl.showError){\n if(testcase){\n deleteObjects.push(ctrl.data.testcases[index].name)\n }\n }\n });\n confirmModal(\"Delete\", 'testcases', ctrl.batchDelete, deleteObjects);\n }", "deleteGroup() {\n this.errorMsg = null;\n\n this.promptService.confirm('Are you sure that you want to delete the group? All symbols will be archived.')\n .then(() => {\n this.symbolGroupResource.remove(this.group)\n .then(() => {\n this.toastService.success(`Group <strong>${this.group.name}</strong> deleted`);\n this.eventBus.emit(events.GROUP_DELETED, {\n group: this.group\n });\n })\n .catch(err => {\n this.toastService.danger(`The group could not be deleted. ${err.data.message}`);\n });\n });\n }", "deleteContactClick() {\r\n if (gridActionNotify(this.strings, this.props.notifyToaster, this.refs.grid.refs.contactGrid.selectedRows.length, true)) {\r\n // pass custom payload with popup\r\n let payload = {\r\n confirmText: this.strings.DELETE_CONFIRMATION_MESSAGE,\r\n strings: this.strings.CONFIRMATION_POPUP_COMPONENT,\r\n onConfirm: this.refs.grid.deleteContact\r\n };\r\n this.props.openConfirmPopup(payload);\r\n }\r\n }", "function confirmDeleteEmail() {\n Merchant.delete('delete_admin_email',delete_admin_email.id).then(function(response) {\n vm.admin_emails.splice(delete_admin_email_indx, 1);\n $(\"#delete-adm-email-modal\").modal('toggle');\n });\n }", "deleteRegionClick() {\r\n if (gridActionNotify(this.strings, this.props.notifyToaster, this.refs.regionGrid.selectedRows.length, true)) {\r\n // pass custom payload with popup\r\n let payload = {\r\n confirmText: this.strings.DELETE_CONFIRMATION_MESSAGE,\r\n strings: this.strings.CONFIRMATION_POPUP_COMPONENT,\r\n onConfirm: this.deleteRegion\r\n };\r\n this.props.openConfirmPopup(payload);\r\n }\r\n }", "registerDeleteConfirmation() {\n this.ActionHelpers.confirmAction('a.delete-button', 'Do you really want to delete this?');\n }", "function okModal() {\r\n\t\t\t// execute deletion\r\n\t\t\tvm.del();\r\n\t\t\t// close confirm modal\r\n\t\t\tvm.confirmModal.close();\r\n\t\t}", "showDeleteFileConfirm() {\n $('#deleteFilePermissionConfirm').modal('show');\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Utility functions Helper function to check the test condition and then write the string into the node with the specified id Disable node if
function writeDescription(test, id, str) { var node = document.getElementById(id); node.innerHTML = test ? str : "N/A"; }
[ "function disable (node) {\n node.disabled = true;\n}", "function disableTargetIf(condition, targetName) {\n findElementsByName(targetName)[0].disabled=condition;\n}", "async seeDisabledAttribute (xpath) {\n const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']\n let res = await helper.grabAttributeFrom(xpath, 'disabled')\n return assert.ok(res !== null && res.toString().toLowerCase() === 'true', \"\\x1b[31mexpected element '\\x1b[91m\" + xpath + \"\\x1b[31m' to be disabled\")\n }", "function disable(id)\r\n{\r\n\tid.disabled = 'false';\r\n\treturn true;\r\n}", "TextNode(node) {\n let source = this.sourceForNode(node);\n let disallowedText = 'DisallowedText';\n let failingCondition = source.includes(disallowedText);\n if (failingCondition) {\n this.log({\n message: ERROR_MESSAGE,\n node,\n });\n }\n }", "function setDisabled(id)\n{\n gebi(id).disabled = true;\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", \"checkcount.php\", false);\n xhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n var param = \"course=\" + id;\n xhr.send(param);\n var response = xhr.responseText;\n\n if (response == \"ready\")\n {\n gebi(id).disabled = false;\n }\n}", "async dontSeeDisabledAttribute (xpath) {\n const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']\n let res = await helper.grabAttributeFrom(xpath, 'disabled')\n return assert.ok(!(res !== null && res.toString().toLowerCase() === 'true'), \"\\x1b[31mexpected element '\\x1b[91m\" + xpath + \"\\x1b[31m' NOT to be disabled\")\n }", "function enableElement(id) {\n document.getElementById(id).disabled = false;\n}", "function disableOperator(ID) {\n //Disable all operators\n if(!ID){\n var success = operator.disableAll();\n if (success)\n console.log(\"All mutation operators disabled.\");\n else\n console.log(\"Error\");\n }else{\n //Disable operator ID\n var success = operator.disable(ID);\n if (success)\n console.log(ID + \" disabled.\");\n else\n console.log(ID + \" does not exist.\");\n }\n}", "function condChange(nodeId)\n{\n\tvar condNode = document.getElementById('t'+nodeId);\n\tif (condNode.type == \"hidden\")\n\t\tcondNode.type = \"text\";\n\telse\n\t\tcondNode.type = \"hidden\";\n\t\t\n}", "function checkReportExists(testId, testName) {\n TestService.pdfExists(testId).then(function (response) {\n switch (response.data) {\n case \"true\":\n document.getElementById(testName).disabled = false;\n break;\n case \"false\":\n document.getElementById(testName).disabled = true;\n break;\n }\n });\n }", "function enable(id)\r\n{\r\n\tid.disabled = '';\r\n\treturn true;\r\n}", "function disableElement(id, value) {\r\n\tvar el = document.getElementById(id);\r\n\tif (el) {\r\n\t\tel.setAttribute(\"disabled\", value);\r\n\t}\r\n}", "function controlDisable(controlName) {\n\n if (document.querySelector('.jester__system__select').value == 'User traits') {\n\n if (controlName != 'userLevel' && document.getElementById('userLevel').value == 'Nomad') {\n document.getElementById(controlName).disabled = true;\n }\n else if (traits[controlName].tied_to_customer == true && document.getElementById('userLevel').value == 'Customer') {\n document.getElementById(controlName).disabled = false;\n }\n else if (traits[controlName].tied_to_customer == true && document.getElementById('userLevel').value != 'Customer') {\n document.getElementById(controlName).disabled = true;\n }\n else {\n document.getElementById(controlName).disabled = false;\n }\n }\n}", "function DisableElementById(strId)\n\t{\t\t\n\t\t// show the element\n\t\tdocument.getElementById(strId).disabled = true;\n\t}", "function disable(id, disable) {\r\n\r\n var node = document.getElementById(id);\r\n\r\n var version = getXeroxWidgetVersion();\r\n\r\n var action = \"Addition\";\r\n\r\n var val = \"unselectable\";\r\n\r\n if ((disable == undefined) || disable) {\r\n if (version == \"Xerox Widgets Rev 1\") {\r\n node.setAttribute('disabled', \"true\");\r\n val = \"disabled\";\r\n }\r\n else {\r\n node.setAttribute('unselectable', \"true\");\r\n }\r\n }\r\n else {\r\n if (node.hasAttribute('disabled')) {\r\n node.removeAttribute('disabled');\r\n val = \"disabled\";\r\n }\r\n else {\r\n if (node.hasAttribute('unselectable'))\r\n node.removeAttribute('unselectable');\r\n }\r\n action = \"Removal\";\r\n }\r\n xrxSendDomAttrModifiedEvent(node, false, false, val, null, null, action, true);\r\n}", "function disable(id, disable) {\n\n var node = document.getElementById(id);\n\n var version = getXeroxWidgetVersion();\n\n var action = \"Addition\";\n\n var val = \"unselectable\";\n\n if ((disable == undefined) || disable) {\n if (version == \"Xerox Widgets Rev 1\") {\n node.setAttribute('disabled', \"true\");\n val = \"disabled\";\n }\n else {\n node.setAttribute('unselectable', \"true\");\n }\n }\n else {\n if (node.hasAttribute('disabled')) {\n node.removeAttribute('disabled');\n val = \"disabled\";\n }\n else {\n if (node.hasAttribute('unselectable'))\n node.removeAttribute('unselectable');\n }\n action = \"Removal\";\n }\n xrxSendDomAttrModifiedEvent(node, false, false, val, null, null, action, true);\n}", "async dontSeeDisabledAttribute (xpath) {\n const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']\n return await helper.waitForInvisible(xpath + ':disabled')\n }", "function disableCreateIfEmptyId() {\n $('input#create').prop('disabled', !(/.+/.test($('#id').val())));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new analyser
function Analyser(scene) { /** * Gets or sets the smoothing * @ignorenaming */ this.SMOOTHING = 0.75; /** * Gets or sets the FFT table size * @ignorenaming */ this.FFT_SIZE = 512; /** * Gets or sets the bar graph amplitude * @ignorenaming */ this.BARGRAPHAMPLITUDE = 256; /** * Gets or sets the position of the debug canvas * @ignorenaming */ this.DEBUGCANVASPOS = { x: 20, y: 20 }; /** * Gets or sets the debug canvas size * @ignorenaming */ this.DEBUGCANVASSIZE = { width: 320, height: 200 }; this._scene = scene; this._audioEngine = Engine.audioEngine; if (this._audioEngine.canUseWebAudio && this._audioEngine.audioContext) { this._webAudioAnalyser = this._audioEngine.audioContext.createAnalyser(); this._webAudioAnalyser.minDecibels = -140; this._webAudioAnalyser.maxDecibels = 0; this._byteFreqs = new Uint8Array(this._webAudioAnalyser.frequencyBinCount); this._byteTime = new Uint8Array(this._webAudioAnalyser.frequencyBinCount); this._floatFreqs = new Float32Array(this._webAudioAnalyser.frequencyBinCount); } }
[ "function createAnalyser() {\n //create analyser node\n analyzer = context.createAnalyser();\n\n analyzer.smoothingTimeConstant = 0.3;\n //set size of how many bits we analyse on\n analyzer.fftSize = 2048;\n}", "function createAnalyser() {\n //create analyser node\n analyzer = context.createAnalyser();\n\n analyzer.smoothingTimeConstant = 0.3;\n //set size of how many bits we analyse on\n analyzer.fftSize = 2048;\n}", "createAnalyserNode() {\n const analysisNode = this.audioContext.createAnalyser();\n\n analysisNode.smoothingTimeConstant = SMOOTHING;\n analysisNode.fftSize = FFT_SIZE;\n\n // Ensure channel is still audible\n analysisNode.connect(this.audioContext.destination);\n\n return analysisNode;\n }", "_createAnalyserNode() {\n return new AnalyserNode(this.audio_ctx, {\n fftSize: this.dataSize*2,\n maxDecibels: -25,\n minDecibels: -60,\n smoothingTimeConstant: 0.5,\n })\n }", "function initAnalyser() {\r\n analyser = audioContext.createAnalyser();\r\n analyser.smoothingTimeConstant = 0.8;\r\n analyser.fftSize = 2048;\r\n}", "function initializeAudioAnalyser() {\n\n //create audio context and analyser\n context = _createContext();\n if(context === null)\n {\n return null;\n }\n var analyserNode = context.createAnalyser();\n analyserNode.fftSize = _settings.fftSize;\n analyserNode.smoothingTimeConstant = _settings.smoothing;\n\n //inject Audio element into DOM\n var audio = _injectAudio(),\n //bind analyser to audio source\n src = context.createMediaElementSource(audio);\n src.connect(analyserNode);\n analyserNode.connect(context.destination);\n\n return analyserNode;\n }", "function createAnalyserNode(audioSource) {\n audioSource.connect(analyserNode);\n}", "function createAnalyserNode(audioSource) {\n analyserNode = context.createAnalyser();\n analyserNode.fftSize = 256;\n audioSource.connect(analyserNode);\n}", "function getAnalyser() {\n return config.analyser;\n }", "function publicGetAnalyser(){\n\t\treturn config.analyser;\n\t}", "function getAnalyser() {\n return _config2.default.analyser;\n }", "connectAnalyser() {\n if (hasNoAudioAPI) return\n\n context.source.connect(context.analyser)\n window.analyser = config.analyser\n context.analyser.connect(audioContext.destination)\n context.analyser.fftSize = 1024\n context.analyser.smoothingTimeConstant = 0.89\n }", "function AudioAnalysisInitialize() {\n // Create audio context\n var audioContext = window.AudioContext || window.webkitAudioContext;\n var audioCtx = new AudioContext();\n\n // Set the audio player\n var audioSource = document.getElementById(\"audioSource\");\n audioSource.autoplay = true;\n audioSource.loop = true;\n\n // Create some necessary nodes\n var sourceNode = audioCtx.createMediaElementSource(audioSource);\n var gainNode = audioCtx.createGain();\n analyserNode = audioCtx.createAnalyser();\n analyserNode.fftSize = 512;\n analyserNode.minDecibels = -200;\n analyserNode.maxDecibels = 0;\n analyserNode.smoothingTimeConstant = 0.8;\n\n // Connect them\n sourceNode.connect(analyserNode);\n analyserNode.connect(gainNode);\n gainNode.connect(audioCtx.destination);\n}", "function setAnalyser () {\n analyser.minDecibels = -90\n analyser.maxDecibels = -10\n analyser.smoothingTimeConstant = 0.85\n }", "function init() {\n if (!context || !context.state || context.state == 'closed') {\n analyserView = new AnalyserView(\"view\");\n\n !context && window.requestAnimationFrame(draw); // Animation Reuqest\n\n context = new AudioContext();\n\n analyser = context.createAnalyser();\n analyser.fftSize = fftSize;\n }\n\n }", "startAnalyzing() {\n if (_.isNull(this._buffer)) {\n return;\n }\n\n let context = new OfflineAudioContext(2, this._buffer.length, SAMPLE_RATE);\n let source = context.createBufferSource();\n source.buffer = this._buffer;\n source.connect(context.destination);\n source.onended = e => {\n source.disconnect(context.destination);\n };\n source.start();\n\n context.startRendering().then(buffer => {\n let data = buffer.getChannelData(0);\n this._parseBeats(data);\n });\n }", "function getAnalysers(instruments) {\n const allAnalysers = {};\n\n for (let instrument = 0; instrument < Object.keys(instruments).length; instrument ++) {\n allAnalysers[instrument] = new Tone.Analyser(\"waveform\", 1024);\n instruments[instrument].fan(allAnalysers[instrument]);\n }\n\n analysers = allAnalysers;\n}", "function load_analyzer(name) {\n analyzers.push(require('../lib/analyzers/' + name));\n }", "constructor() { \n \n Analysis.initialize(this);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns a list of all enabled tasks relative to a given model
function getModelTasks(modelName) { var res = []; for(var id in instanceMap){ if(modelName == instanceMap[id].modelName){ for(var task of getInstanceTasks(id)) res.push(task); } } return res; }
[ "function getEnabled(modelName) {\n var res = new Set();\n for (var instanceId in instanceMap) {\n if (modelName == instanceMap[instanceId].modelName) {\n for (var taskId of instanceMap[instanceId].enabledSet) res.add(taskId);\n }\n }\n return res;\n }", "function getInstanceTasks(instanceId) {\n var instanceContext = getInstanceContext(instanceId);\n if (!instanceContext) return null;\n var model = ModelManager.getModel(instanceContext.modelName);\n if (!model) return null;\n var res = [];\n for (var id of instanceContext.enabledSet) {\n res.push(\n {\n 'instanceId': instanceId,\n 'activityId': id,\n 'modelName': instanceContext.modelName,\n 'activityName': model.activityMap[id].name,\n 'lane': model.activityMap[id].lane,\n }\n )\n }\n return res;\n }", "function getActiveTasks() {\n return Java.from(Variable.findByName(gameModel, \"tasks\").items).map(function(t) {\n return t.getInstance(self);\n }).filter(function(t) {\n return t.active;\n });\n }", "getAllTasks() {\n return taskList;\n }", "allTaskIdOffline () {\n const tasks = _.values(RealmObject.objects(TaskSchema.schema.name).filtered(\"offlineEnabled = \\\"TRUE\\\"\")),\n taskStartCase = _.values(RealmObject.objects(StartCaseSchema.schema.name).filtered(\"offlineEnabled = \\\"TRUE\\\"\"));\n return _.union(tasks.map(t => t.taskId), taskStartCase.map(t => t.taskId));\n }", "function getTaskLists() {\n\n}", "function getPageLevelProgressEnabledModels(models) {\n return _.filter(models, function(model) {\n if (model.get('_pageLevelProgress')) {\n return model.get('_pageLevelProgress')._isEnabled;\n }\n });\n }", "getMandatoryTasks() {\n let t = [];\n for (const task in this.default_tasks) {\n if (this.default_tasks[task].mandatory) {\n this.default_tasks[task].dependencies.forEach(dep => {\n if (t.indexOf(dep) === -1) t.push(dep);\n });\n t.push(task);\n }\n }\n return t;\n }", "getAllTask()\n {\n console.log(this.allTasks);\n }", "function executeTaskOnModelTree(model, task) {\n\n var taskResults = [];\n\n function _executeTaskOnModelTreeRec(dbId){\n\n instanceTree.enumNodeChildren(dbId,\n function(childId) {\n\n taskResults.push(task(model, childId));\n\n _executeTaskOnModelTreeRec(childId);\n });\n }\n\n //get model instance tree and root component\n var instanceTree = model.getData().instanceTree;\n\n var rootId = instanceTree.getRootId();\n\n _executeTaskOnModelTreeRec(rootId);\n\n return taskResults;\n }", "function getAllTasks() {\n return angular.copy(tasks);\n }", "static executeTaskOnModelTree(model, task) {\n\n var taskResults = [];\n\n function _executeTaskOnModelTreeRec(dbId){\n\n instanceTree.enumNodeChildren(dbId,\n function(childId) {\n\n taskResults.push(task(model, childId));\n\n _executeTaskOnModelTreeRec(childId);\n });\n }\n\n //get model instance tree and root component\n var instanceTree = model.getData().instanceTree;\n\n var rootId = instanceTree.getRootId();\n\n _executeTaskOnModelTreeRec(rootId);\n\n return taskResults;\n }", "opTasks() {\n var tasks = [];\n for (i = 0; i < this.operatorSettings.teams.length; i++) {\n if (this.operatorSettings.teams[i].tasks) {\n tasks.push(this.operatorSettings.teams[i].tasks);\n } else {\n tasks.push([]);\n }\n }\n return tasks;\n }", "function getAllTasks() {\n if (UserDbService.isAdmin()) {\n return angular.copy(tasks);\n }\n\n var user = UserDbService.getCurrentUser()\n\n var userTasks = tasks.filter(function (el) {\n if (el.ownerId == user.id) {\n return true\n }\n return false\n });\n\n return angular.copy(userTasks);\n }", "get all() {\n return this.tasks;\n }", "leadTask() {\n var task = [];\n\n for (i = 0; i < this.taskSettings.tasks.length; i++) {\n if (this.taskSettings.tasks[i].include)\n task.push(this.taskSettings.tasks[i].leadTask);\n }\n\n //console.log(\"leadTask:\", task);\n return task;\n }", "static async getTasks() {\n const URL = TASK_URL;\n return Fetcher.call(GET, `${URL}`);\n }", "function getSelectedTasks() {\n let taskTree = getTaskTree();\n return taskTree ? taskTree.selectedTasks : [];\n}", "essential() {\n var esst = [];\n for (i = 0; i < this.taskSettings.tasks.length; i++) {\n if (this.taskSettings.tasks[i].essential && this.taskSettings.tasks[i].include) {\n if (this.taskSettings.tasks[i].essential === \"y\") {\n esst.push(1);\n } else {\n esst.push(0);\n }\n }\n }\n return esst;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The https:// URL of this bucket.
get bucketUrl() { return this.urlForObject(); }
[ "getURL() {\n return Meteor.absoluteUrl(UploadFS.config.storesPath + '/' + this.name, {\n secure: UploadFS.config.https\n });\n }", "function getURL(){\r\n var dprefix;\r\n dprefix = (useSSL) ? \"https://\" : \"http://\";\r\n \r\n return dprefix + NEWSBLUR_DOMAIN;\r\n}", "getURL() {\n return Meteor.absoluteUrl(`${ UploadFS.config.storesPath }/${ this.name }`, {\n secure: UploadFS.config.https\n });\n }", "function getS3ObjectUrl(file) {\n return `https://${envs.bucketName}.s3.amazonaws.com/${file.path}`;\n}", "getUrl(location) {\n return `https://storage.googleapis.com/${this.$bucket.name}/${this._fullPath(location)}`;\n }", "get urlSuffix() {\n return new cfn_pseudo_1.ScopedAws(this).urlSuffix;\n }", "get urlSuffix() {\n return new pseudo_1.ScopedAws(this).urlSuffix;\n }", "function getUrl() {\n const ssl = (getSettings('doichain.ssl',false)==='true'); //default true!\n const port = getSettings('doichain.port',3010); //default on testnet dApp\n const host = getSettings('doichain.host','localhost');\n let protocol = \"https://\";\n if(!ssl) protocol = \"http://\";\n\n if(host!==undefined) return protocol+host+\":\"+port;\n return Meteor.absoluteUrl();\n}", "function toURL(key, bucket) {\n return \"https://s3-\" + REGION + \".amazonaws.com/\" + bucket + \"/\" + key\n}", "function getObjectUrl({\n cosInstance,\n bucket: Bucket,\n region: Region,\n key: Key,\n origin = \"\",\n}) {\n const url = cosInstance.getObjectUrl({\n Bucket,\n Region,\n Key,\n Sign: false,\n });\n const { protocol, host } = new URL(url);\n return url.replace(`${protocol}//${host}`, origin);\n}", "get url() {\n\t\tif (this.path != '')\n\t\t\treturn `${this.host}/${this.path}/${this.document}`;\n\t\telse\n\t\t\treturn `${this.host}/${this.document}`;\n\t}", "getUrl() {\n if (!this._url) {\n this._url = new URL(location + \"\");\n }\n\n return this._url;\n }", "get bucket() {\n return this._location.bucket;\n }", "function getUrl() {\n return url.format(this.urlObj);\n}", "getURL() { return this.url; }", "function getS3PreSignedUrl(s3ObjectKey) {\n\n const bucketName = process.env.S3_PERSISTENCE_BUCKET;\n \n const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', {\n Bucket: bucketName,\n Key: s3ObjectKey,\n Expires: 60*1 // the Expires is capped for 1 minute\n });\n\n console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`); // you can see those on CloudWatch\n\n return s3PreSignedUrl;\n}", "get url() {\n return artifactAttribute(this, 'URL');\n }", "getPublicPathUrl() {\n return `${this.getServerUrl()}${this.publicPath}`;\n }", "function getURLConnectionForHTTPS() {\n var url = '' + window.location;\n var ipAddress = url.split('/l');\n var nouvelleURL = ipAddress[0];\n \n return nouvelleURL;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
finding how many weeks are in a current month
function findWeeksInMonth () { var startingDay = 1; // setting a first day of the month var daysInStartingWeek = 7 - startingDay; // count days in the first week var daysLeft = daysInMonth - daysInStartingWeek; // substracting 1 week var weeksLeft = Math.floor(daysLeft/7); // count how many full weeks left in a month weeksLeft++; // 1 week added for the first week if(daysLeft%7 !== 0) { // if there is something left from the full weeks... numberOfWeeks = ++weeksLeft; // add 1 to weeks number and save it in a variable } else { // if there is nothing left but the full weeks... numberOfWeeks = weeksLeft; // save a result in a variable } }
[ "function getWeeksInMonth(newMonth)\n {\n var targetYear = newMonth.year;\n var targetMonth = newMonth.month + 1;\n \n if (newMonth.epoch == \"BC\")\n targetYear = -targetYear;\n \n var cal = getCalendarFromDate(targetYear, targetMonth, 1);\n \n var month1JD = cal.toJD(targetYear, targetMonth, 1);\n \n // offset is the length of daycells prior to the first day\n // of the selected month at the beginning of the calendar.\n var firstDayOfWeek = Number(preferences.values['firstDayOfWeek']);\n var weekday = Math.floor(month1JD + 1.5) % 7;\n var offset = (weekday - firstDayOfWeek) % 7;\n if (offset < 0)\n offset += 7;\n var startJD = month1JD - offset;\n \n var daysInMonth = getDaysInMonth(startJD, targetMonth);\n var weeksInMonth = Math.ceil(daysInMonth / 7);\n \n return weeksInMonth;\n }", "weekOfMonth(){\n return Math.ceil(this._date/7);\n }", "function getWeekNums(month) {\n let monthCopy = moment(month), first, last;\n first = monthCopy.startOf(\"month\").week();\n last = monthCopy.endOf(\"month\").week();\n if (first > last) last = 52 + last;\n return last - first + 1;\n}", "function calcWeeksInMonth(year, month) \n\t\t{\n \n\t\t\tvar daysInMonth = calcLastDayInMonth(year, month);\n var firstDow = calcDayOfWeek(year, month, 1);\n var lastDow = calcDayOfWeek(year, month, daysInMonth);\n var days = daysInMonth;\n var correct = (firstDow - lastDow);\n \n\t\t \n\t\t if (correct > 0) \n\t\t\t{\n days += correct;\n }\n\t\t\t\n\t\t\t\n return Math.ceil(days / 7);\n\t\t\t\n }", "function calculateNumberofWeeks(year, month){\n return Math.ceil ( ( calculateStartDay( year, month ) + calculateMonthEndDay( year, month ) ) / 7 ) ;\n}", "function weeksOfMonth(month) {\n var today = new Date();\n var y = today.getFullYear();\n var firstWeek;\n switch (month) {\n case 1:\n firstWeek = new Date(y, month, 1);\n break;\n case 2:\n firstWeek = new Date(y, month, 1);\n break;\n case 3:\n firstWeek = new Date(y, month, 1);\n break;\n case 4:\n firstWeek = new Date(y, month, 1);\n break;\n case 5:\n firstWeek = new Date(y, month, 1);\n break;\n case 6:\n firstWeek = new Date(y, month, 1);\n break;\n case 7:\n firstWeek = new Date(y, month, 1);\n break;\n case 8:\n firstWeek = new Date(y, month, 1);\n break;\n case 9:\n firstWeek = new Date(y, month, 1);\n break;\n case 10:\n firstWeek = new Date(y, month, 1);\n break;\n case 11:\n firstWeek = new Date(y, month, 1);\n break;\n case 12:\n firstWeek = new Date(y, month, 1);\n break;\n }\n var nWeek = wm.numberOfTheWeek(firstWeek);\n return [nWeek, nWeek + 1, nWeek + 2, nWeek + 3];\n }", "get weeksFromNow() {\n return Datetime.today.weeksBetween(this);\n }", "function getwk() {\n\tvar curr = new Date;\n\ttoday = moment(curr).format('MM-DD-YYYY');\n\tvar wkno = moment(today).week();\n\tif (wkno % 2 == 0){\n\t\tweekno = wkno - 1;\n\t}\n\telse{\n\t\tweekno = wkno;\n\t}\n\treturn weekno;\n}", "function getwk1() {\n\tvar curr = new Date;\n\ttoday = moment(curr).format('MM-DD-YYYY');\n\tvar wkno = moment(today).week();\n\tif (wkno % 2 == 0){\n\t\tweekno = wkno;\n\t}\n\telse{\n\t\tweekno = wkno + 1;\n\t}\n\treturn weekno;\n}", "timeInMonths(weeks){\r\n weeks*=Week\r\n return weeks/Month\r\n }", "function getWeekCount(date)\n{\n\tvar oneJan = new Date(date.getFullYear(), 0, 1) // get the January 1 Date\n\n\tvar numberOfDays = Math.floor( (date - oneJan) / (24 * 60 * 60 * 1000) )\n\n\tvar weekCount = Math.ceil( (date.getDate() + 1 + numberOfDays) / 7)\n\n\treturn weekCount\n}", "allocate_weeks(weeks_left) {\n while (weeks_left > 0) {\n let weeks_in_month = this.nav_cal.num_week_rows_in_month\n if (weeks_in_month > weeks_left) {\n break\n }\n weeks_left -= weeks_in_month\n this.nav_cal.month_forward()\n }\n return Math.max(7 * weeks_left, 0)\n }", "w (date) {\n return getWeekOfYear(date)\n }", "function getMonthView(date) {\n const thisMonth = date.getMonth();\n let firstDayOfMonth = date.getDay();\n let distance = 0 - firstDayOfMonth;\n let firstWeekendDate = new Date(\n date.getFullYear(),\n date.getMonth(),\n date.getDate() + distance\n );\n let weeks = [firstWeekendDate];\n let nextWeekendDate = new Date(firstWeekendDate);\n nextWeekendDate.setDate(nextWeekendDate.getDate() + 7);\n while (thisMonth === nextWeekendDate.getMonth()) {\n weeks.push(nextWeekendDate);\n nextWeekendDate = new Date(nextWeekendDate);\n nextWeekendDate.setDate(nextWeekendDate.getDate() + 7);\n }\n return weeks;\n }", "function getMonthForWeekend() {\n let monthForWeekend;\n // Get current date\n const todaysDateObject = new Date();\n monthForWeekend = todaysDateObject.getMonth();\n const dateForWeekend = getDateForWeekend();\n\n // IF dateForweekend 5 and todaysDateObject is 29 --> weekend is next month\n // If date for weekend is 25 and current date is 23, weekend is this month\n\n if (dateForWeekend < todaysDateObject.getDate()) {\n monthForWeekend = todaysDateObject.getMonth() + 1;\n }\n console.log(\n monthForWeekend,\n dateForWeekend,\n todaysDateObject.getDate()\n );\n // Get length of month\n return monthForWeekend;\n }", "getDayAndWeeks(currentMonth) {\n const startAndEndOfWeeks = [];\n const rowOfDays = [];\n let temp = [];\n let days = [];\n\n // First day of the given month \n const monthStart = dateFns.startOfMonth(currentMonth);\n // Last day of the given month\n const monthEnd = dateFns.endOfMonth(monthStart);\n\n // First day of the week for when the month starts. Some months \n // start on days that are not in the actual month\n const startDate = dateFns.startOfWeek(monthStart);\n // Last day of the week for when the month ends. Some months \n // end on days that are not in the actual month \n const endDate = dateFns.endOfWeek(monthEnd);\n\n let day = startDate;\n\n // Loops through all the days from startDate to endDate\n while (day <= endDate) {\n // For loop iterates by 7 so that it stores information by week. This \n // allows the rest of the program to keep to a week by week structure.\n for (let i = 0; i < 7; i += 1) {\n days.push(day);\n\n // Stores the information of the first and last day\n if (i === 0 || i === 6) {\n temp.push([day.getFullYear(), this.getWeek(day)]);\n }\n\n day = dateFns.addDays(day, 1);\n }\n\n rowOfDays.push(days);\n startAndEndOfWeeks.push(temp);\n\n temp = [];\n days = [];\n }\n\n return { rowOfDays, startAndEndOfWeeks };\n }", "function getWeeksInMonth(year, month) {\n var monthStart = moment().year(year).month(month).date(1);\n var monthEnd = moment().year(year).month(month).endOf('month');\n var numDaysInMonth = moment().year(year).month(month).endOf('month').date();\n\n //calculate weeks in given month\n var weeks = Math.ceil((numDaysInMonth + monthStart.day()) / 7);\n var weekRange = [];\n var weekStart = moment().year(year).month(month).date(1);\n var i = 0, j = 1;\n\n while (i < weeks) {\n var weekEnd = moment(weekStart);\n\n if (weekEnd.endOf('week').date() <= numDaysInMonth && weekEnd.month() === month) {\n weekEnd = weekEnd.endOf('week').format('LL');\n } else {\n weekEnd = moment(monthEnd);\n weekEnd = weekEnd.format('LL');\n }\n\n weekRange.push({\n 'weekStart': weekStart.format('LL'),\n 'weekEnd': weekEnd,\n 'weekNo': 'Week' + ' ' + j,\n 'weekIndex': i\n });\n weekStart = weekStart.weekday(7);\n i++;\n j++;\n }\n return weekRange;\n }", "static getWeeksOfMonth(date) {\n const weeks = [];\n const firstDay = this.getFirstDayOfMonth(date);\n let week = new MondayBasedWeek(firstDay);\n\n do {\n weeks.push(week);\n week = week.next();\n } while (this.isSameYearMonth(date, week.start));\n\n return weeks;\n }", "function getWeeksInMonth(month, year){\n var weeks=[],\n firstDate=new Date(year, month, 1),\n lastDate=new Date(year, month+1, 0),\n numDays= lastDate.getDate();\n\n var start=1;\n var end=7-firstDate.getDay();\n while(start<=numDays){\n weeks.push({start:start,end:end});\n start = end + 1;\n end = end + 7;\n if(end>numDays)\n end=numDays;\n }\n return weeks;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Table creating func. Builds table using for loops to go through every X/Y value Outputs the table with status.
function buildTable(xLT, xRT, yTop, yBottom) { var x, y, table = ""; for (y = yTop - 1; y <= yBottom; y++) { table += "<tr>"; if (y == yTop - 1) { table += "<td> * </td>"; for (x = xLT; x <= xRT; x++) { table += "<td>" + x + "</td>"; } } else { table += "<td>" + y + "</td>"; for (x = xLT; x <= xRT; x++) { table += "<td>" + x * y + "</td>"; } } table += "</tr>"; } document.getElementById("status").innerHTML += "Table completed! <br>"; document.getElementById("resultingTable").innerHTML = table; }
[ "function fillTable(table, x, y) {\n\n let row = document.createElement('tr')\n let th = document.createElement('th')\n row.appendChild( th )\n\n for( let i = 1; i <= y; i++ ) {\n let th = document.createElement('th')\n th.appendChild( document.createTextNode( `Y=${ i }` ) )\n row.appendChild( th )\n\n }\n table.appendChild(row)\n\n\n for( let i = 1; i <= x; i++ ) {\n let row = document.createElement('tr')\n let th = document.createElement('th')\n th.appendChild( document.createTextNode( `X=${ i }` ) )\n row.appendChild( th )\n\n for( let j = 1; j <= y; j++ ) {\n let column = document.createElement('td')\n column.appendChild( document.createTextNode( i * j ) );\n row.appendChild( column )\n }\n table.appendChild(row)\n\n }\n}", "function generateTable() {\n let cases, table, tableStr, dur;\n cases = generateCases();\n if(!containsCertainCase(cases)) {\n return generateTable();\n };\n table = $('table.historical-confidence-table');\n tableStr = `<tr><th></th>`;\n dur = minYrs;\n for (dur; dur <= maxYrs; dur += yrsStp) {\n tableStr += `<th>${dur} Yrs</th>`;\n }\n tableStr += `</tr>`\n for (let amount in cases) {\n let amountStr, tableRow, percentages\n amountStr = numberToDollarString(amount);\n tableRow = `<tr><th>${amountStr}</th>`;\n percentages = cases[amount];\n for (let p of percentages) {\n tableRow += `<td>${p}%</td>`\n }\n tableRow += `</tr>`;\n tableStr += tableRow;\n }\n table.html(tableStr);\n colorChart();\n }", "function tableGenerating() {\n tableWrapper.innerHTML = '';\n const newTable = document.createElement('table');\n newTable.style.width = `${tableWidth.value}%`;//no need for + ;\n newTable.style.border = `${borderWidth.value}px solid ${borderColor.value}`; // ` ` open and close for the whole string, NOT for each\n tableWrapper.style.backgroundColor = tableColor.value;\n newTable.style.color = fontColor.value;\n newTable.style.textAlign = textAlign.value;\n newTable.style.fontFamily = fontType.value;\n newTable.style.fontWeight = fontWeight.value;\n tableWrapper.appendChild(newTable);\n\n //create rows:\n for (let i = 0; i < rowNumber.value; i++) {\n const tableRow = document.createElement('tr');\n newTable.appendChild(tableRow);\n }\n\n //create heads:\n const tableAllRows = document.querySelectorAll('tr');\n \n for (let i = 0; i < columnNumber.value; i++) {\n const tableHead = document.createElement('th');\n tableAllRows[0].appendChild(tableHead);\n\n tableHead.textContent = 'Head';\n tableHead.style.border = `${borderWidth.value}px solid ${borderColor.value}`;\n tableHead.style.backgroundColor = headColor.value;\n }\n\n for (let row = 1; row < rowNumber.value; row++) {\n for (let column = 0; column < columnNumber.value; column++) {\n const data = document.createElement('td');\n data.textContent = 'data';\n tableAllRows[row].appendChild(data);\n data.style.backgroundColor = bodyColor.value;\n data.style.border = `${borderWidth.value}px solid ${borderColor.value}`;\n\n }\n }\n}", "function generateTable() {\n var tDayBody1 = \"<tr><td class='shortField'>\";\n var tDayBody2 = \"</td><td class='descriptionField'></td><tr>\";\n\n var tWeekBody1 = \"<tr><td class='shortField'>\";\n var tWeekBOdy2 = \"</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><tr>\";\n\n for (var i = 0; i <= 23; i++) {\n if (i < 10) {\n $('#tableOfEventsByDay tbody').append(tDayBody1 + \"0\" + i + \":00\" + tDayBody2);\n $('#tableOfEventsByWeek tbody').append(tWeekBody1 + \"0\" + i + \":00\" + tWeekBOdy2);\n } else {\n $('#tableOfEventsByDay tbody').append(tDayBody1 + i + \":00\" + tDayBody2);\n $('#tableOfEventsByWeek tbody').append(tWeekBody1 + i + \":00\" + tWeekBOdy2);\n }\n }\n $('#tableOfEventsByDay tbody').append(tDayBody1 + \"00:00\" + tDayBody2);\n $('#tableOfEventsByWeek tbody').append(tWeekBody1 + \"00:00\" + tWeekBOdy2);\n }", "function generatetable(table) {\n for (let i = 0; i < 5; i++) {\n let tr = table.insertRow(i);\n for (var j = 0; j < 5; j++) {\n if (i === 5 && j === 5) {\n break;\n } else {\n let td = tr.insertCell(j);\n td.setAttribute(\"id\", i + \",\" + j);\n }\n }\n }\n}", "function tnormTable(dataCellInfo, r) {\n var arrayNum = [];\n for (var i = 0; i <= dataCellInfo.cols; i++) {\n arrayNum.push(i);\n }\n var arrNumComb = findCombination(arrayNum, r);\n console.log(arrNumComb);\n\n var tblHtml = '<table class=\"table table-bordered data-table\">';\n for(var k = 0; k < arrayX.length+1; k++) { //rows\n tblHtml += '<tr>';\n for (j = 0; j < arrayX[0].length; j++) { //cols\n if (k == 0) {\n if (j == 0)\n tblHtml += '<th>Y</th>';\n else {\n if (j > arrayNum.length-1) {\n tblHtml += '<th>';\n for (var m = 0; m < arrNumComb[j-arrayNum.length].length; m++) {\n tblHtml += 'X<sub>' + arrNumComb[j-arrayNum.length][m] + '</sub>';\n }\n tblHtml += '</th>';\n } else\n tblHtml += '<th>X<sub>' + j + '</sub></th>';\n }\n } else {\n if (j == 0)\n tblHtml += '<td>' + arrayY[k-1][j] + '</td>';\n else\n tblHtml += '<td>' + arrayX[k-1][j] + '</td>';\n }\n }\n tblHtml += '</tr>';\n }\n tblHtml += '</table>';\n document.getElementById('tnorm-table').innerHTML = tblHtml;\n}", "function createTABLE(h,v){\n var mytable = '';\n \n //setting rows and column length to 5\n var row = 5;\n var col = 5;\n \n //creating each row\n for(var i = 0; i < row; i++){\n mytable += '<tr>';\n //creating each column\n for(var j = 0; j < col; j++){\n if( i === 0 && j !== 0){ //the first row of the table\n //displays the horizontal numbers in each cells\n mytable += '<th style=\"background-color:lightsteelblue; text-align: center ; height: 50px; width:50px;\">' + h[j-1] + '</th>';\n }else if(j === 0 && i !== 0){ //the first column of the table\n //displays the vertical numbers in each cells\n mytable += '<th style=\"background-color:thistle; text-align: center ; height: 50px; width:50px;\"\">' + v[i-1] + '</th>';\n }else if(j !== 0 && i !== 0){ //the rest of the table\n //displays the multiplication of the row and column value\n mytable += '<td style=\"background-color:lightcoral; text-align: center ; height: 50px; width:50px;\"\">' + mult(h[j-1], v[i-1]) + '</td>';\n }else{ //first cell of the table\n mytable += '<th style=\"background-color:beige; text-align: center ; height: 50px; width:50px;\"\">X</th>';\n }\n }\n mytable += '<tr>';\n }\n //displays the table\n //document.write('<table id=\"mytab\" border=\"3px\" >' + table + '</table>');\n \n document.getElementById(\"mytable\").innerHTML = '<table id=\"mytab\" border=\"3px solid black\" > ' + mytable + ' </table>';\n return false;\n}", "function createTable(num) {\r\n $(\".wrapper\").append(\"<table></table>\");\r\n for (var i = 0; i < num; i++) {\r\n $(\"table\").append(\"<tr ID='row\" + i + \"' \");\r\n for (var j = 0; j < num; j++) {\r\n $(\"#row\" + i).append(\"<td></td>\");\r\n }\r\n $(\"table\").append(\"</tr>\");\r\n }\r\n }", "function createTableData() {\n var i;\n for (i = 0; i < 100; i++) {\n tableData.push({\n ladder: false, // these are the default values of \n snake: false, // table \n occupied: false,\n occupiedBy: -1,\n destination: i,\n endof: \"\",\n position: {\n row: 0,\n cell: 0\n }\n });\n }\n}", "_generateTable() {\n let tableCode = \"\";\n let vals = this.graphPoints;\n let xColName = \"x\"; // hard-coded for now\n let yColName = \"y\";\n\n // add the column titles\n tableCode += \n \"<table><tr><th>\" + xColName + \"</th><th>\" + yColName + \"</th></tr>\";\n\n // for each point of data, add x and then y to a new row\n for (var i = 0; i < vals.length; i++) {\n tableCode +=\n \"<tr><td>\" + vals[i].x + \"</td><td>\" + vals[i].y + \"</td></tr>\";\n }\n\n // close the table\n tableCode += \"</table>\";\n\n // add the full string to the document's HTML\n document.getElementById(\"table-content\").innerHTML = tableCode;\n }", "function generateTable(){\n $.each(results['tests'], function(index,value){\n var row = document.createElement(\"tr\");\n var nameCell = document.createElement(\"td\");\n var msCell = document.createElement(\"td\");\n var kOpCell = document.createElement(\"td\");\n\n nameCell.appendChild(document.createTextNode(value['name']));\n msCell.appendChild(document.createTextNode(value['msTime']));\n kOpCell.appendChild(document.createTextNode(value['kOps']));\n row.appendChild(nameCell);\n row.appendChild(msCell);\n row.appendChild(kOpCell);\n\n resultTable.appendChild(row);\n });\n}", "function gameOverTable() {\n for (i=0; i < params.progress.length; i++){\n var rows = params.progress[i];\n progressTable.push('<tr><td>'+rows[0]+'</td><td>'+rows[1]+'</td><td>'+rows[2]+'</td><td>'+rows[3]+'</td></tr>');\n console.log(progressTable)\n };\n}", "function generateTable() {\n let temp = 0;\n let rowString = \"\";\n\n // if values are not valid then do nothing\n if (!checkValues()) { return; }\n\n if (minXVal > maxXVal) { // swap min and max column values\n temp = minXVal;\n minXVal = maxXVal;\n maxXVal = temp;\n infoMsg.textContent = \"Starting and ending column value swapped. \";\n }\n else {\n infoMsg.textContent = \"\";\n }\n if (minYVal > maxYVal) { // swap min and max row values\n temp = minYVal;\n minYVal = maxYVal;\n maxYVal = temp;\n infoMsg.textContent += \"Starting and ending row value swapped.\";\n }\n else {\n infoMsg.textContent += \"\";\n }\n\n // insert empty table HTML\n document.getElementById(\"table\").innerHTML = \"<table><thead><tr \" +\n \"id=\\\"columns\\\"></tr></thead><tbody id=\\\"rows\\\"></tbody></table>\";\n document.getElementById(\"table\").style.overflow = \"scroll\";\n\n let columns = document.getElementById(\"columns\");\n let rows = document.getElementById(\"rows\");\n\n // fill in columns\n columns.innerHTML = \"<th></th>\";\n for (let i = minXVal; i <= maxXVal; i++) {\n columns.innerHTML += \"<th>\" + i + \"</th>\";\n }\n\n // fill in rows with multiplication data\n for (let i = minYVal; i <= maxYVal; i++) {\n rowString += \"<tr><th>\" + i + \"</th>\";\n for (let j = minXVal; j <= maxXVal; j++) {\n rowString += \"<td>\" + (i * j) + \"</td>\";\n }\n rowString += \"</tr>\";\n }\n rows.innerHTML = rowString;\n}", "function dicplaysTable() {\n table += `<table>`;\n\n for (let i = 1; i <= number1; i++) {\n\n table += `<tr>`;\n\n for (let j = 1; j <= number2; j++) {\n\n table += `<td>`;\n\n table += `<pre>${counter} </pre>`;\n\n counter++;\n\n table += `</td>`;\n\n }\n \n\n table += `</tr>`;\n }\n\n\n\n table += `</table>`;\n \n \n}", "function makeTable() {\n let tableHTML = '<tr><th>Test</th><th>Result (milliseconds)</th></tr>';\n\n for (i=0; i<tests.length;i++) {\n tableHTML += `<tr><td id='rowTest${i}'>${i+1}</td><td id='rowResult${i}'></td></tr>`;\n }\n\n $('#tableTestResults').html(tableHTML);\n}", "function buildTable(data) {\n var table = document.createElement(\"table\");\n var arr = Object.keys(data[0]);\n var row = document.createElement(\"tr\");\n for (var i = 0; i < arr.length; i++) {\n \tvar cell = document.createElement(\"th\");\n var cellText = document.createTextNode(arr[i]);\n \tcell.appendChild(cellText);\n \trow.appendChild(cell);\n \ttable.appendChild(row);\n };\n \t\n for (var i = 0; i < data.length; i++) {\n \tvar row = document.createElement(\"tr\");\n \tvar cell1 = document.createElement(\"td\");\n var cellText1 = document.createTextNode(data[i][arr[0]]);\n \tcell1.appendChild(cellText1);\n var cell2 = document.createElement(\"td\");\n var cellText2 = document.createTextNode(data[i][arr[1]]);\n \tcell2.appendChild(cellText2);\n var cell3 = document.createElement(\"td\");\n var cellText3 = document.createTextNode(data[i][arr[2]]);\n \tcell3.appendChild(cellText3);\n \trow.appendChild(cell1);\n row.appendChild(cell2);\n row.appendChild(cell3);\n table.appendChild(row);\n };\n \t\treturn table;\n}", "function makeTable() {\n let tableHTML = '<tr><th>Test</th><th>Result (milliseconds)</th></tr>';\n\n for (i=0; i<numberOfTests;i++) {\n tableHTML += `<tr><td id='rowTest${i}'></td><td id='rowResult${i}'></td></tr>`;\n }\n\n $('#tableTestResults').html(tableHTML);\n}", "function hundred_table() {\n var table = elem('table').addClass('point');\n for (var a=0; a<10; a++) {\n var tr = elem('tr');\n for (var b=1; b<=10; b++) {\n var td = number_cell(a*10 + b);\n tr.append(td);\n }\n table.append(tr);\n }\n return table;\n}", "function buildTable(start, end, gen)\n{\n\t//initialize first row of table\n\tvar out = \"<table style='width:100%', font-family:.pokemonfont3>\";\n\tout += \"<tr>\"\n\t\t+ \"<td>SPRITE</td>\"\n\t\t+ \"<td>ID</td>\"\n\t\t+ \"<td>NAME</td>\"\n\t\t+ \"<td>DESC</td>\"\n\t\t+ \"<td>HEIGHT</td>\"\n\t\t+ \"<td>WEIGHT</td>\"\n\t\t+ \"<td>BMI</td>\"\n\t\t+ \"<td>STATUS</td>\"\n\t\t+ \"</tr>\";\n\t\t\n\t//iterate over a range of pokedex entries\n\tfor(var i = start; i <= end; ++i)\n\t{\n\t\tvar dexJSON = getEntry(i);\n\t\tvar height = dexJSON.height / 10;\n\t\tvar weight = dexJSON.weight / 10;\n\t\t\n\t\tout += \"<tr>\"\n\t\t\t+ \"<td width='150'><img src='\" + getImage(dexJSON) + \"'></td>\"\n\t\t\t+ \"<td>\" + dexJSON.national_id + \"</td>\"\n\t\t\t+ \"<td width='100'>\" + dexJSON.name + \"</td>\"\n\t\t\t+ \"<td width='250'>\" + getDesc(dexJSON, gen) + \"</td>\"\n\t\t\t+ \"<td>\" + height + \" m</td>\"\n\t\t\t+ \"<td>\" + weight + \" kg</td>\"\n\t\t\t+ \"<td>\" + calcBMI(height,weight) + \"</td>\"\n\t\t\t+ \"<td>\" + interpretBMI(calcBMI(height,weight)) + \"</td>\"\n\t\t\t+ \"</tr>\";\n\t}\n\t\n\tout += \"</table>\";\n\tdocument.getElementById(\"id01\").innerHTML += out\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
read config file to get the object
async getCfgFromFile() { const obj = await utils.readJSONFromFile(this.cfgPath); return new CfgObject(obj); }
[ "read () {\n this.configObj = JSON.parse(fs.readFileSync(this.configPath, 'utf8'))\n }", "read() {\n this.exists()\n if (!this.validate()) {\n }\n const config = JSON.parse(fs.readFileSync(this.configPath))\n return config\n }", "function read() {\n\tconfig = JSON.parse(fs.readFileSync(CONFIG_FILE, \"utf8\"));\n}", "readConfig() {\n try {\n this.config = JSON.parse(fs.readFileSync(this.configFile, 'UTF-8'));\n } catch (e) {\n this.log.error('could not read the config.json');\n this.resetConfig();\n this.resetConfig();\n this.saveConfig();\n }\n }", "function loadConfig() {\n\treturn JSON.parse(fs.readFileSync('config.json'));\n}", "load() {\n var data = fs.readFileSync(this.configPath, {\n encoding: 'utf-8'\n });\n this.config = ini.parse(data);\n }", "readFile ( file_path, label = '' ) {\n let config = {}\n\n try {\n let data = fs.readFileSync(file_path, 'utf8')\n let extension = path.extname(file_path)\n if ( extension === '.json' ) {\n debug('readFile reading json file', file_path)\n config = JSON.parse( data )\n } else {\n debug('readFile reading yaml file', file_path)\n config = yaml.load( data )\n }\n this.debug('readFile loaded yaml from file', file_path)\n\n } catch (err) {\n this.logger.error(err)\n throw new ConfigError(`Can't load config ${label} - ${file_path}`)\n }\n\n this.debug('readFile got config', file_path, config)\n return config\n }", "load() {\n let fileContent;\n try {\n fileContent = fs.readFileSync(\"config.json\", \"utf8\")\n } catch (e) {\n console.info(\"Configuration file not found, falling back to default\")\n return\n }\n\n try {\n this._config = JSON.parse(fileContent)\n } catch (e) {\n console.error(\"Error parsing configuration file\")\n process.exit(1)\n }\n }", "function readConfig() {\n return toml.parse(fs.readFileSync('config.toml', 'utf8'));\n}", "static fromFile(filename) {\n const configdata = loadFromFile(filename);\n return Config.fromObject(configdata, filename);\n }", "readConfig(fileRef) {\n const { filename, error: error2 } = fileRef;\n if (error2) {\n fileRef.error = error2 instanceof ImportError ? error2 : new ImportError(`Failed to read config file: \"${filename}\"`, error2);\n return { __importRef: fileRef };\n }\n const s = {};\n try {\n const r = this.cspellConfigExplorerSync.load(filename);\n if (!r?.config)\n throw new Error(`not found: \"${filename}\"`);\n Object.assign(s, r.config);\n normalizeRawConfig(s);\n validateRawConfig(s, fileRef);\n } catch (err) {\n fileRef.error = err instanceof ImportError ? err : new ImportError(`Failed to read config file: \"${filename}\"`, err);\n }\n s.__importRef = fileRef;\n return s;\n }", "function readFromConfigFile() {\n\tconsole.log(\"Reading from config file\");\n\ttry {\n\t\tvar config = require('./server-config.json');\n\t\tconsole.log(JSON.parse(config));\n\t}catch (err) {\n\t\tconsole.log(err);\n\t}\n}", "function readConfig () {\n let data = JSON.parse(fs.readFileSync(CONFIG_FN, 'utf8'))\n ;['exchanges', 'server', 'cache'].forEach((group) => {\n if (!data[group]) {\n return\n }\n for (let key in data[group]) {\n // consider any lines starting with '#' as comments\n if (!key.startsWith('#')) {\n config[group][key] = data[group][key]\n }\n }\n })\n}", "function loadConfig() {\n\tconfigFile = 'apiConfigs.json';\n\tconfig = JSON.parse(\n\t\tfs.readFileSync(configFile)\n\t);\n}", "readConfig(fileRef) {\n // cspellConfigExplorerSync\n const { filename, error } = fileRef;\n if (error) {\n fileRef.error =\n error instanceof ImportError_1.ImportError\n ? error\n : new ImportError_1.ImportError(`Failed to read config file: \"${filename}\"`, error);\n return { __importRef: fileRef };\n }\n const s = {};\n try {\n const r = this.cspellConfigExplorerSync.load(filename);\n if (!r?.config)\n throw new Error(`not found: \"${filename}\"`);\n Object.assign(s, r.config);\n (0, normalizeRawSettings_1.normalizeRawConfig)(s);\n validateRawConfig(s, fileRef);\n }\n catch (err) {\n fileRef.error =\n err instanceof ImportError_1.ImportError ? err : new ImportError_1.ImportError(`Failed to read config file: \"${filename}\"`, err);\n }\n s.__importRef = fileRef;\n return s;\n }", "function readConfigFile()\n{\n\tvar configfile=\"config.json\";\n\tvar stream_config = fs.open(configfile,'r');\n\tvar data_config = stream_config.read(); \n\tvar config_c = JSON.parse(data_config); \n\twindow.timestampFormat=config_c.timestampFormat;\n\twindow.version=config_c.version;\n\tstream_config.close();\n\treadQueries();\n}", "function configRead()\n\t\t{\n\t\t\t// create a new config, and clear it\n\t\t\t\tvar config = new Config('test').clear();\n\t\t\t\t\n\t\t\t// set some values\n\t\t\t\tconfig.set('@attr', 5);\n\t\t\t\tconfig.set('a.b', 'hello');\n\t\t\t\tconfig.set('c', <c attr=\"1\">value</c>);\n\t\t\t\n\t\t\t// trace the XML\n\t\t\t\tXML.prettyPrinting = true;\n\t\t\t\ttrace(config.toXMLString());\n\t\t\t\t\n\t\t\t// extract the values into a table\t\n\t\t\t\tvar data = [];\n\t\t\t\tvar nodes = ['a', 'a.b', 'c', '@attr', 'somenode'];\n\t\t\t\tXML.prettyPrinting = false;\n\t\t\t\tfor each(var node in nodes)\n\t\t\t\t{\n\t\t\t\t\tvar value\t= config.get(node);\n\t\t\t\t\tdata.push({node:node, value:value, type:typeof value});\n\t\t\t\t}\n\t\t\t\tXML.prettyPrinting = true;\n\t\t\t\t\n\t\t\t// trace values\n\t\t\t\tTable.print(data);\n\t\t}", "function readConfigFile() {\n\treturn ini.parse(readFileSync(confFile, 'utf-8'));\n}", "getConfig() {\n try {\n let contents = fs.readFileSync(this.getFilePath(), 'utf8');\n return yaml.load(contents);\n }\n catch (err) {\n console.log(err.stack || String(err));\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mem() Returns a memory address (well, just a number actually) that is not in use in the dbpf file yet. This allows us to insert content in a dbpf file while ensuring that the memory address of it won't conflict with another entry.
mem() { let ref = this.$mem++; while (this.memRefs.has(ref)) { ref = this.$mem++; } return ref; }
[ "function membyte(step, addr){\n if (step in memo_table){\n if (addr in memo_table[step]){\n return memo_table[step][addr];\n }\n } else {\n memo_table[step] = {};\n }\n let t = trace[step].memwrite;\n if (Object.keys(t).includes(addr.toString())){\n memo_table[step][addr] = t[addr];\n return t[addr];\n } else {\n if (step == 0) { return \"XX\"; }\n else {\n let v = membyte(step-1, addr);\n memo_table[step][addr] = v;\n return v;\n }\n }\n}", "function get_mem_value(addr) {\n return to_hex(datapath.mem[addr]);\n}", "function memAddress(memBase, idaBase, idaAddr) {\n var offset = ptr(idaAddr).sub(idaBase);\n var result = ptr(memBase).add(offset);\n return result;\n}", "_addMemoryAddress( memAddress, dez ) {\n console.log( 'memAddress:', memAddress );\n fs.writeFileSync( FILE_TO_WATCH, `memAddress: ${memAddress}` );\n console.log( 'memAddress + dez:', num.hex2dez( memAddress ) + dez );\n console.log( 'memAddress + dez -> hex:', num.dez2hex( num.hex2dez( memAddress ) + dez ) );\n fs.writeFileSync( FILE_TO_WATCH,\n `memAddress + dez -> hex: ${num.dez2hex( num.hex2dez( memAddress ) + dez )}` );\n return num.dez2hex( num.hex2dez( memAddress ) + dez );\n }", "_mem_read(addr) {\n let val = this.mem[addr];\n this._emulate_contended_memory(addr, false);\n return val;\n }", "MEMSTORE() {\n // Set memory address\n this.membus.ADDR = this.reg.MAR;\n // Set memory write value\n this.membus.ADDRVAL = this.reg.MDR;\n // instruct memory to write\n this.membus.WRITE();\n // this.mem[this.reg.MAR] = this.reg.MDR;\n }", "function memory(){return this._memory=this._memory||{}}", "getMemoryOffset(dataId) {\n return this.dataIdMap.get(dataId).memoryOffset;\n }", "function _getMem(id) {\n\t\t\tif (this._inMem(id)) {\n\t\t\t\treturn this.$mem[id].m;\n\t\t\t} else {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}", "function gotMem(pointer) {\n memoryBytes.set(bytes, pointer);\n loadDemo();\n}", "function libkernel_mem_test(mname, mtype, msize)\n{\n\tvar scekernel = libraries.SceLibKernel.functions;\n\t\n\tvar mname_addr = allocate_memory(mname.length + 1);\n\tvar mbase_ptr_addr = allocate_memory(0x4);\n\tmymemcpy(mname_addr, mname + \"\\x00\", mname.length);\n\t\n\tvar muid = scekernel.sceKernelAllocMemBlock(mname_addr, mtype, msize, 0);\n\tlogdbg(\"Allocated memory UID: 0x\" + muid.toString(16));\n\t\n\tvar base_result = scekernel.sceKernelGetMemBlockBase(muid, mbase_ptr_addr);\n\t\n\tif (base_result != 0x0)\n\t{\n\t\tlogdbg(\"Error: 0x\" + base_result.toString(16));\n return aspace\n\t}\n\t\n\tlogdbg(\"Memory base pointer: 0x\" + mbase_ptr_addr.toString(16));\n\t\n\tvar free_result = scekernel.sceKernelFreeMemBlock(muid);\n\t\n\tif (free_result != 0x0)\n\t{\n\t\tlogdbg(\"Error: 0x\" + free_result.toString(16));\n return aspace\n\t}\n\t\n\tlogdbg(\"Freed memory UID: 0x\" + muid.toString(16));\n}", "_mem_write(addr, val) {\n // make ROM read-only\n if (addr >= 0x4000)\n this.mem[addr] = val;\n this._emulate_contended_memory(addr, true);\n }", "function hooked_mem_write(address, value) {\n mem_write(address, value);\n if(address === 0x4000) {\n console.log(`writing in mem ${hex(address,4)}: ${hex(value)} from pc=${hex(cpu.getState().pc,4)}`);\n }\n}", "function fixaddr(addr) {\n\t\twhile(addr >= memory.length) {\n\t\t\tmemory.push(0);\n\t\t}\n\t}", "function loadXMem()\n{\n\tvar byte1 = _MemoryManager.getNextByte();\n\tvar byte2 = _MemoryManager.getNextByte();\n\tvar decAddr = parseInt((byte2 + byte1), 16) + _MemoryManager.getRelocationValue();\n\t\n\t//If address is a valid address for this process put it in Acc\n\tif (_MemoryManager.isValidAddress(decAddr))\n\t{\n\t\t_CPU.Xreg = parseInt(_MainMemory[decAddr]);\n\t}\n\telse{\t//Address is not valid: shut down OS and log event\n\t\t//krnShutdown();\n\t\t//krnTrace(\"The requested address is not valid\");\n\t\t\n\t\tkrnInterruptHandler(MEMACCESS_IRQ);\n\t}\n\t_CPU.PC++;\n\n}", "function memory() {\n\t return this._memory = this._memory || {};\n\t}", "function _saveMemory () {\n memory = total;\n }", "function getSetMem(node, sTable) {\n if (/^[0-9]$/.test(node.name)) {\n //Load single digit into Acc, then store\n let addr = memManager.allocateStatic();\n byteCode.push(\"A9\", \"0\" + node.name, \"8D\", addr[0], addr[1]);\n return addr;\n }\n else if (node.name === \"ADD\") {\n //Calculate addition, return the location of result\n return parseAdd(node, sTable);\n }\n else if (node.name === \"true\") {\n //Load true (01) into Acc, then store\n return memManager.getTrueVal();\n }\n else if (node.name === \"false\") {\n //Location of default \"00\" (false)\n return memManager.getFalseVal();\n }\n else if (/^[a-z]$/.test(node.name)) {\n //Return location of variable value\n return sTable.getLocation(node.name);\n }\n else if (node.name === \"CHARLIST\") {\n //Allocate string in heap, store pointer, return location of pointer\n let pointer = parseCharList(node);\n let addr = memManager.allocateStatic();\n byteCode.push(\"A9\", pointer, \"8D\", addr[0], addr[1]);\n return addr;\n }\n }", "write_memory(offset, buffer) {\n this.memory.set(buffer, utils.toNum(offset));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load account, watch events and load leases in state when component mounts
componentDidMount() { this.props.web3.eth.getCoinbase((err, account) => { this.setState({ account: account }) this.props.leasesContract.deployed().then((smartLeaseInstance) => { this.smartLeaseInstance = smartLeaseInstance this.loadLeases() this.watchEvents() }) }) }
[ "account_event() {\n event.subscribe('account', (e) => {\n this.account = e.payload\n if(this._mounted && typeof window !== 'undefined') this.forceUpdate()\n })\n\n /*\n subscribe to the 'account'-event\n if the component is mounted\n (componentWillMount sets _mounted to true;\n componentWillUnmount sets _mounted to false)\n forceUpdate is called to rerun the render method and do diffing\n */\n }", "loadLeases() {\n // get the number of leases stored in blockchain\n this.smartLeaseInstance.leasesCount().then((leasesCount) => {\n // initialize temporary lease table by copying existing state ones\n this.tempTab = [...this.state.leases]\n // load lease one by one \n for (var i = 0; i < leasesCount; i++) {\n this.loadLeaseByIndex(i, false)\n }\n // set the full table in state after all are loaded -- for performances & unmounted access errors\n this.setState({\n leases: this.tempTab\n })\n })\n }", "listenToActiveAccountUpdates() {\n try {\n this.props.drizzle.web3.currentProvider.publicConfigStore.on('update', ({ selectedAddress }) => {\n if (selectedAddress) this.getActiveEOARole(selectedAddress)\n else this.setState({EOARole: null})\n });\n } catch (error) {\n console.error(\"Couldn track role change web3: \", error)\n }\n }", "function loaded() {\n self.accounts.unbind('loaded', loaded);\n self._hasLoadedAccounts = true;\n self.attemptToReloadState();\n }", "async fetchState() {\n this._state = await this.connection.provider.query(`account/${this.accountId}`, '');\n }", "listenToActiveAccountUpdates() {\n this.props.drizzle.web3.currentProvider.publicConfigStore.on('update', ({ selectedAddress }) => {\n this.getActiveEOARole(selectedAddress)\n });\n }", "componentDidMount() {\n // Add containers for testing.\n if (this.accountInterval == undefined)\n this.accountInterval = setInterval(() => {\n if (Store.AuthStore.getState()[Symbols.BAD_PERMISSIONS].has('docker-container-ls')) return;\n window.Lemonade.Mirror.send('account-ls', CookieManager.getCookie('loggedIn_user'), CookieManager.getCookie('loggedIn_session'));\n },\n AccountListRefreshRate);\n window.Lemonade.Mirror.send('account-ls', CookieManager.getCookie('loggedIn_user'), CookieManager.getCookie('loggedIn_session'));\n }", "loadAccounts() {\n let accounts = store.getData( this._accountsKey );\n if ( !Array.isArray( accounts ) || !accounts.length ) return;\n this.importAccounts( accounts, true );\n }", "componentDidMount() {\n let userProfile = JSON.parse(sessionStorage.getItem('userProfile'));\n let token = sessionStorage.getItem('token');\n // Here the Api is called again to establish a connection, and a GET request is made to fetch information from the endpoint.\n let api = Api.establishConnection(token);\n (async () => {\n const accounts = await api.get(`/accounts/${userProfile._id}`);\n this.setState({accounts: accounts.data});\n })();\n }", "async function loadAccounts(){\n await getAccounts()\n }", "async function accountChange() {\r\n\tawait window.ethereum.enable();\r\n \r\n\tweb3.eth.getAccounts(function (error, accounts) {\r\n\t\tconsole.log(accounts[0], 'current account on init');\r\n\t\taccount = accounts[0];\r\n\t});\r\n \r\n\t// Acccounts now exposed\r\n\twindow.ethereum.on('accountsChanged', function () {\r\n\t\tweb3.eth.getAccounts(function (error, accounts) {\r\n\t\t\tconsole.log(accounts[0], 'current account after account change');\r\n\t\t\taccount = accounts[0];\r\n\t\t});\r\n\t});\r\n}", "async watch () {\n if (this.watching) return\n this.watching = true\n\n client.core.services.contract.on('initialized', () => {\n this._startWatchIntervals()\n })\n\n // Initial setup.\n await client.start()\n this.account = await client.getAccount()\n }", "componentDidMount() {\n API.getAccountInfo(this.onAccountInfo.bind(this));\n }", "async function loadAccounts() {\n await getSubAccounts();\n }", "componentDidMount() {\n this.loadVisits();\n this.loadUser();\n }", "listenToActiveAccountUpdates() {\n this.props.drizzle.web3.currentProvider.publicConfigStore.on('update', ({ selectedAddress }) => {\n this.props.drizzle.store.dispatch(setActiveEOA(selectedAddress))\n });\n }", "initSync() {\r\n this.subscription.add(this.statePersistenceService.syncWithStorage({\r\n key: this.key,\r\n state$: this.getAuthState(),\r\n onRead: (state) => this.onRead(state),\r\n }));\r\n }", "async loadAccountBalances(account) {\n const balance = await this.state.token.balanceOf(account);\n this.setState({ tokenBalance: balance.toNumber() });\n\n const ethBalance = await this.web3.eth.getBalance(account);\n this.setState({ ethBalance: ethBalance });\n }", "loadUserIDAndTradingStatus() {\n let user_id = null;\n app.auth().onAuthStateChanged((user) => {\n if (user) {\n user_id = user.uid;\n this.setState({\n uid : user_id\n });\n const userDB = app.database().ref('user/' + user_id);\n let trading = null;\n userDB.on('value', (snapshot) => {\n\n if (snapshot.val() !== null) {\n trading = snapshot.child(\"/trading\").val();\n }\n this.setState({\n openTradingAccount: trading\n });\n });\n }\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
You may only resubmit a submissions that was voted out. If the submission is in any other state, reject the resubmission
async function doResubmit(res, user, payload, GameDatabases, Trans) { try { let submission = await GameDatabases.getSubmissionByUserID(Trans, user.user_id); // Sanity check that we have a submission if(!submission){ errorResponse(res, "Resubmission failed", "Could not find a submission to resubmit. " + "Please contact me." ); return "fail - no submission found"; } // You may only resubmit a game that is voted out if (submission.state !== State.S.voted_out) { errorResponse(res, 'Resubmission failed', 'You currently do not have a submission that is resubmittable'); return "fail - invalid state"; } // Delete the submission GameDatabases.deleteSubmission(Trans, submission); // Make sure that the user does not have a submission now that we deleted it let temp = await GameDatabases.getSubmissionByUserID(Trans, user.user_id); if(temp){ errorResponse(res, 'Resubmission failed', 'You somehow already have a submission in. Please contact me.'); return "fail - submission already exist"; } // Create a new submission GameDatabases.createSubmission(Trans, submission.quest_id, user.user_id, submission.comments); // Update the quest let quest = await GameDatabases.getQuestByID(Trans, submission.quest_id); quest.state = State.Q.submitted; GameDatabases.updateQuest(Trans, quest); successResponse(res, 'Resubmission successful!', 'Thank you for resubmitting ' + quest.title + ' [' + quest.system + ']' + ' to The Journey Project.\nMuch appreciated'); return "success"; } catch (e) { return e; } }
[ "function validateRebateResubmitDenial(form) {\n\t\tif (form.RequestResubmitted.checked == true) {\n\t\t\tif (form.ResubmissionDenied.disabled == true) {\n\t\t\t\t// enable ResubmissionDenied and restore from backup\n\t\t\t\tform.ResubmissionDenied.disabled = false;\n\t\t\t\tform.ResubmissionDenied.selectedIndex = ReasonResubmitDeniedJS;\n\t\t\t}\n\t\t\tif (form.ResubmissionDenied.selectedIndex > 0) {\n\t\t\t\t// enable DateResubmitDenied and restore from backup or today's date\n\t\t\t\tform.DateResubmitDenied.disabled = false;\n\t\t\t\tif (DateResubmitDeniedJS == \"\") {\n\t\t\t\t\tform.DateResubmitDenied.value = getTodaysDate();\n\t\t\t\t\tDateResubmitDeniedJS = form.DateResubmitDenied.value;\n\t\t\t\t} else {\n\t\t\t\t\tform.DateResubmitDenied.value = DateResubmitDeniedJS;\n\t\t\t\t}\n\t\t\t\t// enable ResubmitDeniedCalendar\n\t\t\t\tResubmitDeniedCalendar.disabled = false;\n\t\t\t} else if (form.DateResubmitDenied.disabled == false) {\n\t\t\t\t// disable DateResubmitDenied and set backup\n\t\t\t\tform.DateResubmitDenied.disabled = true;\n\t\t\t\tDateResubmitDeniedJS = form.DateResubmitDenied.value;\n\t\t\t\tform.DateResubmitDenied.value = \"\";\n\t\t\t\t// disable ResubmitDeniedCalendar\n\t\t\t\tResubmitDeniedCalendar.disabled = true;\n\t\t\t}\n\t\t} else {\n\t\t\t// disable ResubmissionDenied and set backup\n\t\t\tform.ResubmissionDenied.disabled = true;\n\t\t\tReasonResubmitDeniedJS = form.ResubmissionDenied.selectedIndex;\n\t\t\tform.ResubmissionDenied.selectedIndex = 0;\n\t\t\tif (form.DateResubmitDenied.disabled == false) {\n\t\t\t\t// disable DateResubmitDenied and set backup\n\t\t\t\tform.DateResubmitDenied.disabled = true;\n\t\t\t\tDateResubmitDeniedJS = form.DateResubmitDenied.value;\n\t\t\t\tform.DateResubmitDenied.value = \"\";\n\t\t\t}\n\t\t\t// disable ResubmitDeniedCalendar\n\t\t\tResubmitDeniedCalendar.disabled = true;\n\t\t}\n\t}", "function isSubmitDisallowed() {\n return gradesPublished || passedDue || isAnswerTextAreaEmpty();\n }", "function deleteResubmission(submission) {\r\n var userId = getSessionData(\"currentUser\");\r\n var submissionId = userId + \".\" + submission.InspectionId;\r\n var browserResubs = JSON.parse(getLocalData(\"auditsForResubmission\"));\r\n if (browserResubs != null) {\r\n if (browserResubs.includes(submissionId)) {\r\n var index = browserResubs.indexOf(submissionId);\r\n if (index > -1) {\r\n browserResubs.splice(index, 1);\r\n }\r\n setLocalData(\"auditsForResubmission\", JSON.stringify(browserResubs));\r\n refreshResubCount();\r\n }\r\n }\r\n }", "function submitExclusionVote(id, vote) {\n return storage.part.read(id).then((part) => {\n if (part.stage != stage.EXCLUSION_VOTE) {\n return Promise.reject({\n code: 403,\n message: 'not ready for exclusion vote'\n });\n }\n part.exclusionVotes.push(vote);\n part.stage = stage.WAIT;\n return storage.part.update(part).then(() => {\n return loadFullExp(part.experimentId);\n });\n }).then((fullExp) => {\n if (!allWait(fullExp)) {\n return;\n }\n var exp = fullExp.exp;\n var parts = fullExp.parts;\n var i = exp.finishedRound;\n var kickedParts = [];\n\n parts.map((part) => {\n part.excluded = false;\n if (parts.reduce((totalVotes, otherPart) => {\n if (otherPart.exclusionVotes[i] == part.name) {\n return totalVotes + 1;\n }\n return totalVotes;\n }, 0) * 2 >= exp.settings.partSize) {\n kickedParts.push(part);\n }\n part.stage = stage.SELECT_CONTRIBUTION;\n });\n if (kickedParts.length > 0) {\n var kickedPart = kickedParts[\n Math.floor(Math.random() * kickedParts.length)];\n kickedPart.excluded = true;\n exp.kickedParts.push(kickedPart.name);\n } else {\n exp.kickedParts.push('None');\n }\n return storage.exp.update(fullExp.exp).then(() => {\n return storage.part.updateMultiple(fullExp.parts);\n });\n });\n}", "handleRejectReassignButtonClick() {}", "function submit_cancel(e) {\n // not to post\n e.preventDefault();\n // cancel proc\n toggle_elements_by_read_status(has_read=false)\n;\n\n}", "function rejectRequest() {\n replyRequest('REJECTED');\n}", "approve() {\n Meteor.call('businesses.insert', this.props.submission.business, (err) => {\n if (err) throw err;\n });\n\n Meteor.call('submissions.remove', this.props.submission.id);\n }", "onReject () {\n this.dispatch('reject', [this]);\n this.active = false;\n }", "function blockResubmit() {\n var downloadToken = setFormToken();\n $('#page-spinner').show();\n\n downloadTimer = window.setInterval(function () {\n var token = getCookie(\"downloadToken\");\n\n if ((token == downloadToken) || (attempts == 0)) {\n unblockSubmit();\n }\n\n attempts--;\n }, 1000);\n return downloadToken;\n }", "_unmarkSubmitting() {\n this._isSubmitting = false;\n this._recomputeIsSubmitting();\n }", "set skip_submission(value) {\n this._skip_submission = value;\n }", "function unrejectHit(assignmentId, workerId, listId){\n\t$(\"#\" + listId + \" .approveButton\").remove();\n\t$.ajax({\n\t\turl: \"Retainer/php/processHIT.php\",\n\t\ttype: \"POST\",\n\t\tasync: true,\n\t\tdata: {id: assignmentId, workerId: workerId, operation: \"Unreject\", useSandbox: sandbox, accessKey: $(\"#accessKey\").val(), secretKey: $(\"#secretKey\").val()},\n\t\tsuccess: function(d) {\n\t\t\t//alert(\"Sending number of workers succeeded [unreject]\");\n\t\t\t$(\"#\" + listId + \".approveButton\").fadeOut( function() { $(this).remove(); });\n\t\t},\n\t\tfail: function() {\n\t\t\t//alert(\"Sending number of workers failed [unreject]\");\n\t\t}\n\t});\n}", "function resubmit() {\n\t$(\"#error\").hide();\n\t$(\"#resubmit\").show();\n\treprompt = setTimeout(prompt_resubmit, 10000);\n\t\n\tpsiTurk.saveData({\n\t\tsuccess: function() {\n\t\t clearInterval(reprompt); \n //gotoResults();\n gotoMTurk();\n\t\t}, \n\t\terror: prompt_resubmit\n\t});\n}", "function prompt_resubmit() {\n\t$(\"#end\").hide();\n\t$(\"#resubmit\").hide();\n\t$(\"#error\").show();\n\t$(\"#resubmit-button\").click(resubmit);\n}", "function blockResubmit() {\n\t\t\tdownloading = true;\n\t\t\tvar downloadToken = setFormToken();\n\t\t\tsetCursor('wait', 'wait');\n\t\t\tdownloadTimer = window.setInterval(function () {\n\t\t\t\tvar token = getCookie('downloadToken');\n\t\t\t\tif ((token === downloadToken) || (attempts === 0)) {\n\t\t\t\t\tunblockSubmit();\n\t\t\t\t}\n\t\t\t\tattempts--;\n\t\t\t}, 1000);\n\t\t\tdocument.getElementById('getPdfButton').disabled = true;\n\t\t}", "function submitVote(event) {\n\t\tvar eventId = $(event.target).attr('name');\n\t\tvar vote = $(event.target).val();\n\t\tuser.vote(eventId, vote);\n\t\tdisableVoteButtons();\n\t}", "function checkAlreadySubmittedSafetyNet()\n{\n if ( doesUserWantToRiskItAndTryOver() )\n {\n window.document.assessmentSubmitted = false;\n assessment.submittingRightNow = false;\n }\n else\n {\n checkAlreadySubmittedSafetyNet.delay( assessment.safetyNetDelay );\n }\n}", "function rejected(x){\n settle(action.rejected(x));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper function for interleave interleaves a single object of arrays
function interleaveObj(obj) { // find all keys in the object var keys = Object.keys(obj); // find longest stored array var maxLen = keys.reduce(function(max, key) { if (obj[key].length > max) return obj[key].length; else return max; }, 0); var mergedData = []; // defined outside the loop to satisfy the linter var i = 0; var reduceFunc = function(accum, key) { accum[key] = obj[key][i]; return accum; }; // use maxLen (length of longest array in the object) for (; i < maxLen; i++) { // make new obj with fields for each name var mergedObj = keys.reduce(reduceFunc, {}); // add to the array of these objects mergedData.push(mergedObj); } return mergedData; }
[ "function interleave(array1, array2){\nvar combined = [];\n for (var i = 0; i < array1.length; i++) {\n combined.push(array1[i]);\n combined.push(array2[i]);\n }\nreturn combined;\n}", "function interleave(array1, array2) {\n let newArray = [];\n let arrayIndexLength = array1.length - 1;\n for (let i = 0; i <= arrayIndexLength; i++) {\n newArray.push(array1[i]);\n newArray.push(array2[i]);\n }\nreturn newArray;\n}", "function interleave(array1,array2){\n var b = [];\n for (var i = 0; i < array1.length; i++) {\n b.push(array1[i],array2[i]);\n }\n return b;\n}", "function interleave(array1, array2) {\n let result = [];\n result.length = array1.length * 2;\n result.fill(0);\n result.forEach((element, index, array) => {\n index % 2 === 0 ? array[index] = array1.shift() : array[index] = array2.shift();\n });\n return result;\n}", "function interleave(array1, array2) {\n let result = [];\n for (let index = 0; index < array1.length; index += 1) {\n result.push(array1[index], array2[index]);\n }\n\n return result;\n}", "function interleaveArrays(arr1, arr2) {\n let j = 1;\n let longer;\n let shorter;\n if (arr1 <= arr2) {\n longer = arr2;\n shorter = arr1;\n } else {\n longer = arr1;\n shorter = arr2;\n }\n for (var i = 0; i < shorter.length; i++) {\n longer.splice(j, 0, shorter[i]);\n j += 2;\n }\n return longer;\n}", "function interleaveArrays(attributes, arrays, count)\n {\n var stride = computeBufferStride(attributes);\n var buffer = new ArrayBuffer(stride * count);\n var viewOb = createBufferViews(buffer, attributes);\n var offset = viewOb.offsets;\n var sizes = viewOb.sizes;\n var views = viewOb.arrayViews;\n for (var i = 0; i < count; ++i) /* vertex */\n {\n for (var j = 0, n = attributes.length; j < n; ++j) /* attribute */\n {\n var ar = attributes[j];// select the vertex attribute record\n var sa = arrays[j]; // select the source data array\n var o = offset[j]; // offset of element in FLOAT, etc.\n var dv = views[j]; // view for element\n var vd = ar.dimension; // vector dimension\n var bi = i * vd; // base index of vertices[i] data\n for (var k = 0; k < vd; ++k)\n dv[o + k] = sa[bi + k];\n offset[j] += sizes[j]; // move to the next element in view\n }\n }\n return {\n buffer : buffer,\n view : resetBufferViews(viewOb)\n };\n }", "function interleave(left, right){\n var len = left.length + right.length\n , result = new Float32Array(len)\n , inputIndex = i = 0;\n while ( i < len ){\n result[i++] = left[inputIndex];\n result[i++] = right[inputIndex];\n inputIndex++;\n }\n return result;\n}", "interleaveVertices() {\n var interleavedData = interleaveVertexData(this.vertices);\n this.data = interleavedData[0];\n this.indices = interleavedData[1];\n this.dataCounts = interleavedData[2];\n }", "function interleave2( target, a1, a2 ) {\n var short = a1.length < a2.length ? a1 : a2;\n var long = a1.length < a2.length ? a2 : a1;\n for (var i = 0; i < short.length; i++) target.push(a1[i], a2[i]);\n for ( ; i < long.length; i++) target.push(long[i]);\n return target;\n}", "function interleave(list1, list2) {\n var until = Math.min(list1.length, list2.length);\n var accum = new Array(until * 2);\n\n for (var i = 0; i < until; i++) {\n accum[i * 2] = list1[i];\n accum[i * 2 + 1] = list2[i];\n }\n\n return accum;\n}", "function mergeArray(ary1, ary2) {\n\n}", "function combineArr(arr1, arr2) {\n\n}", "function mergeArraysJumbo(...sortedArrays) {\n // YOUR CODE HERE\n}", "function interleave() {\n var args = Array.prototype.slice.call(arguments, 0);\n while (true) {\n for (var i = 0; i < args.length; i++) {\n try {\n yield args[i].next();\n } catch (e if e instanceof StopIteration) {\n // this is fiddly, but is there a better way?\n args.splice(i, 1);\n if (0 == args.length) throw StopIteration;\n i -= 1;\n }\n }\n }\n}", "assureInterleaved_() {\n if (!this.isInterleaved) {\n this.interleave();\n }\n }", "function joinArrays(...args){\n return args.reduce((acc,next) => acc.concat(next), []);\n}", "function zipArrays(arr1, arr2) {\n var newObject = {};\n for (var x = 0; x < arr1.length; x++) {\n var key = arr1[x];\n var value = arr2[x];\n newObject[key] = value\n }\n return (newObject)\n}", "function joinArrays(...args){\n\n \n return args.reduce((acc, next)=> acc.concat(next)\n ,[])\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Destroys all tanks, putting them in the destroyed tanks pool for reuse
function destroyAllTanks() { for (var tankId in activeTanks) { if (activeTanks.hasOwnProperty(tankId)) { destroyTank(tankId); } } }
[ "_destroy() {\n const stack = [];\n if (this._root) {\n stack.push(this._root);\n }\n while (stack.length > 0) {\n const tile = stack.pop();\n\n for (const child of tile.children) {\n stack.push(child);\n }\n\n // TODO - Use this._destroyTile(tile); ?\n tile.destroy();\n }\n this._root = null;\n }", "_destroy() {\n const stack = [];\n if (this._root) {\n stack.push(this._root);\n }\n while (stack.length > 0) {\n for (const child of tile.children) {\n stack.push(child);\n }\n const tile = stack.pop();\n\n // TODO - Use this._destroyTile(tile); ?\n tile.destroy();\n }\n this._root = null;\n }", "function destroy() {\n pool_.length = 0;\n active = false;\n }", "_destroy() {\n const stack = [];\n\n if (this.root) {\n stack.push(this.root);\n }\n\n while (stack.length > 0) {\n const tile = stack.pop();\n\n for (const child of tile.children) {\n stack.push(child);\n }\n\n this._destroyTile(tile);\n }\n this.root = null;\n }", "emptyPool()\n {\n for (const i in this.pool)\n {\n const textures = this.pool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n\n this.pool = {};\n }", "destroyTiles(quadTrees) {\n let count = 0;\n for (let [url, tile] of this.available.entries()) {\n if (!quadTrees.has(url)) {\n this.removeChild(tile);\n tile.destroy(true);\n this.requested.delete(url);\n this.available.delete(url);\n count += 1;\n }\n }\n if (count && this.debug)\n console.log('destroyObsoleteTiles', this.level, count);\n }", "destroy() {\n this.mQueuePool[0].length = 0;\n this.mQueuePool[1].length = 0;\n this.mQueuePool.length = 0;\n }", "clear() {\n let that=this;\n for (let name in this._newedPools) {\n let p=this._newedPools[name]\n let pool = that.pools[name];\n delete that.pools[name];\n if (p.floating === true) {\n pool.$.parent().parent().parent().remove();\n } else {\n pool.$.remove();\n }\n p.layout.$.remove();\n pool.destroy();\n }\n this._newedPools = {};\n\n //TODO Do the same for tracks and pools (reset)\n for (let name in this.grids) {\n this.grids[name].reset();\n }\n }", "destroy() {\n this._destroyed = true;\n\n if (typeof this.freeFromPool === 'function') {\n this.freeFromPool();\n }\n\n if (this.currentMap) {\n this.currentMap.removeObject(this);\n } else if (this.currentScene) {\n this.currentScene.removeObject(this);\n }\n\n this.children.forEach((child) => {\n child.destroy();\n });\n }", "function destroyTank(tankId) {\n var tank = activeTanks[tankId];\n if (!tank) {\n return;\n }\n tank.setVisible(false);\n delete activeTanks[tankId];\n freeTanks[tankId] = tank;\n }", "emptyPool() {\n for (var i in this.texturePool) {\n var textures = this.texturePool[i];\n if (textures) {\n for (var j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n }\n this.texturePool = {};\n }", "purge() {\n for (let className in this.objectClass) {\n if (this.objectClass[className]) {\n this.objectClass[className].pool = [];\n }\n }\n this.instance_counter = 0;\n }", "removeAllSpawnables(){\n\n let currentSpawnables = this.spawnables.children;\n let amntCurrentSpawnables = currentSpawnables.entries.length;\n\n // done manually to as iterate will miss some blocks off\n for(var currentSpawnableNum = 0; currentSpawnableNum < amntCurrentSpawnables; currentSpawnableNum++){\n let currentSpawnable = currentSpawnables.get(currentSpawnableNum);\n currentSpawnable.destroy();\n }\n\n // duplicate the array instead of passing by reference\n availableBlocks = JSON.parse(JSON.stringify( levelBaseBlocks ));\n this.munchkinSpawner.currentMunchkins = 0;\n // add to the calculation of score\n MainGameScene.gameStats.addToCount(\"resets\");\n this.updateUI()\n }", "free (length) {\n const temp = this.pool.splice(this.pool.length - length, length)\n if (this.container) {\n this.detach(this.container, temp)\n }\n let i = temp.length\n while (i--) {\n temp[i].destroy()\n }\n return temp\n }", "destroy() {\n Object.keys(this.morphs).forEach((morph) => {\n this.morphs[morph].destroy();\n });\n this.morphs = {};\n Object.keys(this.nodeGroups).forEach((nodeGroup) => {\n this.nodeGroups[nodeGroup].destroy();\n });\n this.nodeGroups = {};\n Object.keys(this.linkGroups).forEach((linkGroup) => {\n this.linkGroups[linkGroup].destroy();\n });\n this.linkGroups = {};\n\n delete this.network.phases[this.label];\n }", "function cleanupMemory() {\n\ttimer.start(\"main.cleanupMemory()\");\n\t_.forEach(Memory.creeps, (m, c) => {\n\t\tif (Game.creeps[c] === undefined) {\n\t\t\tlet mem = Memory.creeps[c];\n\t\t\tif (mem !== undefined) {\n\t\t\t\tdelete Memory.creeps[c];\n\t\t\t}\n\t\t}\n\t});\n\ttimer.stop(\"main.cleanupMemory()\");\n}", "function clean(){\r\n\tfor(var name in Memory.creeps) {\r\n if(!Game.creeps[name]) {\r\n delete Memory.creeps[name];\r\n console.log('Clearing dead creep memory:', name);\r\n }\r\n }\r\n}", "static destroy() {\n Object.keys(this.workerSets).forEach(name => {\n this.workerSets[name].destroy();\n });\n this.workerSets = {};\n }", "cleanUpDucks() {\n for (let i = 0; i < this.ducks.length; i++) {\n this.removeChild(this.ducks[i]);\n }\n this.ducks = [];\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Centers the image on map
function centerMap() { var sets = $['mapsettings']; var $this = sets.element; var location = new Point(($this.innerWidth()/2)-(sets.resolutions[sets.zoom-1].width/2),($this.innerHeight()/2)-(sets.resolutions[sets.zoom-1].height/2)); setInnerDimentions(location); }
[ "center(){\r\n this.#map.fitBounds(this.#bounds);\r\n }", "function calculateCenter() {\n center = map.getCenter();\n }", "function centerMap() {\n getLocation()\n }", "CenterMap()\r\n\t{\r\n\t\tlet countiesXCenter = (this.countiesMax.x - this.countiesMin.x) / 2.0;\r\n\t\tlet countiesYCenter = (this.countiesMax.y - this.countiesMin.y) / 2.0;\r\n\r\n\t\tlet svgXCenter = (this.svgWidth) / 2.0;\r\n\t\tlet svgYCenter = (this.svgHeight) / 2.0;\r\n\r\n\t\tlet xTranslate = svgXCenter - this.countiesMin.x - countiesXCenter;\r\n\t\tlet yTranslate = svgYCenter - this.countiesMin.y - countiesYCenter;\r\n\r\n\t\tthis.mapGroup.attr(\"transform\", \"translate(\" + xTranslate + \",\" + yTranslate + \")\");\r\n\t\tthis.baseTranslation.x = xTranslate;\r\n\t\tthis.baseTranslation.y = yTranslate;\r\n\t}", "function centerMap() {\n map.flyToBounds([\n [45.7769477403, 6.02260949059],\n [47.8308275417, 10.4427014502]\n ]);\n}", "function calculateCenter(){\n center = map.getCenter();\n }", "function centerMap(){\n map.fitBounds(b);\n map.setZoom(z);\n }", "centerMap() {\n map.setCenter([31.900092, 27.318739])\n map.setZoom(4.5)\n }", "function centerMe(){\n\tcenterMapView(current_loc_x,current_loc_y,20);\n}", "function calculateCenter(){\n center = map.getCenter();\n}", "function centerMap() {\n \tmap.setCenter({\n \t\tlat: lat,\n \t\tlng: lng\n \t});\n \tmap.setZoom(17);\n }", "function centerMap() {\n\tvar point = map.getCenter();\n\n\t$('#aside__detail').hide();\n\teasingAnimator.easeProp({\n\t\tlat: point.lat(),\n\t\tlng: point.lng()\n\t}, center);\n\tmap.setZoom(NORMAL_ZOOM_DISTANCE);\n}", "function centerMap(){\n\tvar point = map.getCenter();\n\n\t$('#aside__detail').hide();\n\teasingAnimator.easeProp({\n\t\tlat: point.lat(),\n\t\tlng: point.lng()\n\t}, center);\n\tmap.setZoom(NORMAL_ZOOM_DISTANCE);\n}", "function centerOnUnlockedTiles() {\n var centerPoint = [0, 0];\n for (var i = 0; i < unlockedChunks.length; i++) {\n // Sum all unlocked chunk center points, then divide by the number of unlocked chunks\n var chunkPoint = getChunkCenterPoint(unlockedChunks[i]);\n centerPoint[0] += chunkPoint[0];\n centerPoint[1] += chunkPoint[1];\n }\n centerPoint[0] /= unlockedChunks.length;\n centerPoint[1] /= unlockedChunks.length;\n\n repositionMapOnPoint(document.getElementById(\"imgDiv\"), centerPoint[0], centerPoint[1]);\n\n fixMapEdges(document.getElementById(\"imgDiv\"));\n}", "function mapCenter (){\n if (window.innerWidth > 600) {return [40, -125]}\n else {return [40, -98]}\n }", "function centerMap() {\n // Get the map bounds from the config. \n var bounds = {'sw-lat': undefined, 'sw-lng': undefined, 'ne-lat': undefined, 'ne-lng': undefined};\n\n for (var prop in bounds) {\n // Load in the values, mins, max, and steps.\n DIModule.getConfigVal(prop, function(value, meta, errStr) {\n if (errStr) {\n GUI.log('[Map] Internal Error: ' + errStr, 2);\n } \n\n bounds[prop] = value;\n });\n }\n\n // Get the frame.\n var frame = document.getElementById('map');\n \n var gBounds = googleBounds(bounds); \n\n GUI.log('[Map] Centering map with OSM bounds.');\n\n // Construct a message to send to the iframe.\n var message = {\n type: 'center',\n bounds: gBounds\n };\n \n // Flag the frame a loading. \n isLoading = true;\n \n // Display the data loading screen.\n $('#cache .data-loading').clone().appendTo($('.content_wrapper'));\n \n // Hide the frame.\n frame.style.visibility = 'hidden';\n \n // Post the file content to the frame.\n frame.contentWindow.postMessage(message, '*');\n }", "function setCenter() {\n\t\t// Google.v3 uses EPSG:900913 as projection, so we have to\n\t\t// transform our coordinates\n\t\tmap.setCenter( getTransform(longitude, latitude), zoomLevel);\t\t\n\t\treturn;\n\t}", "function centreMap() {\n\t\t var widget_data = $this.data(WIDGET_NS);\n\t\t if (widget_data.polygon !== null) {\n\t\t\tvar bounds = new google.maps.LatLngBounds();\n\t\t\tvar i;\n\n\t\t\t// The Bermuda Triangle\n\t\t\tvar polygonCoords = widget_data.polygon.getPath().getArray();\n\t\t\tfor (i = 0; i < polygonCoords.length; i++) {\n\t\t\t bounds.extend(polygonCoords[i]);\n\t\t\t}\n\t\t\t//resetZoom();//google map api bug fix\n\t\t\twidget_data.map.fitBounds(bounds);\n\t\t }\n\n\t\t // Check for a marker to centre on.\n\t\t if (widget_data.marker !== null && settings.jumpToPoint) {\n\t\t\twidget_data.map.setCenter(widget_data.marker.getPosition());\n\t\t }\n\t\t $this.data(WIDGET_NS, widget_data);\n\t\t}", "function centerlivemap() {\r\n\r\n\tvar havemarkers = false;\r\n\r\n\t//Go through units\r\n\tfor (unit in unitinfo) {\r\n\r\n\t\t//If unit marker is currently hidden or is shown but has has moved\r\n\t\tif (unitinfo[unit][\"marker\"] != undefined) {\r\n\t\t\thavemarkers = true;\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t//If there are markers\r\n\tif (havemarkers) {\r\n\t\t//Auto center and zoom on markers\r\n\t\tmapstraction.autoCenterAndZoom();\r\n\t\t\r\n\t}\r\n\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If there is no state change before the timeout, invoke resolve otherwise reject.
then(resolve, reject) { this.resetState(); this.reject = reject; this.state = setTimeout(() => { try { resolve(); } catch (error) { this.onError(error); } }, this.timeout); }
[ "resolve(value) {\n if (this.state !== DeferredState.PENDING)\n throw new Error(`cannot resolve ${DeferredState[this.state].toLowerCase()}`);\n this._resolve(value);\n this._state = DeferredState.RESOLVED;\n }", "function waitForFoo(resolve, reject) {\n if (done)\n resolve(done);\n else if (timeout && (Date.now() - start) >= timeout)\n reject(new Error(\"timeout\"));\n else\n setTimeout(waitForFoo.bind(this, resolve, reject), 30);\n }", "function WaitForState(query) {\r\n var dfd = $.Deferred();\r\n window.setTimeout(function() {AttemptResolve(query, dfd);}, delay.Short); // Doesn't work without a short delay\r\n return dfd;\r\n }", "function checkCancelledThenResolve() {\n if (!timerPromiseCancel.isCancelled()) {\n resolve();\n }\n }", "thenWithState(onResolve = function(r) { return r }, onReject = function(e) { throw e }) { return new StatefulPromise(this.then(onResolve, onReject)); }", "pollForResolution(callback) {\n var _this = this;\n var timer = setInterval(function() {\n if ( _this.actionResolved ) {\n callback();\n clearTimeout(timer);\n }\n }, 500);\n }", "function clearTimerAndResolve() {\n _window().clearTimeout(networkErrorTimer);\n\n resolve(iframe);\n } // This returns an IThenable. However the reject part does not call", "function resolve(val) {\n if (val instanceof Promiseee) {\n return val.then(resolve, reject)\n }\n if (self.state === STATE.PENDING) {\n asyncFun(() => {\n self.state = STATE.RESOLVED\n self.value = val\n for (let cb of self.onResolvedCallback) {\n cb(val)\n }\n })\n }\n }", "resolve() {\n if (this.resolver) {\n this.resolver(this.aggregateResponse(this.results));\n }\n if (this.timeoutTimer) {\n clearTimeout(this.timeoutTimer);\n }\n }", "function resolve() {\n\t\t\t\t\t// Our promise is either resolved or rejected by the hubs response.\n\t\t\t\t\tself.proxy.invoke.apply(self.proxy, args).then(deferred.resolve, deferred.reject);\n\t\t\t\t}", "function executor(resolve, reject) {\n setTimeout(() => {\n reject(\"Failed\");\n }, 1000);\n }", "function willBeCalledLater() {\n resolve(value)\n }", "function resolve( data ){\n\t\tif( isLocked ) return;\n\t\tsetState( true );\n\t\t//Update the data and lock if Immutable\n\t\tsetData( data, isImmutable );\n\t\trunCallbacks( 'resolve' );\n\t\treturn self;\n\t}", "function handle(onResolved) {\n if(state === 'pending') {\n // set deferred if .then runs first! \n // because resolve is the only one that can change state\n deferred = onResolved;\n return;\n }\n //only runs if resolve already worked!\n // but who garantees that fn is going to run first?\n // value set in resolve\n onResolved(value);\n }", "function resolve(value) {\n\t\t\treturn when.resolve(value);\n\t\t}", "runTimeout() {\n\n if (this.props.timeout) {\n setTimeout(() => {\n\n // If this.onInit has been previously resolved, this won't have any effect.\n\n let error = new Error(`[${this.component.tag}] Loading component ${this.component.tag} timed out after ${this.props.timeout} milliseconds`);\n\n this.onInit.reject(error).catch(err => {\n return this.props.onTimeout(err).finally(() => {\n this.component.log(`timed_out`, { timeout: this.props.timeout });\n });\n });\n\n }, this.props.timeout);\n }\n }", "function resolve() {\n\t var deferred = this,\n\t clone = deferred.benchmark,\n\t bench = clone._original;\n\n\t if (bench.aborted) {\n\t // cycle() -> clone cycle/complete event -> compute()'s invoked bench.run() cycle/complete.\n\t deferred.teardown();\n\t clone.running = false;\n\t cycle(deferred);\n\t }\n\t else if (++deferred.cycles < clone.count) {\n\t clone.compiled.call(deferred, context, timer);\n\t }\n\t else {\n\t timer.stop(deferred);\n\t deferred.teardown();\n\t delay(clone, function() { cycle(deferred); });\n\t }\n\t }", "function resolveEvent(data) {\n return resolve(data);\n }", "function resolve(value) { return Promise.resolve(value); }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get scope.hours in 24H mode if valid
function getScopeHours ( ) { var hours = parseInt( scope.hours, 10 ); var valid = ( scope.showMeridian ) ? (hours > 0 && hours < 13) : (hours >= 0 && hours < 24); if ( !valid ) { return; } if ( scope.showMeridian ) { if ( hours === 12 ) { hours = 0; } if ( scope.meridian === meridians[1] ) { hours = hours + 12; } } return hours; }
[ "function getHoursFromTemplate() {\n\t var hours = +$scope.hours;\n\t var valid = $scope.showMeridian ? hours > 0 && hours < 13 :\n\t hours >= 0 && hours < 24;\n\t if (!valid || $scope.hours === '') {\n\t return undefined;\n\t }\n\n\t if ($scope.showMeridian) {\n\t if (hours === 12) {\n\t hours = 0;\n\t }\n\t if ($scope.meridian === meridians[1]) {\n\t hours = hours + 12;\n\t }\n\t }\n\t return hours;\n\t }", "function getHoursFromTemplate() {\n var hours = parseInt(scope.hours, 10);\n var valid = (\n scope.showMeridian\n ) ? (\n hours > 0 && hours < 13\n ) : (\n hours >= 0 && hours < 24\n );\n if (!valid) {\n return undefined;\n }\n\n if (scope.showMeridian) {\n if (hours === 12) {\n hours = 0;\n }\n if (scope.meridian === meridians[1]) {\n hours = hours + 12;\n }\n }\n return hours;\n }", "function getHoursFromTemplate(){var hours=parseInt($scope.hours,10);var valid=$scope.showMeridian?hours > 0 && hours < 13:hours >= 0 && hours < 24;if(!valid){return undefined;}if($scope.showMeridian){if(hours === 12){hours = 0;}if($scope.meridian === meridians[1]){hours = hours + 12;}}return hours;}", "function getHoursFromTemplate() {\n var hours = +$scope.hours;\n var valid = $scope.showMeridian ? hours > 0 && hours < 13 :\n hours >= 0 && hours < 24;\n if (!valid || $scope.hours === '') {\n return undefined;\n }\n\n if ($scope.showMeridian) {\n if (hours === 12) {\n hours = 0;\n }\n if ($scope.meridian === meridians[1]) {\n hours = hours + 12;\n }\n }\n return hours;\n }", "function getHoursFromTemplate() {\r\n var hours = parseInt($scope.hours, 10);\r\n var valid = $scope.showMeridian ? hours > 0 && hours < 13 : hours >= 0 && hours < 24;\r\n if (!valid) {\r\n return undefined;\r\n }\r\n\r\n if ($scope.showMeridian) {\r\n if (hours === 12) {\r\n hours = 0;\r\n }\r\n if ($scope.meridian === meridians[1]) {\r\n hours = hours + 12;\r\n }\r\n }\r\n return hours;\r\n }", "get displayHours24() {\n return Math.floor(this.displayTime / SECONDS_IN_HOUR) % HOURS_IN_DAY;\n }", "get hours() {\n return this.moment.hours();\n }", "function onlyHours($this, opts) {\n var id = $this.attr('id');\n if (window['minutes_H' + id] == opts.minutes && window['seconds_H' + id] == opts.seconds && window['hours_H' + id] == opts.hours) {\n if (window['hours_H' + id].toString().length < 2) {\n window['hours_H' + id] = \"0\" + window['hours_H' + id];\n }\n html($this, window['hours_H' + id] + opts.timeSeparator + \"00\" + opts.timeSeparator + \"00\");\n\t\t\tif(typeof window['beforeExpiryHours_' + id] !== 'undefined' && window['beforeExpiryHours_' + id] == window['hours_H' + id]) {\n\t\t\t\tbeforeExpiryTime($this, opts);\n\t\t\t}\n window['seconds_H' + id] = 60 - opts.tickInterval;\n window['minutes_H' + id] = 59;\n if (window['hours_H' + id] != 0) {\n window['hours_H' + id]--;\n } else {\n delete window['hours_H' + id];\n delete window['minutes_H' + id];\n delete window['seconds_H' + id];\n clearInterval(window['timer_H' + id]);\n timeUp($this, opts);\n }\n } else {\n if (window['hours_H' + id].toString().length < 2) {\n window['hours_H' + id] = \"0\" + window['hours_H' + id];\n }\n if (window['minutes_H' + id].toString().length < 2) {\n window['minutes_H' + id] = \"0\" + window['minutes_H' + id];\n }\n if (window['seconds_H' + id].toString().length < 2) {\n window['seconds_H' + id] = \"0\" + window['seconds_H' + id];\n }\n html($this, window['hours_H' + id] + opts.timeSeparator + window['minutes_H' + id] + opts.timeSeparator + window['seconds_H' + id]);\n\t\t\tif(((typeof window['beforeExpiryHours_' + id] !== 'undefined' && window['beforeExpiryHours_' + id] == window['hours_H' + id]) && (typeof window['beforeExpiryMinutes_' + id] !== 'undefined' && window['beforeExpiryMinutes_' + id] == window['minutes_H' + id]) && (typeof window['beforeExpirySeconds_' + id] !== 'undefined' && window['beforeExpirySeconds_' + id] == window['seconds_H' + id])) || ((typeof window['beforeExpiryHours_' + id] !== 'undefined' && window['beforeExpiryHours_' + id] == window['hours_H' + id]) && (typeof window['beforeExpiryMinutes_' + id] !== 'undefined' && window['beforeExpiryMinutes_' + id] == window['minutes_H' + id]) && (typeof window['beforeExpirySeconds_' + id] === 'undefined' && window['seconds_H' + id] == \"00\")) || ((typeof window['beforeExpiryHours_' + id] === 'undefined' && window['hours_H' + id] == \"00\") && (typeof window['beforeExpiryMinutes_' + id] !== 'undefined' && window['beforeExpiryMinutes_' + id] == window['minutes_H' + id]) && (typeof window['beforeExpirySeconds_' + id] !== 'undefined' && window['beforeExpirySeconds_' + id] == window['seconds_H' + id])) || ((typeof window['beforeExpiryHours_' + id] !== 'undefined' && window['beforeExpiryHours_' + id] == window['hours_H' + id]) && (typeof window['beforeExpiryMinutes_' + id] === 'undefined' && window['minutes_H' + id] == \"00\") && (typeof window['beforeExpirySeconds_' + id] !== 'undefined' && window['beforeExpirySeconds_' + id] == window['seconds_H' + id])) || ((typeof window['beforeExpiryHours_' + id] !== 'undefined' && window['beforeExpiryHours_' + id] == window['hours_H' + id]) && (typeof window['beforeExpiryMinutes_' + id] === 'undefined' && window['minutes_H' + id] == \"00\") && (typeof window['beforeExpirySeconds_' + id] === 'undefined' && window['seconds_H' + id] == \"00\")) || ((typeof window['beforeExpiryHours_' + id] === 'undefined' && window['hours_H' + id] == \"00\") && (typeof window['beforeExpiryMinutes_' + id] !== 'undefined' && window['beforeExpiryMinutes_' + id] == window['minutes_H' + id]) && (typeof window['beforeExpirySeconds_' + id] === 'undefined' && window['seconds_H' + id] == \"00\")) || ((typeof window['beforeExpiryHours_' + id] === 'undefined' && window['hours_H' + id] == \"00\") && (typeof window['beforeExpiryMinutes_' + id] === 'undefined' && window['minutes_H' + id] == \"00\") && (typeof window['beforeExpirySeconds_' + id] !== 'undefined' && window['beforeExpirySeconds_' + id] == window['seconds_H' + id]))) {\n\t\t\t\tbeforeExpiryTime($this, opts);\n\t\t\t}\n window['seconds_H' + id] -= opts.tickInterval;\n if (window['minutes_H' + id] != 0 && window['seconds_H' + id] < 0) {\n window['minutes_H' + id]--;\n window['seconds_H' + id] = 60 - opts.tickInterval;\n }\n if (window['minutes_H' + id] == 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] != 0)\n {\n window['hours_H' + id]--;\n window['minutes_H' + id] = 59;\n window['seconds_H' + id] = 60 - opts.tickInterval;\n }\n if (window['minutes_H' + id] == 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] == 0)\n {\n delete window['hours_H' + id];\n delete window['minutes_H' + id];\n delete window['seconds_H' + id];\n clearInterval(window['timer_H' + id]);\n timeUp($this, opts);\n }\n }\n id = null;\n }", "get hours() {\n return Math.floor(this.currentTime / SECONDS_IN_HOUR) % HOURS_IN_DAY;\n }", "get currentHour(){\n //returning in the format 01 - 24 \n return this._moment.format(`HH`); \n }", "function onlyHours($this, opts) {\n var id = $this.attr('id');\n var time = \"\";\n if (window['minutes_H' + id] === opts.minutes && window['seconds_H' + id] === opts.seconds && window['hours_H' + id] === opts.hours) {\n time = prepareTime($this, opts, 0, 0, 0, window['hours_H' + id], 0, 0);\n html($this, time, opts);\n if (typeof window['beforeExpiry_H' + id] !== 'undefined') {\n beforeExpiryTime($this, opts, time, 'H');\n }\n window['seconds_H' + id] = 60 - opts.tickInterval;\n window['minutes_H' + id] = 59;\n if (window['hours_H' + id] !== 0) {\n window['hours_H' + id]--;\n } else {\n clearTimerInterval($this, \"H\", opts);\n }\n if ($this.data('countdowntimer').destroy === true) clearTimerInterval($this, \"H\", opts);\n } else {\n time = prepareTime($this, opts, 0, 0, 0, window['hours_H' + id], window['minutes_H' + id], window['seconds_H' + id]);\n html($this, time, opts);\n if (typeof window['beforeExpiry_H' + id] !== 'undefined') {\n beforeExpiryTime($this, opts, time, 'H');\n }\n window['seconds_H' + id] -= opts.tickInterval;\n if (window['minutes_H' + id] !== 0 && window['seconds_H' + id] < 0) {\n window['minutes_H' + id]--;\n window['seconds_H' + id] = 60 - opts.tickInterval;\n }\n if (window['minutes_H' + id] === 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] !== 0) {\n window['hours_H' + id]--;\n window['minutes_H' + id] = 59;\n window['seconds_H' + id] = 60 - opts.tickInterval;\n }\n if ((window['minutes_H' + id] === 0 && window['seconds_H' + id] < 0 && window['hours_H' + id] === 0) || $this.data('countdowntimer').destroy === true) {\n clearTimerInterval($this, \"H\", opts);\n }\n }\n id = null;\n }", "hours(value){\n if(!value) return Util.padstr(this._hours);\n\n if(value === this._hours) return this;\n\n if(! /^[0-1][0-9]|2[0-4]$/.test(value)) throw new Error(`Invalid input \"${value}\" for hours.`);\n this._hours = value;\n\n return this.reset();\n }", "static is24Hr(format) {\n let ret = false;\n if (format === 2 /* HR_24 */) {\n ret = true;\n }\n return ret;\n }", "get hourFormat() {\n\t\treturn this.nativeElement ? this.nativeElement.hourFormat : undefined;\n\t}", "getHourLocalTime() {}", "isHH() {\n\t\tlet day = Utils.getWeekday();\n\t\tlet hHDay = this.happyHourTime[day];\n\t\t//If we don't have the opening time for the current day\n\t\tif (!hHDay) {\n\t\t\treturn false;\n\t\t}\n\t\tlet current = new Date(Utils.getTimeFromHourMinuteSeconde());\n\t\t//current = current.toISOString();\n\t\treturn Utils.isDateIncluded(current, hHDay.start, hHDay.end)\n\t}", "get Hour() {\n return this._hours;\n }", "function getHours() {\n return tehDate.getHours();\n }", "setUpHours() {\n this._.each(this.vendor.hours, (day) => {\n //handle no open or close times\n if(!day || !day.opening_time || !day.closing_time) {\n day.open = new Date();\n day.close = new Date();\n day.closed = true;\n return;\n }\n // create js time object from string\n let openPeriod = day && day.opening_time && day.opening_time.split(':')[1].slice(2, 4),\n closePeriod = day.closing_time.split(':')[1].slice(2, 4),\n openHour = (openPeriod.toLowerCase() === 'pm') ? Number(day.opening_time.split(':')[0]) + 12 : day.opening_time.split(':')[0],\n openMinutes = day.opening_time.split(':')[1].slice(0, 2),\n closeHour = (closePeriod.toLowerCase() === 'pm') ? Number(day.closing_time.split(':')[0]) + 12 : day.closing_time.split(':')[0],\n closeMinutes = day.closing_time.split(':')[1].slice(0, 2),\n open = new Date(),\n close = new Date();\n //set time\n open.setHours(openHour);\n close.setHours(closeHour);\n\n open.setMinutes(openMinutes);\n close.setMinutes(closeMinutes);\n //set open close times for ui\n day.open = open;\n day.close = close;\n\n }, this);\n return this.vendor.hours;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accumulate data in the 'incoming' region into 'accu'
accumulate( accuIndex, weight ) { // note: happily accumulating nothing when weight = 0, the caller knows // the weight and shouldn't have made the call in the first place const buffer = this.buffer, stride = this.valueSize, offset = accuIndex * stride + stride; let currentWeight = this.cumulativeWeight; if ( currentWeight === 0 ) { // accuN := incoming * weight for ( let i = 0; i !== stride; ++ i ) { buffer[ offset + i ] = buffer[ i ]; } currentWeight = weight; } else { // accuN := accuN + incoming * weight currentWeight += weight; const mix = weight / currentWeight; this._mixBufferRegion( buffer, offset, 0, mix, stride ); } this.cumulativeWeight = currentWeight; }
[ "accumulate(accuIndex,weight){// note: happily accumulating nothing when weight = 0, the caller knows\n// the weight and shouldn't have made the call in the first place\nconst buffer=this.buffer,stride=this.valueSize,offset=accuIndex*stride+stride;let currentWeight=this.cumulativeWeight;if(currentWeight===0){// accuN := incoming * weight\nfor(let i=0;i!==stride;++i){buffer[offset+i]=buffer[i];}currentWeight=weight;}else{// accuN := accuN + incoming * weight\ncurrentWeight+=weight;const mix=weight/currentWeight;this._mixBufferRegion(buffer,offset,0,mix,stride);}this.cumulativeWeight=currentWeight;}", "accumulate(accuIndex, weight) {\n // note: happily accumulating nothing when weight = 0, the caller knows\n // the weight and shouldn't have made the call in the first place\n const buffer = this.buffer,\n stride = this.valueSize,\n offset = accuIndex * stride + stride;\n let currentWeight = this.cumulativeWeight;\n\n if (currentWeight === 0) {\n // accuN := incoming * weight\n for (let i = 0; i !== stride; ++i) {\n buffer[offset + i] = buffer[i];\n }\n\n currentWeight = weight;\n } else {\n // accuN := accuN + incoming * weight\n currentWeight += weight;\n const mix = weight / currentWeight;\n\n this._mixBufferRegion(buffer, offset, 0, mix, stride);\n }\n\n this.cumulativeWeight = currentWeight;\n }", "accumulate(accuIndex, weight) {\n\t\t\t// note: happily accumulating nothing when weight = 0, the caller knows\n\t\t\t// the weight and shouldn't have made the call in the first place\n\t\t\tconst buffer = this.buffer,\n\t\t\t\t\t\tstride = this.valueSize,\n\t\t\t\t\t\toffset = accuIndex * stride + stride;\n\t\t\tlet currentWeight = this.cumulativeWeight;\n\n\t\t\tif (currentWeight === 0) {\n\t\t\t\t// accuN := incoming * weight\n\t\t\t\tfor (let i = 0; i !== stride; ++i) {\n\t\t\t\t\tbuffer[offset + i] = buffer[i];\n\t\t\t\t}\n\n\t\t\t\tcurrentWeight = weight;\n\t\t\t} else {\n\t\t\t\t// accuN := accuN + incoming * weight\n\t\t\t\tcurrentWeight += weight;\n\t\t\t\tconst mix = weight / currentWeight;\n\n\t\t\t\tthis._mixBufferRegion(buffer, offset, 0, mix, stride);\n\t\t\t}\n\n\t\t\tthis.cumulativeWeight = currentWeight;\n\t\t}", "accumulateAdditive(weight){const buffer=this.buffer,stride=this.valueSize,offset=stride*this._addIndex;if(this.cumulativeWeightAdditive===0){// add = identity\nthis._setIdentity();}// add := add + incoming * weight\nthis._mixBufferRegionAdditive(buffer,offset,0,weight,stride);this.cumulativeWeightAdditive+=weight;}", "apply(accuIndex) {\n const stride = this.valueSize,\n buffer = this.buffer,\n offset = accuIndex * stride + stride,\n weight = this.cumulativeWeight,\n weightAdditive = this.cumulativeWeightAdditive,\n binding = this.binding;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n\n if (weight < 1) {\n // accuN := accuN + original * ( 1 - cumulativeWeight )\n const originalValueOffset = stride * this._origIndex;\n\n this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n }\n\n if (weightAdditive > 0) {\n // accuN := accuN + additive accuN\n this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n }\n\n for (let i = stride, e = stride + stride; i !== e; ++i) {\n if (buffer[i] !== buffer[i + stride]) {\n // value has changed -> update scene graph\n binding.setValue(buffer, offset);\n break;\n }\n }\n }", "apply(accuIndex) {\n const stride = this.valueSize, buffer = this.buffer, offset = accuIndex * stride + stride, weight = this.cumulativeWeight, weightAdditive = this.cumulativeWeightAdditive, binding = this.binding;\n this.cumulativeWeight = 0;\n this.cumulativeWeightAdditive = 0;\n if (weight < 1) {\n // accuN := accuN + original * ( 1 - cumulativeWeight )\n const originalValueOffset = stride * this._origIndex;\n this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n }\n if (weightAdditive > 0) // accuN := accuN + additive accuN\n this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n for(let i = stride, e = stride + stride; i !== e; ++i)if (buffer[i] !== buffer[i + stride]) {\n // value has changed -> update scene graph\n binding.setValue(buffer, offset);\n break;\n }\n }", "function onEnd() {\n\t\t\tstream.emit( 'data', accumulator );\n\t\t\tstream.emit( 'end' );\n\t\t}", "function accumulate(row){\n\n // I expect one row at a time, unlike the vds/wim case\n var tkey // nonsensical for AADT, at this time, just the year\n tkey = row.year_record\n\n // eventually, I'm thinking peak or off peak.\n // but these are not defined in the data and have to be\n // estimated from the surrounding VDS/WIM sites.\n // which is a different exercise\n //\n check_tkey(tkey)\n var fkey\n // in the vds/wim case, this is the freeway. Here I am going to use the\n // roadway class. If it is a freeway I'll append the route name too\n fkey = row.f_system\n if((/shwy/i).test(row.locality) ){\n // have a highway, not a road\n fkey += '_'+row.route_number\n }\n check_fkey(tkey,fkey,_.size(vo))\n\n // slot the vo variables here, for processing elsewhere\n _.each(vo,\n function(val,key){\n row[key]=null\n });\n // some are not null\n row.n=row.aadt\n row.count_al_veh_speed=row.aadt\n row.wgt_spd_all_veh_speed=row.speed_limit\n row.heavyheavy=row.aadt*row.avg_combination\n row.not_heavyheavy=row.aadt*row.avg_single_unit\n row.hh_speed=row.speed_limit\n row.nhh_speed=row.speed_limit\n\n row.imputations=null\n\n coucher.stash(row,tkey)\n\n\n process_collated_record(tkey,fkey)(row)\n\n\n // _stash[tkey][fkey].detectors.sort();\n // _stash[tkey][fkey].detectors = _.uniq(_stash[tkey][fkey].detectors,true)\n\n }", "apply(accuIndex) {\n\t\t\tconst stride = this.valueSize,\n\t\t\t\t\t\tbuffer = this.buffer,\n\t\t\t\t\t\toffset = accuIndex * stride + stride,\n\t\t\t\t\t\tweight = this.cumulativeWeight,\n\t\t\t\t\t\tweightAdditive = this.cumulativeWeightAdditive,\n\t\t\t\t\t\tbinding = this.binding;\n\t\t\tthis.cumulativeWeight = 0;\n\t\t\tthis.cumulativeWeightAdditive = 0;\n\n\t\t\tif (weight < 1) {\n\t\t\t\t// accuN := accuN + original * ( 1 - cumulativeWeight )\n\t\t\t\tconst originalValueOffset = stride * this._origIndex;\n\n\t\t\t\tthis._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride);\n\t\t\t}\n\n\t\t\tif (weightAdditive > 0) {\n\t\t\t\t// accuN := accuN + additive accuN\n\t\t\t\tthis._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride);\n\t\t\t}\n\n\t\t\tfor (let i = stride, e = stride + stride; i !== e; ++i) {\n\t\t\t\tif (buffer[i] !== buffer[i + stride]) {\n\t\t\t\t\t// value has changed -> update scene graph\n\t\t\t\t\tbinding.setValue(buffer, offset);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "accumulateAdditive(weight) {\n\t\t\tconst buffer = this.buffer,\n\t\t\t\t\t\tstride = this.valueSize,\n\t\t\t\t\t\toffset = stride * this._addIndex;\n\n\t\t\tif (this.cumulativeWeightAdditive === 0) {\n\t\t\t\t// add = identity\n\t\t\t\tthis._setIdentity();\n\t\t\t} // add := add + incoming * weight\n\n\n\t\t\tthis._mixBufferRegionAdditive(buffer, offset, 0, weight, stride);\n\n\t\t\tthis.cumulativeWeightAdditive += weight;\n\t\t}", "accumulateGradients() {\n _.forEach(this.incoming, connection => connection.accumulate())\n }", "function accumulativeData(data) {\n var total = 0;\n\n for (var i = 0; i < data.length; i++) {\n total = data[i][1] + total;\n data[i][1] = total;\n }\n\n return data\n }", "function autocorrelate(data) {\n var sums = new Array(BUFFER_LEN);\n var i, j;\n for (i = 0; i < BUFFER_LEN; i++) {\n sums[i] = 0;\n for (j = 0; j < BUFFER_LEN - i; j++) {\n sums[i] += data[j] * data[j+i];\n }\n }\n return sums;\n }", "static _enqueue_aggregate(buffer_in, buffer_out, count, aggregation_factor) {\n buffer_out.set(buffer_out.subarray(count));\n for (let i = buffer_out.length - count, offset_in = 0; i < buffer_out.length; i++, offset_in += aggregation_factor) {\n buffer_out[i] = buffer_in[offset_in];\n }\n }", "async function processAllFiles() {\n let file;\n while ((file = await inbox.pop())) {\n var data = await file.arrayBuffer();\n //console.log(`File name: ${file.name} (Size: ${file.length} bytes)`);\n \n let rawData = new Array();\n let totalRecords = file.length/(recSize*batchSize);\n for (let i = 0; i<totalRecords; i++) {\n let recordData = new Array();\n for (let j = 0; j<batchSize; j++) {\n let accX = data.slice((0*batchSize)+(j*2)+(i*recSize*batchSize),(0*batchSize)+2+(j*2)+(i*recSize*batchSize));\n let accY = data.slice((2*batchSize)+(j*2)+(i*recSize*batchSize),(2*batchSize)+2+(j*2)+(i*recSize*batchSize));\n let accZ = data.slice((4*batchSize)+(j*2)+(i*recSize*batchSize),(4*batchSize)+2+(j*2)+(i*recSize*batchSize));\n\n let gyrX = data.slice((6*batchSize)+(j*2)+(i*recSize*batchSize),(6*batchSize)+2+(j*2)+(i*recSize*batchSize));\n let gyrY = data.slice((8*batchSize)+(j*2)+(i*recSize*batchSize),(8*batchSize)+2+(j*2)+(i*recSize*batchSize));\n let gyrZ = data.slice((10*batchSize)+(j*2)+(i*recSize*batchSize),(10*batchSize)+2+(j*2)+(i*recSize*batchSize));\n \n let actType = data.slice((12*batchSize)+(j*1)+(i*recSize*batchSize),(12*batchSize)+1+(j*1)+(i*recSize*batchSize));\n\n let uintAccelX = new Uint16Array(new Uint8Array(accX).buffer)[0];\n let uintAccelY = new Uint16Array(new Uint8Array(accY).buffer)[0];\n let uintAccelZ = new Uint16Array(new Uint8Array(accZ).buffer)[0];\n\n let uintGyroX = new Uint16Array(new Uint8Array(gyrX).buffer)[0];\n let uintGyroY = new Uint16Array(new Uint8Array(gyrY).buffer)[0];\n let uintGyroZ = new Uint16Array(new Uint8Array(gyrZ).buffer)[0];\n\n let accelX = util.uInt16ToFloat(uintAccelX);\n let accelY = util.uInt16ToFloat(uintAccelY);\n let accelZ = util.uInt16ToFloat(uintAccelZ);\n\n let gyroX = util.uInt16ToFloat(uintGyroX);\n let gyroY = util.uInt16ToFloat(uintGyroY);\n let gyroZ = util.uInt16ToFloat(uintGyroZ);\n\n let activityType = new Uint8Array(actType)[0];\n recordData = recordData.concat([[[activityType],[accelX],[accelY],[accelZ],[gyroX],[gyroY],[gyroZ]]]);\n }\n rawData = rawData.concat([recordData]);\n }\n // Upload the received records to a server\n util.uploadDataToServer(rawData);\n }\n\n}", "function accumulate(upToTime) {\n if (lastIntegrandVal !== undefined) {\n sum += (upToTime - lastTime)*lastIntegrandVal;\n }\n lastTime = upToTime;\n lastIntegrandVal = integrand.value;\n }", "function autocorrelate(data) {\n var sums = new Array(BUFFER_LEN);\n var i, j;\n for (i = 0; i < BUFFER_LEN; i++) {\n sums[i] = 0;\n for (j = 0; j < BUFFER_LEN - i; j++) {\n sums[i] += data[j] * data[j + i];\n }\n }\n return sums;\n }", "function accumulate(seq) {\n let result = [];\n for(let i = 0; i < seq.length; i++) {\n for(let j = 0; j < seq[i].length; j++) {\n if(i === 0) result.push(seq[i][j].y);\n else result[j] += seq[i][j].y;\n }\n }\n return result;\n }", "addCompensation(payload) {\n const agents = this.agents.values()\n for (const agent of agents) {\n agent.balance += payload\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
method to reset work loop to a fiber of given component
function resetLoopToComponentsFiber(fiber) { const { root, nodeInstance } = fiber; // mark component as dirty, so it can be rendered again nodeInstance[BRAHMOS_DATA_KEY].isDirty = true; // set the alternate fiber as retry fiber, as root.retryFiber = fiber; }
[ "reset() {\n let loop;\n for( let i = 0; i < this.loops.i; i++ ){\n for( let j = 0; j < this.loops.j; j++ ){\n loop = this.loops.mat[i][j];\n if( loop !== undefined ){\n // remove loop\n this.e.scheduler.remove(loop);\n // disable renderer\n this.e.renderer.disable();\n }\n }\n }\n this.loops.clear(); // clear set\n }", "reset() {\n this.cpu.reset();\n this.currentState = this.ProcessorStates.fetch;\n }", "function reset(){\n setInitialCondition(compute,renderer);\n}", "Reset() {\n this.DisableBarrier();\n this.ResetParticles();\n this.EnableBarrier();\n }", "function resetWorkers() {\n\t\n\t// Look at each worker\n\tfor (var i = 0; i < workers.length; i++) {\n\t\t\n\t\t// Reset location and path location\n\t\tworkers[i].location = workers[i].path[0];\n\t\tworkers[i].currentPathLocation = 0;\n\t\tworkers[i].direction = 1;\n\t\t\n\t}\n\t\n}", "function resetWorker() {\r\n\tMESSAGE_BUFFER = \"\";\r\n\tCOUNT = 0;\r\n\tif(typeof INTERVAL_ID !== \"undefined\") {\r\n\t\tclearInterval(INTERVAL_ID);\r\n\t\tINTERVAL_ID = undefined;\r\n\t}\r\n}", "function resetLoopIndex(){\nindexLoop = 0;\nupdateloopLabel();\n}", "function reset() {\n pause();\n sm.initialize(components, connections);\n handler.trigger('reset');\n }", "function reset() {\n number.update(() => starting);\n }", "resetBuffer() {\n this.waitUntilStop().then(() => {\n this.STFTBuffer.fill();\n this.startSTFTCalculation();\n });\n }", "reset() { // Return the tape to pre-program conditions.\n this.tape = Array(100).fill(0);\n this.activeCellIndex = 0;\n this.refresh();\n }", "function reset() {\n current(uninitState);\n target(uninitState);\n // promise already set as null if it is cancelled or resolved\n if (promise)\n cancel(Utils.Exception('Reset'));\n task = null;\n promise = null;\n }", "function resetBetweenCycles(){\r\n t = 1\r\n total = 0\r\n counter = 0\r\n }", "resetFlicker () {\r\n this.flicker_speed = 4\r\n this.flicker_delay = 1.5\r\n this.flicker_delta = 0\r\n this.flicker_phase = 0\r\n this.flicker_count = 0\r\n this.flicker_max = 25\r\n }", "async reset () {\n await replaceComponentDefinition(this._backupComponentDef, this.componentName, this.moduleName);\n this._dirty = false;\n }", "function resetDevice()\n{\n sendMidi(0xB0, 0, 0);\n\n for(var i=0; i<80; i++)\n {\n pendingLEDs[i] = 0;\n }\n flushLEDs();\n}", "restart() {\n this.state = this.stack[0];\n this.stack.length = 0;\n }", "function ens_reset()\n{\n // Reset the ensemble variable values\n ens_cur = \"\";\n ens_bot_arr.length = 0;\n ens_clear_arr.length = 0;\n ens_on = false;\n\n // Create or reset the ensemble task\n if (get_type(ens_task) !== \"Task\") { ens_task = new Task(ens_func_clear, this, \"null\"); }\n ens_task.interval = 500;\n ens_task.cancel();\n\n // Clear the launch ensemble textedit\n top_patch.getnamed(\"textedit_ens_launch\").message(\"clear\");\n}", "function resumeSimulation() {\n intervalId = _createIntervalLoop();\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Manage FF context menu integration onHidden event
function onHiddenContextMenuHandler () { myMenu_open = false; // This sidebar instance menu closed, do not interpret onClicked events anymore }
[ "function onHiddenContextMenuHandler () {\r\n // Reset remembered bnId if any\r\n lastMenuBnId = undefined;\r\n}", "function addListenerHiding(win) {\n var win = viewFor(win);\n cmNode = win.document.getElementById('contentAreaContextMenu')\n cmNode.addEventListener('popupshowing', function(e){\n menuItem.items = [dummy]\n })\n}", "_handleRequestContextMenuHide()\n {\n $('#menu-context').hide();\n }", "function contextmenu_hide() {\n document.getElementById('contextmenu').style.display='none';\n}", "hideContextMenu(){\n // Hide the context menu if it's open\n if(this._isContextShown) {\n this._contextMenu.hide();\n this._isContextShown = false;\n }\n }", "hide() {\n this.highlighter.contextMenuActive = false;\n $(\"#df-context-menu\").addClass('hidden');\n $(\"input[name = 'translation']\").val('');\n $(\"input[name = 'entity-type']\").val('');\n }", "function hide() {\n if (contextMenu != null) {\n contextMenu.hide();\n }\n}", "function hide() {\n\t if (contextMenu != null) {\n\t contextMenu.hide();\n\t }\n\t}", "function onAppListHidden() {\n speechManager.onHidden();\n }", "function realHideMenu (menuID) {\n\tvar menuRef = gE(menuID);\n\thE(menuRef);\n}", "function modifyEventContextMenu() {\n displayEventEditWindow();\n}", "onHide() {}", "function HideMenu()\n{\n if (_itemSelected)\n {\n ChangeOpacityForElement(0, _divContextMenu.id);\n UnselectCurrentMenuItem();\n }\n}", "function afterHide(){ self.onHide.call(self, event); }", "function showContextMenu()\n{\n chrome.contextMenus.removeAll(function()\n {\n if(typeof localStorage[\"shouldShowBlockElementMenu\"] == \"string\" && localStorage[\"shouldShowBlockElementMenu\"] == \"true\")\n {\n chrome.contextMenus.create({'title': chrome.i18n.getMessage('block_element'), 'contexts': ['image', 'video', 'audio'], 'onclick': function(info, tab)\n {\n if(info.srcUrl)\n chrome.tabs.sendRequest(tab.id, {reqtype: \"clickhide-new-filter\", filter: info.srcUrl});\n }});\n }\n });\n}", "onMenuClosed() {\n this.runLocalHooks('afterClose');\n }", "function xHide(e){return xVisibility(e,0);}", "afterHide(popup) {}", "function contextmenu_item_hors(eContextMenu, strItemID , boolShow,aDoc)\r\n{\r\n\t//alert(strItemID)\r\n\tstrItemID = \"contextmnu_\" + strItemID;\r\n\tif(boolShow)\r\n\t{\r\n\t\tcontextmenu_item_show(eContextMenu, strItemID , aDoc);\r\n\t}\r\n\telse\r\n\t{\r\n\t\t//alert(strItemID)\r\n\t\tcontextmenu_item_hide(eContextMenu, strItemID , aDoc);\r\n\t}\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
! Function : WebSocketIFSendSimpleRequest
function WebSocketIFSendSimpleRequest (InRequest) { var d; var request; request = {}; d = new Date(); request.packettype = "request"; request.packetid = WebSocketIFGetNextID(); request.time = d.getTime(); request.type = InRequest; request.body = ""; WebSocketIFSendGeneralRequest(request); }
[ "function\nWebSocketIFSendSimpleRequest(InRequest)\n{\n var request = {};\n\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.type = InRequest;\n request.body = \"\";\n\n WebSocketIFSendGeneralRequest(request);\n}", "function \nWebSocketIFSendGeneralRequest(InRequest) {\n if ( WebSocketIFConnection ) {\n\tconsole.log(InRequest);\n WebSocketIFConnection.send(JSON.stringify(InRequest));\n }\n}", "function\nWebSocketIFSendGeneralRequest\n(InRequest)\n{\n if ( WebSocketIFConnection ) {\n WebSocketIFConnection.send(JSON.stringify(InRequest));\n }\n}", "function \nWebSocketIFSendGeneralRequest(InRequest) {\n if ( WebSocketIFConnection ) {\n WebSocketIFConnection.send(JSON.stringify(InRequest));\n }\n}", "function\nWebSocketIFRequestGetBayTypes()\n{\n WebSocketIFSendSimpleRequest(\"getbaytypes\");\n}", "function\nWebSocketIFHandleRequest\n(InPacket)\n{\n\n}", "function\nWebSocketIFRequestMonitorInfo\n()\n{\n WebSocketIFSendSimpleRequest(\"getmonitorinfo\");\n}", "function\nWebSocketIFSendDeviceDefRegRequestStart\n()\n{\n WebSocketIFDeviceIndex = 0;\n WebSocketIFSendDeviceDefRegRequest();\n}", "function\nWebSocketIFSendDeviceDefRegRequest\n()\n{\n var request = {};\n\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.devicename = MainDeviceDefs[WebSocketIFDeviceIndex].name;\n request.type = \"getdeviceregs\";\n request.body = \"\";\n\n WebSocketIFSendGeneralRequest(request);\n}", "function\nCBWebSocketIFGetStressInfo\n(InEvent)\n{\n WebSocketIFSendSimpleRequest(\"getstressinfo\");\n}", "function doSend(message){websocket.send(message);}", "function\nWebSocketIFSendAddBayRequest\n(InBay)\n{\n var request;\n\n request = {};\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.bayindex = InBay.dataBay.index;\n request.type = \"addbay\";\n request.body = {};\n request.body.bayindex = InBay.dataBay.index;\n request.body.bayinfo = {};\n request.body.bayinfo.panelcount = InBay.dataBay.type.panelcount;\n request.body.bayinfo.bayindex = InBay.dataBay.index;\n request.body.bayinfo.name = InBay.id;\n request.body.bayinfo.ipaddress = \"127.0.0.1\";\n request.body.bayinfo.type = InBay.dataBay.type.name;\n request.body.bayinfo.portnumber = 8001;\n request.body.bayinfo.canaddress = 0;\n request.body.bayinfo.listnumber = InBay.dataBay.type.listnumber;\n WebSocketIFSendGeneralRequest(request); \n}", "function\nWebSocketIFSendBayRegValuesRequest(InBayIndex)\n{\n var request = {};\n\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.bayindex = InBayIndex;\n request.type = \"getbayregvalues\";\n request.body = \"\";\n\n WebSocketIFSendGeneralRequest(request);\n}", "function send(ws, id, url, freq = -1, expectedResponse = undefined) {\n\tlet msg = {id:id, q:url};\n\tif (freq >= 0) {\n\t\tmsg['repeat'] = {freq:freq};\n\t}\n\tlogToConsole(\"Sending message: \" + JSON.stringify(msg));\n\n\tconsole.log(\"Ready state \", ws.readyState);\n\n \tws.send(JSON.stringify(msg));\n \treturn waitForResponse(id, expectedResponse);\n}", "function\nWebSocketIFSendPanelRegValuesRequest(InBayIndex, InPanelIndex)\n{\n var request = {};\n\n request.packettype = \"request\";\n request.packetid = WebSocketIFGetNextID();\n request.time = 0;\n request.panelindex = InPanelIndex;\n request.bayindex = InBayIndex;\n request.type = \"getpanelregvalues\";\n request.body = \"\";\n\n WebSocketIFSendGeneralRequest(request);\n}", "function sendSetup()\n{\n getConfig();\n \n var txstr = \"cfgdata:\" +\n config.call + \";\" +\n config.websock_port + \";\" +\n config.allowRemoteAccess + \";\" +\n config.lnb_orig + \";\" +\n config.lnb_crystal + \";\" +\n config.downmixer_outqrg + \";\" +\n config.minitiouner_ip + \";\" +\n config.minitiouner_port + \";\" +\n config.minitiouner_local + \";\" +\n config.CIV_address + \";\" +\n config.tx_correction + \";\" + \n config.icom_satmode + \";\"\n ; \n\n //console.log(txstr);\n \n websocket.send(txstr);\n}", "function send(messageType, text) {\n if (!socket || socket.readyState !== WebSocket.OPEN) {\n alert(\"socket not connected\");\n }\n var data = messageType + SEPARATOR + text;\n socket.send(data);\n console.log(\"Wyslano wiadomosc: \" + data)\n}", "function\nWebSocketIFSendDeviceDefRegRequestNext\n()\n{\n WebSocketIFDeviceIndex++;\n if ( WebSocketIFDeviceIndex >= MainDeviceDefs.length ) {\n WebSocketIFSendSimpleRequest(\"getbays\");\n } else {\n WebSocketIFSendDeviceDefRegRequest();\n }\n}", "sendTestMessage(ws){\n ws.send(JSON.stringify(new Message(\"1\", \"debugMessage\", \"hello there\")));\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
helper to generate a random date
function randomDate(start, end) { return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())).toLocaleDateString(); }
[ "function getRandomDate() {\n\treturn today.subtract(Math.floor(Math.random() * 525600), 'minutes').format('YYYY-MM-DD hh:mm:ss');\n}", "function randDate() {\n \n var month = monthConvert(((Math.random() * 12) + 1) | 0);\n var day = ((Math.random() * 30) + 1) | 0;\n\n return month + \" \" + day + \", 2019\";\n}", "function randomDate() {\n let minDate = new Date(2013,1,1);\n let maxDate = new Date(2018,12,31); \n // set a minimum date add a random number to it\n // multiply that date by the difference between the min and max date values. \n // based on documentation from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date\n var timeStamp = new Date(minDate.getTime() + Math.random() \n * (maxDate.getTime() - minDate.getTime()));\n var year = timeStamp.getFullYear();\n var month = timeStamp.getMonth() + 1; // month index value is 0-11 so we must compenstte\n var day = timeStamp.getDate();\n return year + '-' + month + '-' + day ;\n}", "function RandomDate() {\n let year = RandomInt(2019, 2021);\n let month = RandomInt(0, 11);\n let day = (month == 1) ? RandomInt(1, 28) : RandomInt(1, 31); // check for Feb.\n let hours = RandomInt(0, 23);\n let minutes = RandomInt(0, 59);\n return new Date(year, month, day, hours, minutes);\n}", "function random_date(start, end) {\n return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));\n }", "function generateHarvestDate() {\n\tconst harvestDates = [\n\t'07/07/07', '08/08/08', '09/09/09'];\n\treturn harvestDates[Math.floor(Math.random() * harvestDates.length)];\n}", "function randomDate(start, end) {\n return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));\n }", "function randomDate(start, end) {\n return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()))\n}", "function randomDateString(){\n\n //Create data objects for yesterday, and APOD start date\n var today = moment().subtract(1, 'days');\n var APODstart = moment('1995-06-16');\n\n //Convert to Unix time - milliseconds since Jan 1, 1970\n var todayUnix = today.valueOf();\n var APODstartUnix = APODstart.valueOf();\n\n //How many milliseconds between APOD start and now?\n var delta = todayUnix - APODstartUnix;\n\n //Generate a random number between 0 and (number of milliseconds between APOD start and now)\n var offset = Math.floor((Math.random() * delta));\n\n //Add random number to APOD start\n var randomUnix = APODstartUnix + offset;\n\n //And then turn this number of seconds back into a date\n var randomDate = moment(randomUnix);\n\n //And format this date as \"YYYY-MM-DD\", the format required in the\n //APOD API calls.\n var stringRandomDate = randomDate.format('YYYY-MM-DD');\n\n return stringRandomDate;\n}", "function randomDate(date1, date2) {\n var minD = new Date().parse(date1).format('%s');\n var maxD = new Date().parse(date2).format('%s');\n var random = Number.random(parseInt(minD), parseInt(maxD));\n var randomDate = new Date().parse(random + \"000\").format('db');\n return randomDate;\n}", "function getRandomDueDate() {\n let startDate = new Date()\n let endDate = new Date(2030, 0, 1)\n return new Date(\n startDate.getTime() +\n Math.random() * (endDate.getTime() - startDate.getTime()),\n )\n }", "function randomDate(future) {\n var end = new Date(\n Date.now() + 1000 /*sec*/ * 60 /*min*/ * 60 /*hour*/ * 24 /*day*/ * 10\n );\n var start = new Date();\n return new Date(\n start.getTime() + (Math.random() * (end.getTime() - start.getTime())*(future == true ? 1 : -1))\n );\n}", "function generateBirthday(){\r\n var returnMe = getRandomNumber(20, 1970) + '-' + addZero(getRandomNumber(12, 1)) + '-' + addZero(getRandomNumber(28, 1))\r\n return returnMe;\r\n}", "function randomDate(after, before) {\n if (after === undefined || after === null) after = new Date(1970, 0, 1);\n if (before === undefined || before === null) before = new Date();\n var min = after.getTime(),\n max = before.getTime();\n var random = Math.random() * (max - min) + min;\n return new Date(random);\n}", "function laterDate() {\n return moment().add(Math.pow(365.25*3,Math.random()),'days').format(\"YYYY-MM-DD\");\n }", "function randomDate(start, end) {\n var startDate = new Date(start)\n var endDate = new Date(end)\n var date = new Date(+startDate + Math.random() * (endDate - startDate));\n var msTime = date.getTime(); \n //console.log(\"ms time is \", msTime)\n return msTime;\n}", "function getDate() {\n let endDate = new Date();\n let startDate = new Date().setYear(endDate.getFullYear() - 2).valueOf();\n\n return new Date(\n getRandomInt(startDate, endDate)\n );\n}", "function generateDate(date) {\n return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;\n}", "static generateDateBasedUuid() {\n return `${uuidv4()}-${dateFormat(new Date(new Date().toLocaleString('es-CO', { timeZone: 'America/Bogota' })), \"yymm\")}`;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::Serverless::SimpleTable.ProvisionedThroughput` resource
function cfnSimpleTableProvisionedThroughputPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnSimpleTable_ProvisionedThroughputPropertyValidator(properties).assertSuccess(); return { ReadCapacityUnits: cdk.numberToCloudFormation(properties.readCapacityUnits), WriteCapacityUnits: cdk.numberToCloudFormation(properties.writeCapacityUnits), }; }
[ "function tableResourceProvisionedThroughputPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n TableResource_ProvisionedThroughputPropertyValidator(properties).assertSuccess();\n return {\n ReadCapacityUnits: cdk.numberToCloudFormation(properties.readCapacityUnits),\n WriteCapacityUnits: cdk.numberToCloudFormation(properties.writeCapacityUnits),\n };\n }", "function cfnTableProvisionedThroughputPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnTable_ProvisionedThroughputPropertyValidator(properties).assertSuccess();\n return {\n ReadCapacityUnits: cdk.numberToCloudFormation(properties.readCapacityUnits),\n WriteCapacityUnits: cdk.numberToCloudFormation(properties.writeCapacityUnits),\n };\n}", "function CfnSimpleTable_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.requiredValidator)(properties.writeCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.validateNumber)(properties.writeCapacityUnits));\n return errors.wrap('supplied properties not correct for \"ProvisionedThroughputProperty\"');\n}", "function CfnSimpleTable_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.requiredValidator)(properties.writeCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.validateNumber)(properties.writeCapacityUnits));\n return errors.wrap('supplied properties not correct for \"ProvisionedThroughputProperty\"');\n}", "function cfnGlobalTableWriteProvisionedThroughputSettingsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGlobalTable_WriteProvisionedThroughputSettingsPropertyValidator(properties).assertSuccess();\n return {\n WriteCapacityAutoScalingSettings: cfnGlobalTableCapacityAutoScalingSettingsPropertyToCloudFormation(properties.writeCapacityAutoScalingSettings),\n };\n}", "function CfnTable_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.requiredValidator)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.requiredValidator)(properties.writeCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.validateNumber)(properties.writeCapacityUnits));\n return errors.wrap('supplied properties not correct for \"ProvisionedThroughputProperty\"');\n}", "function CfnTable_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.requiredValidator)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.requiredValidator)(properties.writeCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.validateNumber)(properties.writeCapacityUnits));\n return errors.wrap('supplied properties not correct for \"ProvisionedThroughputProperty\"');\n}", "function TableResource_ProvisionedThroughputPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.requiredValidator)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('readCapacityUnits', cdk.validateNumber)(properties.readCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.requiredValidator)(properties.writeCapacityUnits));\n errors.collect(cdk.propertyValidator('writeCapacityUnits', cdk.validateNumber)(properties.writeCapacityUnits));\n return errors.wrap('supplied properties not correct for \"ProvisionedThroughputProperty\"');\n }", "function cfnGlobalTableReadProvisionedThroughputSettingsPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnGlobalTable_ReadProvisionedThroughputSettingsPropertyValidator(properties).assertSuccess();\n return {\n ReadCapacityAutoScalingSettings: cfnGlobalTableCapacityAutoScalingSettingsPropertyToCloudFormation(properties.readCapacityAutoScalingSettings),\n ReadCapacityUnits: cdk.numberToCloudFormation(properties.readCapacityUnits),\n };\n}", "get throughput() {\n return this.getNumberAttribute('throughput');\n }", "function CfnGlobalTable_WriteProvisionedThroughputSettingsPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('writeCapacityAutoScalingSettings', CfnGlobalTable_CapacityAutoScalingSettingsPropertyValidator)(properties.writeCapacityAutoScalingSettings));\n return errors.wrap('supplied properties not correct for \"WriteProvisionedThroughputSettingsProperty\"');\n}", "function cfnSimpleTablePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnSimpleTablePropsValidator(properties).assertSuccess();\n return {\n PrimaryKey: cfnSimpleTablePrimaryKeyPropertyToCloudFormation(properties.primaryKey),\n ProvisionedThroughput: cfnSimpleTableProvisionedThroughputPropertyToCloudFormation(properties.provisionedThroughput),\n SSESpecification: cfnSimpleTableSSESpecificationPropertyToCloudFormation(properties.sseSpecification),\n TableName: cdk.stringToCloudFormation(properties.tableName),\n Tags: cdk.hashMapper(cdk.stringToCloudFormation)(properties.tags),\n };\n}", "function printResourceTableProperties(schema, properties, prefix) {\n\n var table = \"\";\n\n for(var i = 0; i < properties.length; i++) {\n var name = properties[i];\n var dataType = \"\";\n var description = \"\";\n var example = \"\";\n var property = schema.properties[name];\n var alreadyPrinted = false;\n\n if(prefix != \"\" && !schema.exclude) {\n prefix = \"\";\n }\n\n if(!property) {\n console.log(\"Error in printResourceTableProperties \" + properties)\n }\n\n //Override case, do not show if set or if the name has a \".\" (legacy case)\n var hideFromTable = property.hideFromTable || name.indexOf(\".\") > -1;\n\n if(!hideFromTable) {\n\n //Database type overrides data type\n if(property.database) {\n dataType = property.database;\n }\n else if (property.type) {\n dataType = property.type;\n }\n\n if(property.description)\n {\n description = property.description;\n }\n\n if(property.ref) {\n \n //If this is a simple replace (apiname.resourcename.propertyname) + not Obj/Array, just replace the example\n if(property.ref && dataType != \"object\" && dataType != \"array\") {\n property.example = getValueFromAPI(property.ref);\n } \n else {\n\n var tokens = property.ref.split(\".\");\n var value = tokens[tokens.length - 1];\n\n //Special case - Nesting allows us to nest the table.\n //STOP NEST is used if we want to have a semi-nested object - one level of nesting, one level of split-resource, to designate where to stop\n if(property.isNested && !property.stopNest) {\n\n //First print the header\n if(property.arrayType) {\n //case 1: Nested array, print array of object/string/etc\n dataType = util.format(\"Array[%s]\", property.arrayType);\n } \n else {\n //case 2: Nested object, print object\n dataType = property.type;\n }\n\n table += \"| \" + prefix + name + \" | \" + dataType +\" | \" + description +\" | \" + example + \" |\\n\";\n\n alreadyPrinted = true;\n\n var apiName = tokens[0];\n var schemaName = tokens[1];\n var innerSchema = extractResource(apiName, schemaName);\n\n //Recurse!\n var innerProperties = getPropertyNames(innerSchema, \"printResourceTableProperties\"); //[ \"Id\", \"CustomerTypeId\" ... ]\n\n //Store old prefix for when recursion is complete\n var oldPrefix = prefix;\n prefix = prefix + name + \".\";\n\n //Recurse!\n table += printResourceTableProperties(innerSchema, innerProperties, prefix);\n\n //Restore old prefix\n prefix = oldPrefix;\n }\n else {\n\n var linkValue = value;\n\n //Manually override the link - used only for SOAP APIs\n if(property.fixlink) {\n linkValue = property.fixlink;\n } \n\n if(property.arrayType) {\n //case 3: Regular table, print array of link to object\n dataType = util.format(\"Array[%s]\", linkWrap(linkValue, property.ref));\n }\n else {\n dataType = linkWrap(linkValue, property.ref);\n }\n }\n }\n } //Print an array\n else if (property.type == \"array\" && property.arrayType) {\n dataType = \"Array[\" + property.arrayType + \"]\";\n }\n\n //Include size in data type if provided\n if(property.size) {\n dataType += \"(\"+ property.size +\")\";\n }\n\n //Place example in back ticks if provided\n if(property.example) {\n example = \"`\" + property.example + \"`\";\n }\n\n //Replace guid with GUID\n if(dataType.match(/guid/i) && dataType.match(/guid/i).length > 0) {\n dataType = \"GUID\";\n } //Fix DateTime type\n else if (dataType.match(/datetime/i) && dataType.match(/datetime/i).length > 0) {\n dataType = \"DateTime\";\n }\n else if (dataType.indexOf(\"#\") == -1 && !property.database) {\n dataType = toTitleCase(dataType);\n }\n\n var isLegacy = doNotPrint(property.description);\n\n //Make sure we don't double-print\n if(!alreadyPrinted) {\n if(isLegacy) {\n table += \"| *\" + prefix + name + \"* | *\" + dataType +\"* | *\" + description +\"* | |\\n\";\n }\n else {\n table += \"| \" + prefix + name + \" | \" + dataType +\" | \" + description +\" | \" + example + \" |\\n\";\n } \n } \n }\n } \n \n\n return table;\n}", "function tableResourcePropsToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n TableResourcePropsValidator(properties).assertSuccess();\n return {\n KeySchema: cdk.listMapper(tableResourceKeySchemaPropertyToCloudFormation)(properties.keySchema),\n AttributeDefinitions: cdk.listMapper(tableResourceAttributeDefinitionPropertyToCloudFormation)(properties.attributeDefinitions),\n BillingMode: cdk.stringToCloudFormation(properties.billingMode),\n GlobalSecondaryIndexes: cdk.listMapper(tableResourceGlobalSecondaryIndexPropertyToCloudFormation)(properties.globalSecondaryIndexes),\n LocalSecondaryIndexes: cdk.listMapper(tableResourceLocalSecondaryIndexPropertyToCloudFormation)(properties.localSecondaryIndexes),\n PointInTimeRecoverySpecification: tableResourcePointInTimeRecoverySpecificationPropertyToCloudFormation(properties.pointInTimeRecoverySpecification),\n ProvisionedThroughput: tableResourceProvisionedThroughputPropertyToCloudFormation(properties.provisionedThroughput),\n SSESpecification: tableResourceSSESpecificationPropertyToCloudFormation(properties.sseSpecification),\n StreamSpecification: tableResourceStreamSpecificationPropertyToCloudFormation(properties.streamSpecification),\n TableName: cdk.stringToCloudFormation(properties.tableName),\n Tags: cdk.listMapper(cdk.tagToCloudFormation)(properties.tags),\n TimeToLiveSpecification: tableResourceTimeToLiveSpecificationPropertyToCloudFormation(properties.timeToLiveSpecification),\n };\n }", "function mapThroughputDescription(tableName, indexName, throughput) {\n var r = {\n LastIncreaseDateTime: throughput.LastIncreaseDateTime ? new Date(throughput.LastIncreaseDateTime) : new Date(0),\n LastDecreaseDateTime: throughput.LastDecreaseDateTime ? new Date(throughput.LastDecreaseDateTime) : new Date(0),\n NumberOfDecreasesToday: throughput.NumberOfDecreasesToday,\n ReadCapacityUnits: throughput.ReadCapacityUnits,\n WriteCapacityUnits: throughput.WriteCapacityUnits\n };\n r.LastIncreaseMinutesAgo = minutesAgo(r.LastIncreaseDateTime);\n r.LastDecreaseMinutesAgo = minutesAgo(r.LastDecreaseDateTime);\n r.NumberDecreasesRemainingToday = 4 - r.NumberOfDecreasesToday;\n return Promise.all([\n getConsumedCapacity(tableName, indexName, 'ConsumedReadCapacityUnits', CONSUMPTION_STATISTICAL_PERIOD_MINUTES),\n getConsumedCapacity(tableName, indexName, 'ConsumedWriteCapacityUnits', CONSUMPTION_STATISTICAL_PERIOD_MINUTES)\n ])\n .then(consumed => {\n r.ConsumedReadCapacity = consumed[0];\n r.ConsumedWriteCapacity = consumed[1];\n r.RatioConsumedRead = r.ConsumedReadCapacity / r.ReadCapacityUnits;\n r.RatioConsumedWrite = r.ConsumedWriteCapacity / r.WriteCapacityUnits;\n return r;\n });\n}", "function tableResourceTimeToLiveSpecificationPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n TableResource_TimeToLiveSpecificationPropertyValidator(properties).assertSuccess();\n return {\n AttributeName: cdk.stringToCloudFormation(properties.attributeName),\n Enabled: cdk.booleanToCloudFormation(properties.enabled),\n };\n }", "function cfnSecurityProfileStatisticalThresholdPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnSecurityProfile_StatisticalThresholdPropertyValidator(properties).assertSuccess();\n return {\n Statistic: cdk.stringToCloudFormation(properties.statistic),\n };\n}", "function cfnTableSkewedInfoPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnTable_SkewedInfoPropertyValidator(properties).assertSuccess();\n return {\n SkewedColumnNames: cdk.listMapper(cdk.stringToCloudFormation)(properties.skewedColumnNames),\n SkewedColumnValueLocationMaps: cdk.objectToCloudFormation(properties.skewedColumnValueLocationMaps),\n SkewedColumnValues: cdk.listMapper(cdk.stringToCloudFormation)(properties.skewedColumnValues),\n };\n}", "warehouseCardHTML() {\n return `\n <h2>${this.name}</h2>\n <h4>Capacity: ${this.capacity}</h4>\n `\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function to install a getter/setter accessor property.
function InstallGetterSetter(object, name, getter, setter) { %CheckIsBootstrapping(); SetFunctionName(getter, name, "get"); SetFunctionName(setter, name, "set"); %FunctionRemovePrototype(getter); %FunctionRemovePrototype(setter); %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); %SetNativeFlag(getter); %SetNativeFlag(setter); }
[ "function InstallGetter(object, name, getter, attributes) {\n %CheckIsBootstrapping();\n if (typeof attributes == \"undefined\") {\n attributes = DONT_ENUM;\n }\n SetFunctionName(getter, name, \"get\");\n %FunctionRemovePrototype(getter);\n %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes);\n %SetNativeFlag(getter);\n}", "installGetters () {\n let that = this;\n Object.keys(this.setters).forEach(function (attrName) {\n let processingMethod = that.getters[attrName];\n Object.defineProperty(that, attrName, {\n get: function () {\n if (this._processed &&\n processingMethod !== undefined) {\n processingMethod.call(that);\n }\n return this['_' + attrName];\n }\n });\n });\n }", "get accessor_prop() { /* function body here */ }", "get accessor_prop() {\n\t\t/* function body here */\n\t}", "function installGetterSetterMode (prop,func) {\n if (func === undefined) {\n func = function() { this['sensible' + prop].call(this); };\n }\n\n mp.Axis.prototype[prop] = getterSetterMode(func,'_' + prop,'_' + prop + 'Mode');\n mp.Axis.prototype[prop + 'Mode'] = getterSetterVal('_' + prop + 'Mode',['auto','manual']);\n\n }", "install(accessors) {\n for (let key in accessors) { this[key] = accessors[key]; }\n }", "addGetter({ name, fn }) {\n Object.defineProperty(_(this).getters, name, { get: () => fn(_(this).state) });\n }", "static createProperty(e,t=defaultPropertyDeclaration){// Do not generate an accessor if the prototype already has one, since\n// it would be lost otherwise and that would never be the user's intention;\n// Instead, we expect users to call `requestUpdate` themselves from\n// user-defined accessors. Note that if the super has an accessor we will\n// still overwrite it\nif(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n=\"symbol\"==typeof e?Symbol():`__${e}`;Object.defineProperty(this.prototype,e,{// tslint:disable-next-line:no-any no symbol in index\nget(){return this[n]},set(t){const r=this[e];this[n]=t,this._requestUpdate(e,r)},configurable:!0,enumerable:!0})}", "function accessor(value, name /* , setter, getter */) {\n Object.defineProperty(value, name, {\n get: arguments.length > 3 ? arguments[3] : defaultGetter(name),\n set: arguments.length > 2 ? arguments[2] : defaultSetter(name),\n configurable: true\n });\n }", "_applyAccessors() {\n [...this.metadata.accessors].forEach(([prop, { selector, all }]) => {\n Object.defineProperty(this, prop, {\n get() {\n return all ? this.$$(selector) : this.$(selector);\n }\n });\n });\n }", "function accessor(prop, arg, skipCaching) {\n return (\n (arg === undefined || typeof arg === 'function') ?\n getter : setter\n )(prop, arg, skipCaching);\n }", "get accessorProp() { return this.dataProp; }", "function objDefineAccessors(target, prop, getProp, setProp) {\r\n var defineProp = Object[\"defineProperty\"];\r\n if (defineProp) {\r\n try {\r\n var descriptor = {\r\n enumerable: true,\r\n configurable: true\r\n };\r\n if (getProp) {\r\n descriptor.get = getProp;\r\n }\r\n if (setProp) {\r\n descriptor.set = setProp;\r\n }\r\n defineProp(target, prop, descriptor);\r\n return true;\r\n }\r\n catch (e) {\r\n // IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw\r\n // We will just ignore this here.\r\n }\r\n }\r\n return false;\r\n }", "function visitSetAccessorDeclaration(context, node) {\n var accessor = converter.createDeclaration(context, node, td.models.ReflectionKind.Accessor);\n context.withScope(accessor, function () {\n accessor.setSignature = converter.createSignature(context, node, '__set', td.models.ReflectionKind.SetSignature);\n });\n return accessor;\n }", "function settergetter(inp) {\n\tlet value = inp ? inp : 0;\n\tfunction get() {\n\t\treturn value;\n\t}\n\tfunction set(val) {\n\t\tvalue = val;\n\t}\n\treturn {\n\t\tget: get,\n\t\tset: set\n\t}\n}", "function makeObservableMethod(target, name, setter, getter) {\n var set = target[setter || \"set\" + name];\n var get = target[getter || \"get\" + name];\n return {\n enumerable: true,\n value: function() {\n var result = set.apply(target, arguments);\n target.emit(name, get.call(target));\n return result;\n }\n }\n }", "function Getter() {}", "function property(name, get, set, wrap, unique) {\n\t\tObject.defineProperty(vanilla.prototype, name, {\n\t\t\tget: get ? getter(name, wrap, unique) : undefined,\n\t\t\tset: set ? setter(name) : undefined,\n\t\t\tconfigurable: true // We must be able to override this.\n\t\t});\n\t}", "function _createGettersSettersProperties(ClassObj) {\n\t\tvar i,\n\t\t\tj,\n\t\t\tfield,\n\t\t\titem,\n\t\t\tpropertyName,\n\t\t\tsetterFunction = function (setterFunctionName, value, inInit) {\n\t\t\t\tvar fn = this[setterFunctionName];\n\t\t\t\tAssert.requireFunction(fn, \"Dynamic setter function does not exist: \" + setterFunctionName);\n\t\t\t\tfn.call(this, value, inInit);\n\t\t\t},\n\t\t\tgetterFunction = function (getterFunctionName) {\n\t\t\t\tvar fn = this[getterFunctionName];\n\t\t\t\tAssert.requireFunction(fn, \"Dynamic getter function does not exist: \" + getterFunctionName);\n\t\t\t\treturn fn.apply(this);\n\t\t\t},\n\t\t\t// wrap this because this.privateAccessor will only be accessible when there is\n\t\t\t// an instance of this object.\n\t\t\taccessorWrapper = function (type, fieldName, subObj, value, inInit) {\n\t\t\t\tvar i,\n\t\t\t\t\tfetchedValue,\n\t\t\t\t\taccessor,\n\t\t\t\t\tconfigDataHash;\n\n\t\t\t\t// protect against setting a bad value on fields that are sub objects\n\t\t\t\tif (subObj && type === _CONST.ACCESSOR_SET && (typeof value !== \"object\" || typeof value === \"object\" && !(value instanceof subObj))) {\n\t\t\t\t\tthrow new Error(\"Calling setter of sub object: \" + fieldName + \" with a value that is the incorrect type\");\n\t\t\t\t}\n\n\t\t\t\t// multiple accessors will exist if there is a superclass\n\t\t\t\t// iterate backwards to start with the lowest subclass\n\t\t\t\tfor (i = this.privateAccessors.length - 1; i >= 0 ; i -= 1) {\n\t\t\t\t\taccessor = this.privateAccessors[i].accessor;\n\t\t\t\t\tconfigDataHash = this.privateAccessors[i].configDataHash;\n\n\t\t\t\t\t// make sure this field exists before trying to get/set via the accessor\n\t\t\t\t\t// don't bother checking parent classes\n\t\t\t\t\t// since the subclasses override\n\t\t\t\t\tif (configDataHash[fieldName]) {\n\t\t\t\t\t\treturn accessor(type, fieldName, value, inInit);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t};\n\n\n\t\tfor (i = 0; i < _configData.length; i = i + 1) {\n\t\t\tfield = _configData[i];\n\t\t\titem = {};\n\n\t\t\t///////////////////////////////////////////////////////\n\t\t\t// Add class configuration data for fields to a\n\t\t\t// static property this will be used in our unit tests\n\t\t\t//\n\t\t\t// TODO: might be a good idea to only do this when a\n\t\t\t// global \"TESTING\" flag is set\n\t\t\t///////////////////////////////////////////////////////\n\t\t\tfor (j in field) {\n\t\t\t\tif (field.hasOwnProperty(j)) {\n\t\t\t\t\t//if (!_.isFunction(field[j])) {\n\t\t\t\t\titem[j] = field[j];\n\t\t\t\t\t//}\n\t\t\t\t}\n\t\t\t}\n\t\t\tClassObj.__CLASS_CONFIG.push(item);\n\t\t\t///////////////////////////////////////////////////////\n\n\t\t\tClassObj.prototype[field.setterName] = Utils.curry(accessorWrapper, _CONST.ACCESSOR_SET, field.dbFieldName, field.classObject);\n\t\t\tClassObj.prototype[field.getterName] = Utils.curry(accessorWrapper, _CONST.ACCESSOR_GET, field.dbFieldName, field.classObject, undefined);\n\n\t\t\t// propertyName is optional. If not specified, set a name based on the dbFieldName\n\t\t\tClassObj.prototype.__defineSetter__(field.propertyName, Utils.curry(setterFunction, field.setterName));\n\t\t\tClassObj.prototype.__defineGetter__(field.propertyName, Utils.curry(getterFunction, field.getterName));\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlights all selction text on the current page.
function highlightAllTextOnPage(tabId, datawakeInfo) { var post_data = JSON.stringify({ team_id: datawakeInfo.team.id, domain_id: datawakeInfo.domain.id, trail_id: datawakeInfo.trail.id, url: tabs.activeTab.url }); var post_url = addOnPrefs.datawakeDeploymentUrl + "/selections/get"; requestHelper.post(post_url, post_data, function (response) { if (response.status != 200){ // TODO error handling console.error(response) } else{ tracking.emitHighlightTextToTabWorker(tabId, response.json); } }); }
[ "function highlightAll()\n\t{\n\t\thighlightBlocks(document.body);\n\t}", "function highlight() {\n const lastLength = selectedNodes.length;\n const range = getRange();\n\n // is range if null then the selection is invalid\n if (range == null) return;\n\n const start = {\n node: range.startContainer,\n offset: range.startOffset,\n };\n const end = {\n node: range.endContainer,\n offset: range.endOffset,\n };\n\n // is start or end node type is not text the discard selection\n if (start.node.nodeType !== 3 || end.node.nodeType !== 3) {\n return;\n }\n\n const sameNodes = start.node === end.node;\n\n const endNode = end.node;\n endNode.splitText(end.offset);\n const startNode = start.node.splitText(start.offset);\n\n if (sameNodes) {\n selectedNodes.push(startNode);\n } else {\n const body = document.querySelector('body');\n getSelectedNodes(body, startNode, endNode);\n }\n\n /* wrapping the selected nodes in the span dom element and the\n apply the background color to all of these nodes */\n for (let i = lastLength; i < selectedNodes.length; i++) {\n const wrapper = document.createElement('span');\n wrapper.setAttribute('class', '__highlight_text__');\n wrapper.setAttribute('draggable', 'true');\n const newNode = selectedNodes[i].cloneNode(true);\n wrapper.appendChild(newNode);\n selectedNodes[i].parentNode.replaceChild(wrapper, selectedNodes[i]);\n selectedNodes[i] = newNode;\n }\n}", "function highlightSelectionInPage() {\n let highlightSpan = document.createElement(\"span\");\n\n highlightSpan.style.backgroundColor = \"#fffd7c\";\n\n try {\n window.getSelection().getRangeAt(0).surroundContents(highlightSpan);\n } catch (err) {\n // TODO fix when there is more than 1 div\n }\n }", "function highlight() {\n var selObj= window.getSelection();\n var highlightedText={};\n highlightedText.text =selObj.toString();\n highlightedText.xPath= getElementXPath();\n var range = selObj.getRangeAt(0);\n var selectionContents = range.extractContents();\n var span = document.createElement(\"span\");\n span.appendChild(selectionContents);\n span.style.backgroundColor = color;\n span.style.color = \"white\";\n range.insertNode(span);\n //add the selected text to the highlights object\n highlights.selections.push(highlightedText) ;\n}", "function highlight_text(){\r\n top = window.getSelection().getRangeAt(0).getBoundingClientRect().top.toString()+\"px\";\r\n left = window.getSelection().getRangeAt(0).getBoundingClientRect().right;\r\n left = left + 50;\r\n left = left + \"px\";\r\n /*let element = document.createElement(\"span\");\r\n element.style.backgroundColor = \"yellow\";\r\n try{\r\n window.getSelection().getRangeAt(0).surroundContents(element);\r\n }catch{\r\n \r\n }*/\r\n var colour = \"yellow\";\r\n var range, sel;\r\n if (window.getSelection) {\r\n // IE9 and non-IE\r\n try {\r\n if (!document.execCommand(\"BackColor\", false, colour)) {\r\n makeEditableAndHighlight(colour);\r\n }\r\n } catch (ex) {\r\n makeEditableAndHighlight(colour)\r\n }\r\n } else if (document.selection && document.selection.createRange) {\r\n // IE <= 8 case\r\n range = document.selection.createRange();\r\n range.execCommand(\"BackColor\", false, colour);\r\n }\r\n \r\n getselectedtext();\r\n}", "function highlightAll() {\n // if we are called too early in the loading process\n if (!domLoaded) { wantsHighlight = true; return; }\n\n const blocks = document.querySelectorAll('pre code');\n blocks.forEach(highlightBlock);\n }", "function reHighlight(selections) {\n for(var i = 0 ; i < selections.length ; i++)\n {\n // get the elements matching the xpath\n var xPathToElements = document.evaluate(selections[i].xPath , document , null , XPathResult.FIRST_ORDERED_NODE_TYPE , null);\n //replace the text that matches with a span tag containing the same text but colored\n xPathToElements.singleNodeValue.innerHTML = xPathToElements.singleNodeValue.innerHTML.replace(selections[i].text ,\"<span style='color: #feff71 '>\"+selections[i].text+\"</span>\");\n }\n}", "function clearHighlightsOnPage()\n{\n unhighlight(document.getElementsByTagName('body')[0], \"ffff00\");\n highlightedPage = false;\n lastText = \"\";\n}", "function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n\n const blocks = document.querySelectorAll('pre code');\n blocks.forEach(highlightElement);\n }", "function setHighlightTerms(searchWin, searchText)\n { \n //set the Highlight tags\n highlightStartTag = \"<font style='color:blue; background-color:yellow;'>\";\n highlightEndTag = \"</font>\";\n \n //The text array to be search\n searchArray = searchText.split(\" \");\n \n if(!searchWin.document.body || typeof(searchWin.document.body.innerHTML) == \"undefined\")\n {\n alert(\"Sorry, search page is unavailable. Search failed.\");\n return;\n }\n \n var bodyText = searchWin.document.body.innerHTML;\n for (var i = 0; i < searchArray.length; i++)\n {\n bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);\n }\n \n searchWin.document.body.innerHTML = bodyText;\n alert(\"Highlight completed\");\n self.clearInterval(getTimer()); \n \n }//end of setHighlightTerms", "function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag) {\n // if the treatAsPhrase parameter is true, then we should search for \n // the entire phrase that was entered; otherwise, we will split the\n // search string so that each word is searched for and highlighted\n // individually\n if (treatAsPhrase) {\n searchArray = [searchText];\n } else {\n searchArray = searchText.split(\" \");\n }\n\n //Make sure that all toggle panels are expanded\n if (document.getElementById(\"trTogglePanel_Body\") != null) {\n expand_Toggle_Panels();\n }\n \n //if the tag divpage exists, this indicates that the format is 'flat' and we should get and set content from divpage\n if (document.getElementById(\"divpage\") != null)\n {\n //-- DIVPAGE --\n var thispage=document.getElementById(\"divpage\");\n }\n else\n {\n //-- ENTIRE PAGE -- \n var thispage=document.body;\n }\n \n if (!document.body || typeof(thispage.innerHTML) == \"undefined\") {\n if (warnOnFailure) {\n alert(\"Sorry, for some reason the text of this page is unavailable. Searching will not work.\");\n }\n return false;\n }\n\n //var bodyText = document.body.innerHTML;\n var bodyText = thispage.innerHTML;\n \n //var bodyText = document.getElementById(\"divpage\").innerHTML;\n //alert(\"bodyText = \"+bodyText);\n for (var i = 0; i < searchArray.length; i++) {\n bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);\n }\n //document.body.innerHTML = bodyText;\n thispage.innerHTML = bodyText;\n //document.getElementById(\"divpage\").innerHTML = bodyText;\n return true;\n}", "function findWords(paragraph, selectedText){\n let regex = new RegExp('('+ selectedText +')', 'ig');\n let sameWords = paragraph.textContent.replace(regex, '<span class=\"highlight\">$1</span>');\n paragraph.innerHTML = sameWords;\n}", "function markTextSelected(range) {\n var newNode = document.createElement(\"div\");\n newNode.setAttribute(\n \"style\",\n \"background-color: yellow; display: inline;\"\n );\n range.surroundContents(newNode);\n }", "function highlight() {\n\tlet bold = getBold_items();\n\tfor (text of bold) {\n\t\tthis.style.color = \"blue\";\n\t}\n}", "function CustomHighlight() {}", "clearHighlight() {\n\t\tthis.setHtml()\n\n\t\tthis.updateRootHtml()\n\t}", "function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)\r\n{\r\n // if the treatAsPhrase parameter is true, then we should search for \r\n // the entire phrase that was entered; otherwise, we will split the\r\n // search string so that each word is searched for and highlighted\r\n // individually\r\n if (treatAsPhrase) {\r\n searchArray = [searchText];\r\n } else {\r\n searchArray = searchText.split(\" \");\r\n }\r\n \r\n if (!document.body || typeof(document.body.innerHTML) == \"undefined\") {\r\n if (warnOnFailure) {\r\n alert(\"Por alguna razon el texto de esta pagina no se encuentra disponible, por lo que la busqueda no servira.\");\r\n }\r\n return false;\r\n }\r\n \r\n var bodyText = document.body.innerHTML;\r\n for (var i = 0; i < searchArray.length; i++) {\r\n bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);\r\n }\r\n \r\n document.body.innerHTML = bodyText;\r\n return true;\r\n}", "function HighlightString() {\r\n\ttry{\r\n\t\tvar chapter, page;\r\n\t\tchapter=Book.getChapter();\r\n\t\tpage=Book.getPage();\r\n\t\tvar iframe = document.getElementsByName(\"ePubViewerFrame\");\r\n\t\tvar id = iframe[0].id;\r\n\t\tiframe = document.getElementById(id);\r\n\t\tvar idoc = iframe.contentDocument || iframe.contentWindow.document;\r\n\t\tvar SelectedText = idoc.getSelection().toString();\r\n\r\n\t\ttry{ //make array\r\n\t\t\tHighlightedStrings[chapter+\"-\"+page][0];\r\n\t\t}catch(e){\r\n\t\t\tHighlightedStrings[chapter+\"-\"+page] = new Array();\r\n\t\t}\r\n\r\n\r\n\t\tvar userSelection = idoc.getSelection().getRangeAt(0);\r\n\t\t//from dangerous range to safe range(dangerous: include HTML tags, safe: smaller range that doesn't include HTML tags)\r\n\t\tvar safeRanges = getSafeRanges(userSelection);\r\n\r\n\t\tfor(var i = 0; i < safeRanges.length; i++){\r\n\t\t\tif(safeRanges[i].toString()){\r\n\t\t\t\t//alert(safeRanges[i].toString());\r\n\t\t\t\tHighlightedStrings[chapter+\"-\"+page].push(safeRanges[i].toString());\r\n\t\t\t}\r\n\t\t\thighlightRange(safeRanges[i]);\r\n\t\t}\r\n\r\n\t\t//highlight same strings in the page\r\n\t\t$('iframe').contents().find(\"body\").highlight(SelectedText);\r\n\r\n\t\t//alert(\"You highlighted : \"+ SelectedText);\r\n\t\t//alert(\"chapterNumber = \"+Book.getChapter()+\",Page Number =\"+Book.getPage());\r\n\r\n\t}catch(e){\r\n\t\talert(\"error : No text is selected or the range is too large.\");\r\n\t}\r\n}", "function highlightAll(text, search) {\n const parts = text.split(new RegExp(`(${search})`, \"gi\"));\n return (\n <span>\n {parts.map((part, i) => (\n <span\n key={i}\n style={\n part.toLowerCase() === search.toLowerCase()\n ? { color: \"#2e9f9c\" }\n : {}\n }\n >\n {part}\n </span>\n ))}\n </span>\n );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Preprocesses the C32 document
function process(c32) { c32.section = section; return c32; }
[ "function DocumentPretranslating() {\n _classCallCheck(this, DocumentPretranslating);\n\n DocumentPretranslating.initialize(this);\n }", "function process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n}", "function ProcessWord97()\n{\n if(doRemoveMetaLink())\n removeMetaLink();\n\n convertFontSizes();\n\n if(doFixInvalidNesting())\n fixInvalidNesting();\n}", "function zenXMLContentHandler_startDocument()\r\n{\r\n}", "function zenXMLContentHandler_startDocument()\n{\n}", "process_pre_sections() {\n for(var i=0; i<pre_sections.length; ++i) {\n var section_cnt = 0;\n for(var j=0; j<pre_sections[i][0]; ++j) {\n //multiply by specified cts\n for(var k=0; k<pre_sections[i][1]; ++k) {\n this.sections.push({measure_size:pre_sections[i][1],measure_cnt:k,section_cnt:section_cnt,title:pre_sections[i][2]});\n ++section_cnt;\n }\n }\n }\n }", "function processDataFromDocusky() {\n\tparseDocInfo();\n\ttoolSetting();\n}", "async preloadTemplate() {\n const operation = this.operations.register('load', { affectsHeadline: false });\n const preloadPage = pageRegistry.get(this.preloadConfig.commentTemplate);\n try {\n await preloadPage.loadCode();\n let code = preloadPage.code;\n\n const regexp = generateTagsRegexp(['onlyinclude']);\n let match;\n let onlyInclude;\n while ((match = regexp.exec(code))) {\n onlyInclude ??= '';\n onlyInclude += match[2];\n }\n if (onlyInclude !== undefined) {\n code = onlyInclude;\n }\n\n code = code\n .replace(generateTagsRegexp(['includeonly']), '$3')\n .replace(generateTagsRegexp(['noinclude']), '');\n code = code.trim();\n\n if (code.includes(cd.g.signCode) || this.preloadConfig.omitSignature) {\n this.omitSignatureCheckbox.setSelected(true);\n }\n\n this.commentInput.setValue(code);\n this.originalComment = code;\n\n operation.close();\n\n focusInput(this.headlineInput || this.commentInput);\n this.preview();\n } catch (e) {\n if (e instanceof CdError) {\n this.handleError(\n Object.assign({}, e.data, {\n cancel: true,\n operation,\n })\n );\n } else {\n this.handleError({\n type: 'javascript',\n logMessage: e,\n cancel: true,\n operation,\n });\n }\n }\n }", "getPreContent() {}", "function preContent() {\n doPageGraphic();\n doPageCategory();\n doNavLinks();\n beginContent();\n}", "function ProcessWord2000()\n{\n if(doRemoveXMLFromHTML())\n removeXMLFromHTML();\n\n if(doRemoveXMLMarkup())\n removeXMLMarkup();\n\n if(doRemoveIfs())\n removeIfs();\n\n if(doRemoveMSOStyleAttr())\n removeMSOStyleAttr();\n\n if(doRemoveEmptyParas())\n removeEmptyParas();\n\n if(doRemoveCSSFromTables())\n removeCSSFromTables();\n\n if(doRemoveNonCSSDeclaration())\n removeNonCSSDeclaration();\n\n if(doRemoveInlineCSS())\n removeInlineCSS();\n\n if(doRemoveUnusedStyles())\n removeUnusedStyles();\n\n // We are done. Do some general cleanup\n formatCSS();\n \n}", "function substitutePreCodeTags (doc) {\n\n\t var pres = doc.querySelectorAll('pre'),\n\t presPH = [];\n\n\t for (var i = 0; i < pres.length; ++i) {\n\n\t if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {\n\t var content = pres[i].firstChild.innerHTML.trim(),\n\t language = pres[i].firstChild.getAttribute('data-language') || '';\n\n\t // if data-language attribute is not defined, then we look for class language-*\n\t if (language === '') {\n\t var classes = pres[i].firstChild.className.split(' ');\n\t for (var c = 0; c < classes.length; ++c) {\n\t var matches = classes[c].match(/^language-(.+)$/);\n\t if (matches !== null) {\n\t language = matches[1];\n\t break;\n\t }\n\t }\n\t }\n\n\t // unescape html entities in content\n\t content = showdown.helper.unescapeHTMLEntities(content);\n\n\t presPH.push(content);\n\t pres[i].outerHTML = '<precode language=\"' + language + '\" precodenum=\"' + i.toString() + '\"></precode>';\n\t } else {\n\t presPH.push(pres[i].innerHTML);\n\t pres[i].innerHTML = '';\n\t pres[i].setAttribute('prenum', i.toString());\n\t }\n\t }\n\t return presPH;\n\t }", "function substitutePreCodeTags (doc) {\n \n var pres = doc.querySelectorAll('pre'),\n presPH = [];\n \n for (var i = 0; i < pres.length; ++i) {\n \n if (pres[i].childElementCount === 1 && pres[i].firstChild.tagName.toLowerCase() === 'code') {\n var content = pres[i].firstChild.innerHTML.trim(),\n language = pres[i].firstChild.getAttribute('data-language') || '';\n \n // if data-language attribute is not defined, then we look for class language-*\n if (language === '') {\n var classes = pres[i].firstChild.className.split(' ');\n for (var c = 0; c < classes.length; ++c) {\n var matches = classes[c].match(/^language-(.+)$/);\n if (matches !== null) {\n language = matches[1];\n break;\n }\n }\n }\n \n // unescape html entities in content\n content = showdown.helper.unescapeHTMLEntities(content);\n \n presPH.push(content);\n pres[i].outerHTML = '<precode language=\"' + language + '\" precodenum=\"' + i.toString() + '\"></precode>';\n } else {\n presPH.push(pres[i].innerHTML);\n pres[i].innerHTML = '';\n pres[i].setAttribute('prenum', i.toString());\n }\n }\n return presPH;\n }", "function preProcessHeader_EProof__SID__() {\n\t//----Debugging------------------------------------------\n\t// The following alert-Command is useful for debugging\n\t//alert(\"eproof.js:preProcessHeader()-Call\")\n\t//----Create Object/Instance of EProof__SID__----\n\t// var vMyInstance = new EProof__SID__();\n\t// vMyInstance.preProcessHeader();\n\t//-------------------------------------------------------\n\tvar vArrayID = new Array(\"Precondition\",\"Conclusion\");\n\tvar vCount = 0;\n\tvar i=0;\n\tvar vID = \"\";\n\tvar vHeader = \"\";\n\twhile (i!=vArrayID.length) {\n\t\tvID = vArrayID[i].toUpperCase();\n\t\t// e.g. vID = \"CONCLUSION\"\n\t\tvCount = this.aCountHash[vID];\n\t\tif (vCount == 0) {\n\t\t\tvHeader = \"Error: No Steps for \"+vID+\" defined in e-Proof!\"\n\t\t} else if (vCount == 1) {\n\t\t\tvHeader = vLanguage[vArrayID[i]+\"_Single\"];\n\t\t} else {\n\t\t\tvHeader = vLanguage[vArrayID[i]+\"_Multi\"];\n\t\t};\n\t\tthis.aListHeader[vID] = vHeader;\n\t\ti++;\n\t}\n\tthis.aListHeader[\"JUSTIFICATION\"] = this.LT+\"h2\"+this.GT+\"\"+vLanguage[\"Justifications\"]+\":\"+this.LT+\"/h2\"+this.GT;\n\tthis.aListHeader[\"PROOFSTEP\"] = this.LT+\"h2\"+this.GT+\"\"+vLanguage[\"ProofSteps\"]+\":\"+this.LT+\"/h2\"+this.GT;\n}", "function CEncRule()\n{\n\t//Need Encrypt Data , Set Flag = 1 ///////////\n\tthis.Flag = 1;\n\t//this.ReplaceString = \"SecX_NULL\";\n\n\tthis.XMLHeader = \"<?xml version=\\\"1.0\\\" encoding=\\\"GB2312\\\"?>\";\n\tthis.XMLDoc = new ActiveXObject(\"Microsoft.XMLDOM\");\n\tthis.XMLDoc.async = false;\n\tthis.XMLDoc.loadXML(\"<SecXMSG></SecXMSG>\");\n\n\t//var objPI = this.XMLDoc.createProcessingInstruction(\"xml\", \"version=\\\"1.0\\\" encoding=\\\"gb2312\\\" \");\n\t//this.XMLDoc.insertBefore(objPI, this.XMLDoc.childNodes(0));\n\n}", "function preProcess_EProof__SID__() {\n\t//----Debugging------------------------------------------\n\t// The following alert-Command is useful for debugging\n\t//alert(\"eproof.js:preProcess()-Call\")\n\t//----Create Object/Instance of EProof__SID__----\n\t// var vMyInstance = new EProof__SID__();\n\t// vMyInstance.preProcess();\n\t//-------------------------------------------------------\n\t//this.load_XML();\n\t//this.debugValue(\"preProcess:1700\");\n\tif (this.aUseMathJax == \"1\") {\n\t\t//this.show(\"bRERENDER\"+this.aQID);\n\t};\n\tvar vStep0 = this.getElementById(\"SELECTFROM\"+this.aQID);\n\tthis.setClassName4Step(vStep0,\"\",\"0\");\n\tthis.initIMathQN();\n\tthis.aUsedDOM = document.getElementById(this.aUsedID);\n\tthis.aUnusedDOM = document.getElementById(this.aUnusedID);\n\tthis.aTemplateDOM = document.getElementById(this.aTemplateID);\n\t//alert(\"aTemplateDOM.id=\"+this.aTemplateDOM.id+\" in preProcess():2027\");\n\t//alert(\"aUsedDOM.id=\"+this.aUsedDOM.id+\" in preProcess():2089\");\n\tthis.vConnection2Node = this.getElementsByClassName(\"tplCONNECTION\"+this.aQID);\n\t//alert(\"(1.1) this.aSettings[\\\"show_Main_Control\\\"]=\"+this.aSettings[\"show_Main_Control\"]);\n\n}", "function compCode_201601020_153735() {\r\rapp.beginUndoGroup(\"FocusDocument\");\r\rtry {\r\r// Create Folder hierarchy\r\tvar zcompcodescripts_folder = getItem(\"Z_Compcode_Scripts\", FolderItem, app.project.rootFolder);\r\tif (zcompcodescripts_folder === null) {\r\t\tzcompcodescripts_folder = app.project.items.addFolder(\"Z_Compcode_Scripts\");\r\t}\r\tvar utility_folder = getItem(\"Utility\", FolderItem, zcompcodescripts_folder);\r\tif (utility_folder === null) {\r\t\tutility_folder = app.project.items.addFolder(\"Utility\");\r\t\tutility_folder.parentFolder = zcompcodescripts_folder;\r\t}\r\tvar focusdocument_folder = getItem(\"FocusDocument\", FolderItem, utility_folder);\r\tif (focusdocument_folder === null) {\r\t\tfocusdocument_folder = app.project.items.addFolder(\"FocusDocument\");\r\t\tfocusdocument_folder.parentFolder = utility_folder;\r\t}\r\tvar solids_folder = getItem(\"Solids\", FolderItem, app.project.rootFolder);\r\tif (solids_folder === null) {\r\t\tsolids_folder = app.project.items.addFolder(\"Solids\");\r\t}\r\r// Create Compositions\r\tvar focusdocument_comp = app.project.items.addComp(\"FocusDocument\", 1920, 1080, 1, 120, 25);\r\t\tfocusdocument_comp.time = 0;\r\t\tfocusdocument_comp.bgColor = [0,0,0];\r\t\tfocusdocument_comp.shutterPhase = -90;\r\t\tfocusdocument_comp.motionBlur = true;\r\t\tfocusdocument_comp.parentFolder = focusdocument_folder;\r\r// Create Null Layers\r\tvar null1_null = getItem(\"Null 1\", SolidSource, solids_folder);\r\tif (null1_null === null) {\r\t\tvar null1_tempNull = focusdocument_comp.layers.addNull();\r\t\t\tnull1_null = null1_tempNull.source;\r\t\t\tnull1_null.name = \"Null 1\";\r\t\t\tnull1_null.mainSource.color = [1,1,1];\r\t\t\tnull1_null.parentFolder = solids_folder;\r\t\tnull1_tempNull.remove();\r\t}\r\r// Create Solid Layers\r\tvar mediumGrayredSolid1_solid = getItem(\"Medium Gray-Red Solid 1\", SolidSource, solids_folder);\r\tif (mediumGrayredSolid1_solid === null) {\r\t\tvar mediumGrayredSolid1_tempSolid = focusdocument_comp.layers.addSolid([0.51579350233078,0.19396774470806,0.19396774470806], \"Medium Gray-Red Solid 1\", 1920, 1080, 1);\r\t\t\tmediumGrayredSolid1_solid = mediumGrayredSolid1_tempSolid.source;\r\t\t\tmediumGrayredSolid1_solid.parentFolder = solids_folder;\r\t\tmediumGrayredSolid1_tempSolid.remove();\r\t}\r\tvar adjustmentLayer1_solid = getItem(\"Adjustment Layer 1\", SolidSource, solids_folder);\r\tif (adjustmentLayer1_solid === null) {\r\t\tvar adjustmentLayer1_tempSolid = focusdocument_comp.layers.addSolid([1,1,1], \"Adjustment Layer 1\", 1920, 1080, 1);\r\t\t\tadjustmentLayer1_solid = adjustmentLayer1_tempSolid.source;\r\t\t\tadjustmentLayer1_solid.parentFolder = solids_folder;\r\t\tadjustmentLayer1_tempSolid.remove();\r\t}\r\tvar whiteSolid1_solid = getItem(\"White Solid 1\", SolidSource, solids_folder);\r\tif (whiteSolid1_solid === null) {\r\t\tvar whiteSolid1_tempSolid = focusdocument_comp.layers.addSolid([1,1,1], \"White Solid 1\", 1920, 1080, 1);\r\t\t\twhiteSolid1_solid = whiteSolid1_tempSolid.source;\r\t\t\twhiteSolid1_solid.parentFolder = solids_folder;\r\t\twhiteSolid1_tempSolid.remove();\r\t}\r\r// Working with comp \"FocusDocument\", varName \"focusdocument_comp\";\r\tfocusdocument_comp.openInViewer();\r\tvar faq = focusdocument_comp.layers.addBoxText([876,1090], File.decode(\"If%20using%20this%20script,%20and%20it%20throws%20an%20error%20saying%20it%E2%80%99s%20missing%20a%20%E2%80%98pseudo%E2%80%99%20effect,%20you%20will%20need%20to%20follow%20these%20steps:\") + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"1 - Look in the mindful scripts pallete\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"2 - Run SetupFocusDocumentEffect\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"3 - after running, restart after effects\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"5 - run this script again, and it should work.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"6 - if on windows, and after restarting it still throws an error, run after effects as administrator, and it should work.\" + \"\\n\" + \r\t\t\t\t\" - if on OSX, locate:\" + \"\\n\" + \r\t\t\t\t\" /Applications/**Adobe After Effects ver**/**Adobe After Effects**.app/Contents/Resources/PresetEffects.xml\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09right%20click,%20get%20info,%20and%20adjust%20the%20%E2%80%98sharing%20&%20permissions%E2%80%99%20to%20be%20read&write%20for%20the%20current%20user\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09run%20the%20install%20script%20again.\"));\r\t\tfaq.name = \"FAQ\";\r\t\tfaq.label = 0;\r\t\tfaq.guideLayer = true;\r\t\tfaq.moveToEnd();\r\t\tvar faq_TextProp = faq.property(\"ADBE Text Properties\").property(\"ADBE Text Document\");\r\t\tvar faq_TextDocument = faq_TextProp.value;\r\t\t\tfaq_TextDocument.font = \"ArialMT\";\r\t\t\tfaq_TextDocument.fontSize = 30;\r\t\t\tfaq_TextDocument.applyFill = true;\r\t\t\tfaq_TextDocument.fillColor = [0,1,0.69411766529083];\r\t\t\tfaq_TextDocument.applyStroke = false;\r\t\t\tfaq_TextDocument.justification = ParagraphJustification.LEFT_JUSTIFY;\r\t\t\tfaq_TextDocument.tracking = 0;\r\t\t\tif (parseFloat(app.version) >= 13.2 ) {\r\t\t\t\tfaq_TextDocument.verticalScale = 1;\r\t\t\t\tfaq_TextDocument.horizontalScale = 1;\r\t\t\t\tfaq_TextDocument.baselineShift = 1;\r\t\t\t\tfaq_TextDocument.tsume = 0;\r\t\t\t\t// These values are read-only. You have to set them manually in the comp.\r\t\t\t\t// faq_TextDocument.fauxBold = false;\r\t\t\t\t// faq_TextDocument.fauxItalic = false;\r\t\t\t\t// faq_TextDocument.allCaps = false;\r\t\t\t\t// faq_TextDocument.smallCaps = false;\r\t\t\t\t// faq_TextDocument.superscript = false;\r\t\t\t\t// faq_TextDocument.subscript = false;\r\t\t\t}\r\t\t\tfaq_TextProp.setValue(faq_TextDocument);\r\t\tfaq.property(\"ADBE Transform Group\").property(\"ADBE Position\").setValue([482,612,0]);\r\t\tfaq.selected = false;\r\t// Add existing Solid Layer \"Medium Gray-Red Solid 1\", varName \"mediumGrayredSolid1_solid\";\r\tvar fg01 = focusdocument_comp.layers.add(mediumGrayredSolid1_solid);\r\t\tfg01.name = \"FG_01\";\r\t\tfg01.label = 13;\r\t\tfg01.collapseTransformation = true;\r\t\tfg01.motionBlur = true;\r\t\tfg01.moveToEnd();\r\t\tfg01.property(\"ADBE Mask Parade\").addProperty(\"ADBE Mask Atom\");\r\t\tfg01.property(\"ADBE Mask Parade\").property(1).color = [0.95686274509804,0.42745098039216,0.83921568627451];\r\t\tvar fg01MaskPath = fg01.property(\"ADBE Mask Parade\").property(1).property(\"ADBE Mask Shape\");\r\t\tvar fg01MaskPath_newShape = new Shape();\r\t\t\tfg01MaskPath_newShape.vertices = [[599.5, 82], [72, 82], [72, 445.96875], [599.5, 445.96875]];\r\t\t\tfg01MaskPath_newShape.closed = true;\r\t\tfg01MaskPath.setValue(fg01MaskPath_newShape);\r\t\tfg01.property(\"ADBE Effect Parade\").addProperty(\"Pseudo/8B30e8667aY5F\");\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0004\").setValue(0);\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0011\").setValue(1.2);\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0016\").setValue([0,0,0,1]);\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0017\").setValue(0);\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0018\").setValue(0);\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0019\").setValue(0);\r\t\tfg01.property(\"ADBE Effect Parade\").addProperty(\"ADBE Drop Shadow\");\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0001\").setValue([0,0,0,1]);\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0002\").setValue(0.50999999046326);\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0004\").setValue(0);\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0005\").setValue(1);\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Anchor Point\").setValue([335.75,263.984375,0]);\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Position\").setValue([335.75,263.984375,0]);\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Scale\").setValue([100,100,100]);\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Opacity\").setValue(100);\r\t\tfg01.selected = false;\r\t//Create new Null layer \"globalDropshadowCtrl\" and replace its source with varName \"null1_null\";\r\tvar globalDropshadowCtrl = focusdocument_comp.layers.addNull();\r\tvar globalDropshadowCtrl_source = globalDropshadowCtrl.source;\r\t\tglobalDropshadowCtrl.replaceSource(null1_null, true);\r\t\tglobalDropshadowCtrl_source.remove();\r\t\tglobalDropshadowCtrl.name = \"Global DropShadow CTRL\";\r\t\tglobalDropshadowCtrl.label = 11;\r\t\tglobalDropshadowCtrl.moveToEnd();\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").addProperty(\"ADBE Color Control\");\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(1).name = \"Drop Color\";\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(1).property(\"ADBE Color Control-0001\").setValue([0,0,0,1]);\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").addProperty(\"ADBE Slider Control\");\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(2).name = \"Drop Max Opacity\";\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Slider Control-0001\").setValue(40);\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").addProperty(\"ADBE Slider Control\");\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(3).name = \"Drop Max Distance\";\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(3).property(\"ADBE Slider Control-0001\").setValue(25);\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").addProperty(\"ADBE Slider Control\");\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(4).name = \"Drop Max Softness\";\r\t\tglobalDropshadowCtrl.property(\"ADBE Effect Parade\").property(4).property(\"ADBE Slider Control-0001\").setValue(35);\r\t\tglobalDropshadowCtrl.property(\"ADBE Transform Group\").property(\"ADBE Anchor Point\").setValue([60,60,0]);\r\t\tglobalDropshadowCtrl.property(\"ADBE Transform Group\").property(\"ADBE Position\").setValue([-74,64,0]);\r\t\tglobalDropshadowCtrl.selected = false;\r\t// Add Shape Layer \"optional item bg\", varName \"optionalItemBg\";\r\tvar optionalItemBg = focusdocument_comp.layers.addShape();\r\t\toptionalItemBg.name = \"optional item bg\";\r\t\toptionalItemBg.enabled = false;\r\t\toptionalItemBg.motionBlur = true;\r\t\toptionalItemBg.moveToEnd();\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").addProperty(\"ADBE Vector Group\");\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").property(1).name = \"Shape 1\";\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").property(1).property(2).addProperty(\"ADBE Vector Shape - Group\");\r\t\tvar optionalItemBgPath = optionalItemBg.property(\"ADBE Root Vectors Group\").property(1).property(2).property(1).property(\"ADBE Vector Shape\");\r\t\tvar optionalItemBgPath_newShape = new Shape();\r\t\t\toptionalItemBgPath_newShape.vertices = [[-238, -492], [-934, -490], [-936, -32], [-250, -38]];\r\t\t\toptionalItemBgPath_newShape.closed = true;\r\t\toptionalItemBgPath.setValue(optionalItemBgPath_newShape);\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").property(1).property(2).addProperty(\"ADBE Vector Graphic - Stroke\");\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").property(1).property(2).addProperty(\"ADBE Vector Graphic - Fill\");\r\t\toptionalItemBg.property(\"ADBE Root Vectors Group\").property(1).property(2).property(3).property(\"ADBE Vector Fill Color\").setValue([0.56887298822403,0.37883898615837,0.37883898615837,1]);\r\t\toptionalItemBg.property(\"ADBE Transform Group\").property(\"ADBE Anchor Point\").setValue([-587,-262,0]);\r\t\toptionalItemBg.property(\"ADBE Transform Group\").property(\"ADBE Position\").setValue([373,278,0]);\r\t\toptionalItemBg.property(\"ADBE Transform Group\").property(\"ADBE Opacity\").setValue(100);\r\t\toptionalItemBg.selected = false;\r\t// Add existing Solid Layer \"Adjustment Layer 1\", varName \"adjustmentLayer1_solid\";\r\tvar blurlayer = focusdocument_comp.layers.add(adjustmentLayer1_solid);\r\t\tblurlayer.name = \"BLUR_LAYER\";\r\t\tblurlayer.label = 5;\r\t\tblurlayer.adjustmentLayer = true;\r\t\tblurlayer.moveToEnd();\r\t\tblurlayer.property(\"ADBE Effect Parade\").addProperty(\"ADBE Slider Control\");\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(1).name = \"Max Blur\";\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(1).property(\"ADBE Slider Control-0001\").setValue(20);\r\t\tblurlayer.property(\"ADBE Effect Parade\").addProperty(\"ADBE Checkbox Control\");\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(2).name = \"Ext Layer CTRL\";\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Checkbox Control-0001\").setValue(1);\r\t\tblurlayer.property(\"ADBE Effect Parade\").addProperty(\"ADBE Fast Blur\");\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(3).property(\"ADBE Fast Blur-0001\").setValue(0);\r\t\tblurlayer.selected = false;\r\tvar useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst = focusdocument_comp.layers.addBoxText([876,1090], \"Use these items to create a section of any comp being highlighted.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"replace both solids with the comp of your choosing, and use the controls in FG_01 to control all options.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"when creating new highlight items, just duplicate FG_01, adjust the contents, mask location, and anchor point to center of the item.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"If using the center highlight feature, the FG item will move to the selected background anchor location.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\tFile.decode(\"Blur_layer%20is%20an%20adjustment%20layer%20that%20blurs%20everything%20underneath,%20based%20on%20any%20layer%20with%20the%20letters%20%E2%80%98FG_%E2%80%99%20in%20the%20name.\") + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"use the enabled switches to switch between scripted and manual keyframe control.\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"05*07*2016 Rob Slegtenhorst\");\r\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.label = 0;\r\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.guideLayer = true;\r\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.moveToEnd();\r\t\tvar useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextProp = useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.property(\"ADBE Text Properties\").property(\"ADBE Text Document\");\r\t\tvar useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument = useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextProp.value;\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.font = \"ArialMT\";\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.fontSize = 30;\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.applyFill = true;\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.fillColor = [0.00392000004649,0.67059004306793,0.30588001012802];\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.applyStroke = false;\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.justification = ParagraphJustification.LEFT_JUSTIFY;\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.tracking = 0;\r\t\t\tif (parseFloat(app.version) >= 13.2 ) {\r\t\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.verticalScale = 1;\r\t\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.horizontalScale = 1;\r\t\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.baselineShift = 1;\r\t\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.tsume = 0;\r\t\t\t\t// These values are read-only. You have to set them manually in the comp.\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.fauxBold = false;\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.fauxItalic = false;\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.allCaps = false;\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.smallCaps = false;\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.superscript = false;\r\t\t\t\t// useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument.subscript = false;\r\t\t\t}\r\t\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextProp.setValue(useTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst_TextDocument);\r\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.property(\"ADBE Transform Group\").property(\"ADBE Position\").setValue([1444,612,0]);\r\t\tuseTheseItemsToCreateASectionOfAnyCompBeingHighlightedReplaceBothSolidsWithTheCompOfYourChoosingAndUseTheControlsInFg01ToControlAllOptionsWhenCreatingNewHighlightItemsJustDuplicateFg01AdjustTheContentsMaskLocationAndAnchorPointToCenterOfTheItemIfUsingTheCenterHighlightFeatureTheFgItemWillMoveToTheSelectedBackgroundAnchorLocationBlurlayerIsAnAdjustmentLayerThatBlursEverythingUnderneathBasedOnAnyLayerWithTheLettersFgInTheNameUseTheEnabledSwitchesToSwitchBetweenScriptedAndManualKeyframeControl05072016RobSlegtenhorst.selected = false;\r\t// Add existing Solid Layer \"White Solid 1\", varName \"whiteSolid1_solid\";\r\tvar background = focusdocument_comp.layers.add(whiteSolid1_solid);\r\t\tbackground.name = \"BACKGROUND\";\r\t\tbackground.collapseTransformation = true;\r\t\tbackground.motionBlur = true;\r\t\tbackground.moveToEnd();\r\t\tbackground.selected = false;\r\r\r\t// Apply outOfRange values\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0005\").setValue(7);\r\r\t// Apply parents\r\t\toptionalItemBg.setParentWithJump(fg01);\r\r\r\r\t// Apply expressions to properties\r\ttry {\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0016\").expression = \"if(effect(\\\"FocusDocument\\\")(\\\"Use Global\\\") == 1 )\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09thisComp.layer(%22Global%20DropShadow%20CTRL%22).effect(%22Drop%20Color%22)(%22Color%22);\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09effect(%22FocusDocument%22)(%22DS%20Color%22);\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0017\").expression = \"if(effect(\\\"FocusDocument\\\")(\\\"Use Global\\\") == 1 )\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09thisComp.layer(%22Global%20DropShadow%20CTRL%22).effect(%22Drop%20Max%20Opacity%22)(%22Slider%22);\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09effect(%22FocusDocument%22)(%22DS%20Max%20Opacity%22);\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0018\").expression = \"if(effect(\\\"FocusDocument\\\")(\\\"Use Global\\\") == 1 )\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09thisComp.layer(%22Global%20DropShadow%20CTRL%22).effect(%22Drop%20Max%20Distance%22)(%22Slider%22);\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09effect(%22FocusDocument%22)(%22DS%20Max%20Distance%22);\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(1).property(\"Pseudo/8B30e8667aY5F-0019\").expression = \"if(effect(\\\"FocusDocument\\\")(\\\"Use Global\\\") == 1 )\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09thisComp.layer(%22Global%20DropShadow%20CTRL%22).effect(%22Drop%20Max%20Softness%22)(%22Slider%22);\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09effect(%22FocusDocument%22)(%22DS%20Max%20Softness%22);\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0001\").expression = \"effect(\\\"FocusDocument\\\")(\\\"DS Color\\\")\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0002\").expression = \"var outputVal = effect(\\\"Drop Shadow\\\")(\\\"Opacity\\\");\" + \"\\n\" + \r\t\t\t\t\"var maxVal = effect(\\\"FocusDocument\\\")(\\\"DS Max Opacity\\\");\" + \"\\n\" + \r\t\t\t\t\"var sliderVal = effect(\\\"FocusDocument\\\")(\\\"Focus Control\\\");\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"if (effect(\\\"FocusDocument\\\")(\\\"DS Enabled\\\") ==1 && effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && sliderVal >0)\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3E%20100)%20sliderVal%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3C%200)%20sliderVal%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%20maxVal%20*%20(sliderVal/100);\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%200;\") + \"\\n\" + \r\t\t\t\t\"}\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"outputVal;\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0004\").expression = \"var outputVal = effect(\\\"Drop Shadow\\\")(\\\"Distance\\\");\" + \"\\n\" + \r\t\t\t\t\"var maxVal = effect(\\\"FocusDocument\\\")(\\\"DS Max Distance\\\");\" + \"\\n\" + \r\t\t\t\t\"var sliderVal = effect(\\\"FocusDocument\\\")(\\\"Focus Control\\\");\" + \"\\n\" + \r\t\t\t\t\"var scaleFactor = effect(\\\"FocusDocument\\\")(\\\"Scale Factor\\\");\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"if (effect(\\\"FocusDocument\\\")(\\\"DS Enabled\\\") ==1 && effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && sliderVal >0)\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3E%20100)%20sliderVal%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3C%200)%20sliderVal%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%20maxVal%20*%20(sliderVal/100);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%20(maxVal%20*%20(sliderVal/100))/(scaleFactor%20*%20(sliderVal/100));\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%200;\") + \"\\n\" + \r\t\t\t\t\"}\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"outputVal;\";\r\t\tfg01.property(\"ADBE Effect Parade\").property(2).property(\"ADBE Drop Shadow-0005\").expression = \"var outputVal = effect(\\\"Drop Shadow\\\")(\\\"Distance\\\");\" + \"\\n\" + \r\t\t\t\t\"var maxVal = effect(\\\"FocusDocument\\\")(\\\"DS Max Softness\\\");\" + \"\\n\" + \r\t\t\t\t\"var sliderVal = effect(\\\"FocusDocument\\\")(\\\"Focus Control\\\");\" + \"\\n\" + \r\t\t\t\t\"var scaleFactor = effect(\\\"FocusDocument\\\")(\\\"Scale Factor\\\");\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"if (effect(\\\"FocusDocument\\\")(\\\"DS Enabled\\\") ==1 && effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && sliderVal >0)\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3E%20100)%20sliderVal%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(sliderVal%20%3C%200)%20sliderVal%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%20maxVal%20*%20(sliderVal/100);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%20(maxVal%20*%20(sliderVal/100))/(scaleFactor%20*%20(sliderVal/100));\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09outputVal%20=%200;\") + \"\\n\" + \r\t\t\t\t\"}\" + \"\\n\" + \r\t\t\t\t\"\" + \"\\n\" + \r\t\t\t\t\"outputVal;\";\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Position\").expression = \"if (effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && effect(\\\"FocusDocument\\\")(\\\"Move To Center\\\") == 0){\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20offsetX%20=%20effect(%22FocusDocument%22)(%22X%20Offset%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20offsetY%20=%20effect(%22FocusDocument%22)(%22Y%20Offset%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20percSlider%20=%20effect(%22FocusDocument%22)(%22Focus%20Control%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3E%20100)%20percSlider%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3C%200)%20percSlider%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09transform.position%20=%20%5Btransform.position%5B0%5D%20+%20(offsetX%20*%20(percSlider%20/%20100)),%20transform.position%5B1%5D%20+%20(offsetY%20*%20(percSlider%20/%20100))%5D;\") + \"\\n\" + \r\t\t\t\t\"} else if (effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && effect(\\\"FocusDocument\\\")(\\\"Move To Center\\\") == 1){\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20offsetX%20=%20effect(%22FocusDocument%22)(%22X%20Offset%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20offsetY%20=%20effect(%22FocusDocument%22)(%22Y%20Offset%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20targetX%20=%20effect(%22FocusDocument%22)(%22Center%20Ref%20Layer%22).transform.position%5B0%5D%20+%20offsetX;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20targetY%20=%20effect(%22FocusDocument%22)(%22Center%20Ref%20Layer%22).transform.position%5B1%5D%20+%20offsetY;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20travelX%20=%20targetX%20-%20transform.position%5B0%5D;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20travelY%20=%20targetY%20-%20transform.position%5B1%5D;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20percSlider%20=%20effect(%22FocusDocument%22)(%22Focus%20Control%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3E%20100)%20percSlider%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3C%200)%20percSlider%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09transform.position%20=%20%5Btransform.position%5B0%5D%20+%20(travelX%20*%20(percSlider%20/%20100)),%20transform.position%5B1%5D%20+%20(travelY%20*%20(percSlider%20/%20100))%5D;\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09transform.position\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Scale\").expression = \"if (effect(\\\"FocusDocument\\\")(\\\"Script Enabled\\\") == 1 && effect(\\\"FocusDocument\\\")(\\\"Auto Scale Enabled\\\") == 1){\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20scaleFactor%20=%20effect(%22FocusDocument%22)(%22Scale%20Factor%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20percSlider%20=%20effect(%22FocusDocument%22)(%22Focus%20Control%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3E%20100)%20percSlider%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09if%20(percSlider%20%3C%200)%20percSlider%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09transform.scale%20=%20%5Btransform.scale%5B0%5D%20*%20(1%20+%20((scaleFactor-1)%20*%20(percSlider%20/%20100))),%20transform.scale%5B1%5D%20*%20(1%20+%20((scaleFactor-1)%20*%20(percSlider%20/%20100)))%5D;\") + \"\\n\" + \r\t\t\t\t\"} else {\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09transform.scale;\") + \"\\n\" + \r\t\t\t\t\"}\";\r\t\tfg01.property(\"ADBE Transform Group\").property(\"ADBE Opacity\").expression = \"effect(\\\"FocusDocument\\\")(\\\"Focus Control\\\")*5;\";\r\t\toptionalItemBg.property(\"ADBE Transform Group\").property(\"ADBE Opacity\").expression = \"parent.effect(\\\"FocusDocument\\\")(\\\"Focus Control\\\")*2\";\r\t\tblurlayer.property(\"ADBE Effect Parade\").property(3).property(\"ADBE Fast Blur-0001\").expression = \"var outputVal = effect(\\\"Fast Blur\\\")(\\\"Blurriness\\\");\" + \"\\n\" + \r\t\t\t\t\"if (effect(\\\"Ext Layer CTRL\\\")(\\\"Checkbox\\\") == 1)\" + \"\\n\" + \r\t\t\t\t\"{\" + \"\\n\" + \r\t\t\t\tFile.decode(\"%09sCount=0;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09sRegEx=%22FG_%22;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09sSS%20=%20%22%22;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09x=thisComp.numLayers;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20maxBlur%20=%20effect(%22Max%20Blur%22)(%22Slider%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09var%20maxFoundBlur%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09for%20(sNum=1;sNum%20%3C=%20x;sNum++)%20%20\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09sLay=thisComp.layer(sNum);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09sReg=RegExp(sRegEx);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09if%20(sLay.name.match(sReg))%20%20\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09try%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09if%20(sLay.effect(%22FocusDocument%22)(%22Script%20Enabled%22)%20==%201)\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09if%20(sLay.effect(%22FocusDocument%22)(%22Focus%20Control%22)%20%3E%200%20&&%20sLay.effect(%22FocusDocument%22)(%22Focus%20Control%22)%20%3E%20maxFoundBlur)\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%09maxFoundBlur%20=%20sLay.effect(%22FocusDocument%22)(%22Focus%20Control%22);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%09if%20(maxFoundBlur%20%3E%20100)%20maxFoundBlur%20=%20100;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%09if%20(maxFoundBlur%20%3C%200)%20maxFoundBlur%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%09outputVal%20=%20maxBlur%20*%20(maxFoundBlur/100);\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09%7D\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%7D\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%7D%20catch%20(err)%7B\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%09var%20hi%20=%200;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09%7D\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%09sCount++;\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%09%7D%20%20\") + \"\\n\" + \r\t\t\t\tFile.decode(\"%09%7D;\") + \"\\n\" + \r\t\t\t\t\"}\" + \"\\n\" + \r\t\t\t\t\"outputVal;\";\r\t} catch (err) {}\r\rfocusdocument_comp.openInViewer();\r\r} catch(e) {\r\talert(e.toString() + \"\\nError on line: \" + e.line.toString());\r}\rapp.endUndoGroup();\r\r\rfunction getItem(itemName, itemInstanceName, locationObject) {\r\tif (locationObject.numItems > 0) {\r\t\tfor (var i = 1; i <= locationObject.numItems; i ++) {\r\t\t\tvar curItem = locationObject.item(i);\r\t\t\tif (curItem.name === itemName) {\r\t\t\t\tif (curItem instanceof itemInstanceName || (curItem.mainSource !== \"undefined\" && curItem.mainSource instanceof itemInstanceName)) {\r\t\t\t\t\treturn curItem;\r\t\t\t\t}\r\t\t\t}\r\t\t}\r\t}\r\treturn null;\r}\r\r}", "onFileBegin(context, reflection, node) {\n if (!node)\n return;\n // Look for @internal or @external\n let comment = getRawComment_1.getRawComment(node);\n let internalMatch = this.internalRegex.exec(comment);\n let externalMatch = this.externalRegex.exec(comment);\n if (internalMatch) {\n context.isExternal = false;\n }\n else if (externalMatch) {\n context.isExternal = true;\n }\n }", "function processFileHTML(doc){\n // parse out into blocks\n // re-assemble with new paragraph numbering\n // add style sheet\n // move assets to the assets folder\n return doc;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get details about a specific tasklist.
async getTasklist(input = { tasklistId: '0' }) { return await this.request({ name: 'tasklist.get', args: [input.tasklistId], page: Page.builder(input.pagination) }); }
[ "function getTasksOnList(listId) {\n gapi.client.request({\n 'path': '/tasks/v1/lists/' + listId + '/tasks',\n 'callback': printTasks.bind(null, listId)\n });\n}", "function listTaskLists() {\n var taskLists = Tasks.Tasklists.list();\n if (taskLists.items) {\n for (var i = 0; i < taskLists.items.length; i++) {\n var taskList = taskLists.items[i];\n Logger.log('Task list with title \"%s\" and ID \"%s\" was found.',\n taskList.title, taskList.id);\n }\n } else {\n Logger.log('No task lists found.');\n }\n}", "function getTaskDetailByTaskId(taskId, taskList) {\n\n var taskDetail = {};\n\n for (i = 0; i < taskList.length; i++) {\n if (taskList[i].taskId == taskId) {\n taskDetail = taskList[i];\n break;\n }\n }\n return taskDetail;\n}", "function getTaskLists() {\n\n}", "function getList(req, res, callback) {\n var listObj;\n // Finds a list based on list's id\n List.findOne({_id: req.params.id}, function (err, result) {\n if (err) {\n res.status(500);\n res.json({\n status: 500,\n message: \"Error finding list where task belongs to\"\n });\n } else {\n listObj = result;\n callback(listObj);\n }\n });\n }", "async getTasksByListId(req, res, next) {\n try {\n let tasks = await tasksService.getAll(req.userInfo.email, req.params.listId);\n res.send(tasks);\n } catch (error) {\n next(error);\n }\n }", "function getTaskList(indice) \n{\n RMPApplication.debug(\"begin getTaskList\");\n c_debug(dbug.task, \"=> getTaskList\");\n id_index.setValue(indice);\n var query = \"parent.number=\" + var_order_list[indice].wo_number;\n\n var options = {};\n var pattern = {\"wm_task_query\": query};\n c_debug(dbug.task, \"=> getTaskList: pattern = \", pattern);\n id_get_work_order_tasks_list_api.trigger(pattern, options, task_ok, task_ko);\n RMPApplication.debug(\"end getTaskList\");\n}", "function _extractTasks(list_id, tasks) {\n return _.filter(tasks, (t) => t.list_id === list_id)\n}", "function getTask (taskIdInput, todoList) {\n\n\tfor (let i = 0; i < todoList.length; i++) {\n\t\tif (todoList[i].taskid == taskIdInput) {\n\t\t\treturn todoList[i];\n\t\t}\n\t}\n\n\treturn null;\n}", "function getDetail() {\n Tasks.get({id: $routeParams.taskId}, function(data) {\n $scope.task = data;\n }); \n }", "function TaskList() {\n this.tasks = {}\n this.currentId = 0\n}", "function itShouldListTasks() {\n console.log('> itShouldListTasks');\n const taskId = Tasks.Tasklists.list().items[0].id;\n listTasks(taskId);\n}", "function getTaskDetails() {\n $scope.tasks = [];\n angular.forEach($scope.taskList, function(task) {\n $scope.tasks.push(task.content);\n });\n }", "function listTasks() {\n const query = datastore.createQuery('Task').order('created');\n\n datastore\n .runQuery(query)\n .then(results => {\n const tasks = results[0];\n\n console.log('Tasks:');\n tasks.forEach(task => {\n const taskKey = task[datastore.KEY];\n console.log(taskKey.id, task);\n });\n })\n .catch(err => {\n console.error('ERROR:', err);\n });\n}", "viewListInfo(){\n console.log(`${this.listName} List. Due : ${this.listDue}. Complete : ${this.isListComplete}. Number of tasks : ${this.tasks.length}.`);\n }", "list(){\n return API.ref(EP.TASK, this.id);\n }", "function processTaskLists() {\n var taskLists = Tasks.Tasklists.list();\n if (taskLists.items) {\n for (var i = 0; i < taskLists.items.length; i++) {\n var taskList = taskLists.items[i];\n processTaskList(taskList.id);\n }\n } else {\n Logger.log('No task lists found.');\n }\n}", "function getTasks() {\n fetch('/api/tasks', {\n method: 'GET',\n headers: { 'Authorization': 'Bearer ' + token }\n }).then(response => response.json())\n .then(data => {\n tasks = data.tasks;\n var html = tasks.map(task => renderTask(task)).join(\"\");\n updateById('taskListContainer', html);\n });\n}", "function listTasks(){\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
assign click events on click dodSuperDeal find a and update window.location
function DelegateClick_dodSuperDeal(){ var offerUnit = document.getElementsByClassName('dodSuperDealUnit_ev'); for(var i=0; i < offerUnit.length; i++){ offerUnit[i].addEventListener('click', function(e){ //console.log('offerUnit clicked!'); var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var this_offerUnit = this; var this_liveTimerOffer_href = this_offerUnit.children[0].children[0].children[0].getAttribute('href'); //console.log(this_liveTimerOffer_href); if(!this_liveTimerOffer_href){ console.log('dodSuperDealUnit_ev ahref not found, return'); return; } if (windowWidth > 768) { window.open(this_liveTimerOffer_href, '_blank'); } else { window.location.href = this_liveTimerOffer_href; } e.preventDefault(); }); } }
[ "function handleClick(d, i) {\n window.location = \"index.php?us_state=\"+this.id+\"/\";\n }", "function init_href_click_event(){\n\t\t$('.hotel-detail-href').unbind('click');\n\t\t$('.hotel-detail-href').click(function(){\n\t\t\t$.ajax({\n\t\t\t\turl: this.href.replace(/hotels\\/[0-9]*\\?/,\"hotels/check_show?\")\n\t\t\t})\n\t\t\treturn false;\t\n\t\t});\n\t}", "function ClickToNextPage() {\n \t/*\n * Double click row table to StudentPage\n * Code : diennv\n * */\n $('table.table_stList tbody tr').dblclick(function () {\n window.location.href = $(this).data('href');\n //window.open($(this).data('href'), $(this).data('target'));\n });\n /*\n * Click to icon tracking to TrackPage\n * */\n $('table.table_stList tr td#btn-track a').click(function () {\n window.location.href = $(this).data('href');\n });\n }", "function audButton(sel){\n var get = \"/updatePage?s=\" + sel.toString();\n window.location.href = get;\n event.preventDefault();\n}", "clickOurPassion() {\n this.clickElem(this.lnkOurPassion);\n }", "function updateA(){\n\t$(\"a\").each(function(){\n\t\tvar click = $(this).attr('onclick');\n\t\tif(click != null){\n\t\t\tif(click.indexOf(\"guardarIdComponenteController(this);\") == -1){\n\t\t\t\tclick = \"guardarIdComponenteController(this);\"+click;\n\t\t\t\t$(this).attr('onclick', click);\n\t\t\t}\n\t\t}\n\t});\n}", "function selectQuoteHandler() {\n $('.js-results').on('click', '.js-result-item', function(event) {\n window.location.href = ($(this).attr('data-url'));\n });\n}", "function hotelClick(){\t\n\tlet hotelCards = document.getElementsByClassName(\"hotel-card\");\n\tfor(let j = 0; j < hotelCards.length; j++){\n\t\thotelCards[j].style.cursor = \"pointer\";\n\t\thotelCards[j].addEventListener(\"click\", ()=>{\n\t\t\tlet hotelId = hotelCards[j].id.split(\"-\")[0];\n\t\t\twindow.location.href = `detail.html?id=${hotelId}`;\n\t\t})\n\t}\n}", "function clickEntity(id){\n var host = $window.location.host;\n $window.location.href = \"http://\" + host + \"/entity/\" + id;\n }", "performClickFunctionality(){}", "function clickableBoxes(){\n\t\twindow.location=$(this).find(\"a\").attr(\"href\"); \n \treturn false;\n\t}", "function onclick( packet ){\n //Navigate to packet vis of selected packet\n window.location.href = \"/packet?id=\"+packet._id;\n}", "handleClick(e) {\n\t\tconst id = $(e.currentTarget).attr('href');\n\n\t\tVeams.Vent.trigger(Veams.EVENTS.navigation.clicked, id);\n\t\te.preventDefault();\n\t}", "function onClick() {\n $(document).click(function (event) {\n let redirectLink = $(event.target).attr(\"href\");\n redirectLink += \"?classname=\" + className;\n $(event.target).attr(\"href\", redirectLink);\n });\n}", "function linkClick(el) {\n let selPage = el.target.getAttribute(\"data-page\");\n if (selPage != curPage) {\n if (selPage == 1) {\n navigateUp();\n } else {\n navigateDown();\n }\n }\n }", "function assignEventToBackLink() {\n $('.safetyBackLinkSection .tabNametoGo').click(function() {\n\n $('#safetyLinkToBack').html();\n //route back to payer tab\n window.location = 'javascript:Router.go(\"Payer\");';\n });\n}", "function handleBugClick()\n{\n $(\".bugHomeClick\").click(function()\n {\n var id = $(this).attr(\"id\");\n\n window.location = SITE_URL + \"bug/view/\" + id;\n })\n}", "function gotoExportToServerPage(i, id) {\r\n $(\"#xyz\" + i).on(\"click\", function () {\r\n if (window.location.pathname.toLowerCase().indexOf(\"enhancedsearchresults.aspx\") != -1) {\r\n console.log(\"cursor in not saved yet click in enhansed search page\");\r\n if ($(id + ' tr:eq(' + i + ') label span')[1]) {\r\n $(id + ' tr:eq(' + i + ') label span')[1].click();\r\n }\r\n }\r\n else {\r\n i = i + 2;\r\n if ($(id + ' tr:eq(' + i + ') td:eq(1) span:eq(0)')) {\r\n $(id + ' tr:eq(' + i + ') td:eq(1) span:eq(0)').click();\r\n }\r\n else if ($(id + ' tr:eq(' + i + ') td:eq(2) .actionView span')) {\r\n $(id + ' tr:eq(' + i + ') td:eq(2) .actionView span').click();\r\n }\r\n }\r\n });\r\n}", "function hospitalClickHndlr() {\r\n\r\n\r\n $(\"a[name=linkTo]\").click(function(e) {\r\n e.preventDefault();\r\n \r\n $(\"#collapseHospital\").collapse('hide');\r\n $('#hospitalTab a:first').tab('show'); \r\n var showItem = e.target.parentNode.parentNode;\r\n \r\n var hid=$(this).attr(\"href\");\r\n $('input[name=hid]').val(hid);\r\n\r\n changeURL(\"hospitals?hid=\"+hid);\r\n //add vet list\r\n getVetData(hid); //get vets data\r\n });\r\n /**handler favorite add and remove**/\r\n $(\"a[name=favorite_btn]\").click(function(){\r\n\r\n var isSelect=$(this).find('i').hasClass('icon-white');\r\n if(isSelect){\r\n $(this).find('i').removeClass('icon-white');\r\n }else{\r\n $(this).find('i').addClass('icon-white');\r\n }\r\n });\r\n /**handler favorite add and remove(end)**/ \r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Redraws all dependencies if a rows height changed, as detected in onTranslateRow
onChangeTotalHeight() { // redraw all dependencies if the height changes. Could be caused by resource add/remove. // in reality not all deps needs to be redrawn, those fully above the row which changed height could be left // as is, but determining that would likely require more processing than redrawing this.scheduleDraw(true); }
[ "onChangeTotalHeight() {\n if (this.client.isEngineReady) {\n // redraw all dependencies if the height changes. Could be caused by resource add/remove.\n // in reality not all deps needs to be redrawn, those fully above the row which changed height could be left\n // as is, but determining that would likely require more processing than redrawing\n this.scheduleDraw(true);\n }\n }", "recalculateAllRowsHeight() {\n if (isVisible(this.hot.view.wt.wtTable.TABLE)) {\n this.clearCache();\n this.calculateAllRowsHeight();\n }\n }", "updateElementsHeight() {\n const me = this;\n me.rowManager.storeKnownHeight(me.id, me.height); // prevent unnecessary style updates\n\n if (me.lastHeight !== me.height) {\n const elements = me._elementsArray;\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].style.height = `${me.offsetHeight}px`;\n }\n\n me.lastHeight = me.height;\n }\n }", "updateElementsHeight() {\n const me = this;\n\n me.rowManager.storeKnownHeight(me.id, me.height);\n\n // prevent unnecessary style updates\n if (me.lastHeight !== me.height) {\n const elements = me._elementsArray;\n\n for (let i = 0; i < elements.length; i++) {\n elements[i].style.height = `${me.offsetHeight}px`;\n }\n me.lastHeight = me.height;\n }\n }", "onRowHeightChange (height) {\n this.state.row.height = height;\n this.calculateTaskListColumnsDimensions();\n }", "resizeRow(i, dy = 0) {\n const row = this._rows[i];\n if (!row) return;\n\n // Height adjustment\n const newHeight = this.config.compactRows\n ? row.minHeight\n : Math.max(row.rh + dy, row.minHeight);\n if (row.rh !== newHeight) {\n row.height(newHeight);\n row.redrawLinksAndClusters();\n }\n\n // Adjust position/height of all following Rows\n for (i = i + 1; i < this._rows.length; i++) {\n const prevRow = this._rows[i - 1];\n const thisRow = this._rows[i];\n\n // Height check\n let changed = false;\n const newHeight = this.config.compactRows\n ? thisRow.minHeight\n : Math.max(thisRow.rh, thisRow.minHeight);\n if (thisRow.rh !== newHeight) {\n thisRow.height(newHeight);\n changed = true;\n }\n\n // Position check\n if (thisRow.ry !== prevRow.ry2) {\n thisRow.move(prevRow.ry2);\n changed = true;\n }\n\n if (changed) {\n thisRow.redrawLinksAndClusters();\n }\n }\n\n this._svg.height(this.lastRow.ry2 + 20);\n }", "onRowHeightChange(height) {\n this.$store.commit(this.updateOptionsMut, { row: { height: height } });\n this.calculateTaskListColumnsDimensions();\n }", "function updateHeight() {\n var offset = 0;\n active_headers.forEach(function(key){\n offset += map_headers[key].getHeight();\n });\n var height_after_offset = grid_height - offset;\n //get the amount of selected graphs\n var amount_selected = findAmountSelected();\n //determine the amount of space allocated to selected- and unselected graphs\n var total_selected_height = height_after_offset * selected_heights[amount_selected];\n var total_unselected_height = height_after_offset - total_selected_height;\n //for every graph in map_graph\n for (var key in map_graph) {\n //determine the new height\n var new_height;\n if(map_selected[key])\n new_height = total_selected_height/amount_selected;\n else \n new_height = total_unselected_height/(Object.keys(map_graph).length - amount_selected);\n //give the graph the command to update his height\n map_graph[key].setHeight(new_height);\n //call for a relayout\n packery_grid.layout(); \n } \n }", "onRowsRerender() {\n this.scheduleDraw(true);\n }", "onColumnResized() {\r\n this.gridApi.resetRowHeights();\r\n }", "setRowsHeight() {\n const isNew = theme.currentTheme.id && (theme.currentTheme.id.indexOf('uplift') > -1 || theme.currentTheme.id.indexOf('new') > -1);\n if (this.settings?.rows?.editor) {\n this.element.height(Number(this.settings?.rows?.editor) * (isNew ? 26 : 22.2));\n }\n\n if (this.settings?.rows?.source) {\n this.element.parent().find('.editor-source').height((Number(this.settings?.rows?.source) * (isNew ? 26 : 26)) + 15);\n }\n }", "refreshRowHeightCache() {\n if (!this.scrollbarV || (this.scrollbarV && !this.virtualization)) {\n return;\n }\n // clear the previous row height cache if already present.\n // this is useful during sorts, filters where the state of the\n // rows array is changed.\n this.rowHeightsCache.clearCache();\n // Initialize the tree only if there are rows inside the tree.\n if (this.rows && this.rows.length) {\n const rowExpansions = new Set();\n for (const row of this.rows) {\n if (this.getRowExpanded(row)) {\n rowExpansions.add(row);\n }\n }\n this.rowHeightsCache.initCache({\n rows: this.rows,\n rowHeight: this.rowHeight,\n detailRowHeight: this.getDetailRowHeight,\n externalVirtual: this.scrollbarV && this.externalPaging,\n rowCount: this.rowCount,\n rowIndexes: this.rowIndexes,\n rowExpansions\n });\n }\n }", "function onVisibleRowsChange() {\n const top = state.get('config.scroll.top');\n verticalScrollAreaStyleMap.style.width = '1px';\n verticalScrollAreaStyleMap.style.height = rowsHeight + 'px';\n if (elementScrollTop !== top && verticalScrollBarElement) {\n elementScrollTop = top;\n verticalScrollBarElement.scrollTop = top;\n }\n update();\n }", "innerHeightDependsOnChilds(){if(this.__controlStretchedHeight)return!0;if(this.__rowOptions)for(const rowOption of this.__rowOptions)if(\"Content\"===rowOption.heightMode)return!0;return super.innerHeightDependsOnChilds()}", "innerHeightDependsOnChilds(){if(this.__controlStretchedHeight)return!0;if(this.__rowOptions)for(const e of this.__rowOptions)if(\"Content\"===e.heightMode)return!0;return super.innerHeightDependsOnChilds()}", "updatePosition(){\n\t\tlet activeRowCount = 0;\n\t\tlet tableHeight = 0;\n\t\tfor(let i = 0; i < this.table.length; i++){\n\t\t\tif(this.table.children[i].visible){\n\t\t\t\tactiveRowCount += 1;\n\t\t\t\tthis.table.children[i].y = (this.config.rowHeight * activeRowCount) - this.config.rowHeight;\n\t\t\t}\n\t\t}\n\n\t\tthis.height = (activeRowCount * this.config.rowHeight) - this.config.rowHeight;\n\t}", "function setRowsHeight() {\n// var ulHeight = (options.items * options.height) + \"px\";\n// rows.css(\"height\", ulHeight);\n }", "UpdateRowHeight() {\n this.RowHeight = tp.GetLineHeight(this.Handle, 1.8);\n this.ColumnHeight = Math.ceil(this.RowHeight * 1.3);\n this.GroupPanelHeight = Math.ceil(this.ColumnHeight * 1.2);\n\n this.GroupCellWidth = this.RowHeight;\n }", "updateInnerHeightDependingOnChilds(){}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use a binary search to find the index of the codeword corresponding to this symbol.
findCodewordIndex(symbol) { let first = 0; let upto = this.SYMBOL_TABLE.length; while (first < upto) { let mid = (first + upto) >>> 1; // Compute mid point. if (symbol < this.SYMBOL_TABLE[mid]) { upto = mid; // repeat search in bottom half. } else if (symbol > this.SYMBOL_TABLE[mid]) { first = mid + 1; // Repeat search in top half. } else { return mid; // Found it. return position } } return -1; // if (debug) System.out.println("Failed to find codeword for Symbol=" + // symbol); }
[ "_indexOf(symbol) {\n if (symbol) {\n symbol = symbol.toUpperCase();\n for (let i = 0; i < this._items.length; i++) {\n /* eslint-disable-next-line eqeqeq */\n if (this._items[i].symbol == symbol) {\n return i;\n }\n }\n }\n return -1;\n }", "function lookupSymbol(symbol) {\n var i;\n\n for (i = 1; i < element(1,\"max\"); i++) {\n if ( element(i,\"symbol\") == symbol )\n return i;\n }\n return 0;\n }", "function find_index(Wheel,letter){\r\n\tvar index = search_char(Wheel, letter);\r\n\treturn index; \r\n}", "function wordIndex(word){\n\tfor(var i = 0; i < db.w.length; i++)\n\t\tif(db.w[i].word === word)\n\t\t\treturn i;\n\treturn -1;\n}", "getIndexFromCode(code) {\n return parseInt(code.join(''), this.radix);\n }", "function binarySearch(arr, key) {\n}", "function getSymbolIndex(str, symbol) {\r\n let sp = str.split('');\r\n for (let v = 0; v < sp.length; v++) {\r\n if (sp[v] === (symbol)) {\r\n return v;\r\n }\r\n }\n return -1;\r\n}", "indexOf(searchWord, fromIndex) {\n let _tokens = this._tokens;\n fromIndex = parseInt(fromIndex, 10);\n if(Number.isNaN(fromIndex)) {\n fromIndex = 0;\n }\n else if(fromIndex < 0 || fromIndex >= _tokens.length) {\n return -1;\n }\n for(let i = fromIndex; i < _tokens.length; i++) {\n let token = _tokens[i].token;\n if(token === searchWord) {\n return i;\n }\n }\n return -1;\n }", "function binarySearch(arr, val) {}", "function symbol(m, c){\n\t\treturn m.indexOf(c);\n\t }", "indexOf(firstWord) {\n if (!this.has(firstWord)) return -1\n const length = this.length\n const nodes = this._getChildrenArray()\n for (let index = 0; index < length; index++) {\n if (nodes[index].getFirstWord() === firstWord) return index\n }\n }", "getCode(term){\n term = term.toLowerCase();\n for(var i in this.codes){\n if(this.codes[i].de.toLowerCase() == term || this.codes[i].en.toLowerCase() == term){\n return this.codes[i].code;\n }\n }\n throw \"term <\" + term + \"> not found\";\n }", "function find_symbol( label, kind, special )\n{\n\tif( !special )\n\t\tspecial = SPECIAL_NO_SPECIAL;\n\n\tfor( var i = 0; i < symbols.length; i++ )\n\t{\n\t\tif( symbols[i].label.toString() == label.toString()\n\t\t\t&& symbols[i].kind == kind\n\t\t\t\t&& symbols[i].special == special )\n\t\t{\n\t\t\treturn i;\n\t\t}\n\t}\n\t\n\treturn -1;\n}", "function binarySearchIndex(array, target) {\n\n}", "function find_symbol( label, kind, special )\n{\n\tif( !special )\n\t\tspecial = SPECIAL_NO_SPECIAL;\n\tfor( var i = 0; i < symbols.length; i++ )\n\t\tif( symbols[i].label.toString() == label.toString()\n\t\t\t&& symbols[i].kind == kind\n\t\t\t\t&& symbols[i].special == special )\n\t\t\treturn i;\n\treturn -1;\n}", "function cariIndex(numbers, numSearch, yangKe) {\n // your code here\n var found = 0;\n var position;\n for (let i=0; i<numbers.length; i++) {\n if (numbers[i] == numSearch) {\n found++;\n position = i;\n }\n if (yangKe == found) {\n return position;\n }\n }\n return -1;\n}", "function getIndexOf(acc)\n{\n for ( var i=0; i<Bank.length; i++ )\n {\n if (Bank[i].accNo === acc)\n {\n return i;\n }\n }\n return -1;\n}", "static binarySearchObject(arr, ele, key) {\n\t\tlet low = 0\n\t\tlet high = arr.length - 1\n\t\twhile(low <= high) {\n\t\t\tlet mid = Math.floor((low + high) / 2)\n\t\t\tlet sym = arr[mid][key]\n\t\t\tif(sym > ele[key]) {\n\t\t\t\thigh = mid - 1\n\t\t\t} else if(sym < ele[key]) {\n\t\t\t\tlow = mid + 1\n\t\t\t} else {\n\t\t\t\treturn mid\n\t\t\t}\n\t\t}\n\t\treturn low\n\t}", "function secondIndex(text,symbol){\n for(let i = 0; i < text.length; i++){\n let letter = text.charAt(i);\n let firstInstIndex = text.indexOf(letter);\n let secondInstIndex = text.indexOf(letter,(firstInstIndex + 1));\n if(letter === symbol && secondInstIndex > 0){\n return secondInstIndex;\n }\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Types: / A Snake initially of length 1 at position x y in cell coordinates, moving in given direction The head of a snake is a cell. Its body consists of a list of other cells
function Snake(x, y, dir) { this.head = new Cell(x, y); this.body = []; // array of Cell this.dir = dir; this.nextdir = dir; this.belly = 0; // the amount of food currently eaten this.score = 0; // Return length of this snake this.len = function() { return 1 + this.body.length; }; // Increase snake length by 1 by stretching head in set dir this.grow = function() { this.body.push(this.head); this.head = cell(this.head.getX(), this.head.getY()); }; // Removes all the divs of this snake from the game this.del = function() { this.head.div.remove(); this.body.forEach(function(cell) { cell.div.remove(); }); } }
[ "setSnakeHead(pos, direction) {\n const cell = this.getCell(pos);\n cell.classList.add(SNAKE_BODY_CLASS, SNAKE_HEAD_CLASS);\n if (direction === UP) {\n cell.classList.add(SNAKE_UP_CLASS);\n } else if (direction === DOWN) {\n cell.classList.add(SNAKE_DOWN_CLASS);\n } else if (direction === LEFT) {\n cell.classList.add(SNAKE_LEFT_CLASS);\n } else if (direction === RIGHT) {\n cell.classList.add(SNAKE_RIGHT_CLASS);\n }\n }", "function moveSnake(direction) {\n // get y, x coordinates of head cell\n let [y, x] = snake[0].split(\"-\").map(Number);\n\n // get y.x of new head from the direction\n if (direction === \"UP\") y -= 1;\n else if (direction === \"DOWN\") y += 1;\n else if (direction === \"LEFT\") x -= 1;\n else if (direction === \"RIGHT\") x += 1;\n\n // check for crash into wall\n if (x < 0 || x >= NCOLS || y < 0 || y >= NROWS) {\n return endGame(\"Game over: crashed into wall\");\n }\n\n // draw the new head\n let newHead = y + \"-\" + x;\n setCellStyle(\"snake\", newHead);\n\n // if new head collides with snake, end game\n if (snake.includes(newHead)) {\n return endGame(\"Game over: crashed into self\");\n }\n\n // add new head to start of snake\n snake.unshift(newHead);\n\n // handle eating/not eating a pellet\n if (pellets.delete(newHead)) {\n // ate pellet: don't delete tail (snake grows), replace pellet\n addPellet();\n } else {\n // didn't eat pellet: pop off tail & remove style from table cell\n setCellStyle(null, snake.pop());\n }\n}", "function addSnakeBodyBasedOnDirection() {\n switch (snake.currentDirection) {\n case \"right\":\n snake.snakeList.splice(1, 0, {\n x: snake.snakeList[0].x + snake.width,\n y: snake.snakeList[0].y,\n });\n food.createNewFood();\n snake.incrementFoodEaten();\n break;\n case \"left\":\n snake.snakeList.splice(1, 0, {\n x: snake.snakeList[0].x - snake.width,\n y: snake.snakeList[0].y,\n });\n food.createNewFood();\n snake.incrementFoodEaten();\n break;\n case \"up\":\n snake.snakeList.splice(1, 0, {\n x: snake.snakeList[0].x,\n y: snake.snakeList[0].y - snake.height,\n });\n food.createNewFood();\n snake.incrementFoodEaten();\n\n break;\n case \"down\":\n snake.snakeList.splice(1, 0, {\n x: snake.snakeList[0].x,\n y: snake.snakeList[0].y + -snake.height,\n });\n food.createNewFood();\n snake.incrementFoodEaten();\n break;\n\n default:\n break;\n }\n}", "function move()\n{\n\tvar nx = Math.round(snake_array[0].x);\n\tvar ny = Math.round(snake_array[0].y);\n\t//These were the position of the head cell.\n\t//We will increment it to get the new head position\n\t//Lets add proper direction based movement now\n\t//nx and ny stand for next x and next y\n\n\tif(d == \"right\") nx++;\n\telse if(d == \"left\") nx--;\n\telse if(d == \"up\") ny--;\n\telse if(d == \"down\") ny++;\n\tconsole.log(nx.toString()+\":\"+ny.toString());\n\tvar tail = {x:nx,y:ny};\n\tif (nx>=0) {\n\t\t\ttail.x = nx%Math.round(w/cw); \n\t\t}\n\t\telse {\n\t\t\ttail.x = w/cw+nx%Math.round(w/cw); \n\t\t}\n\tif (ny>=0) {\n\t\t\ttail.y = ny%Math.round(h/cw);\n\t\t}\n\t\telse {\n\t\t\ttail.y = h/cw+ny%Math.round(h/cw); \n\t\t}\n\t//Lets add the game over clauses now\n\t//This will restart the game if the snake hits the wall\n\t//Lets add the code for body collision\n\t//Now if the head of the snake bumps into its body, the game will restart\t\t\n\tif(check_collision(nx, ny, snake_array))\n\t{\t\t\n\t\tgame_status = \"lose\";\n\t\tclearInterval(game_loop);\n\t\tdocument.getElementById(\"idButton\").value = \"Reset\";\n\t\talert(\"Game over!\");\n\t}\n\tsnake_array.unshift(tail);\n\t\n\t//Lets write the code to make the snake eat the food\n\t//The logic is simple\n\t//If the new head position matches with that of the food,\n\t//Create a new head instead of moving the tail\n\tnx = tail.x;\n\tny = tail.y;\n\tif(nx == food.x && ny == food.y)\t\n\t{\n\t\tvar tail = {x: nx, y: ny};\n\t\tscore++;\n\t\t//Create new food\n\t\tcreate_food();\n\t\tsnake_array.push(tail);\n\t}\n\telse\n\t{\n\tsnake_array.pop();\n\t}\n\tpaint();\n}", "updateSnake() {\n let snakeX = this.snakeTiles[0].x;\n let snakeY = this.snakeTiles[0].y;\n\n if( this.direction == \"LEFT\" ) {\n snakeX -= this.tileSize;\n } else if( this.direction == \"UP\" ) {\n snakeY -= this.tileSize;\n } else if( this.direction == \"RIGHT\" ) {\n snakeX += this.tileSize;\n } else if( this.direction == \"DOWN\" ) {\n snakeY += this.tileSize;\n }\n\n this.newHead = {\n x : snakeX,\n y : snakeY\n };\n }", "function updateSnake() {\n\n // Every time the snake head moves, add that index to the snake array so that we keep the history of where it's been\n snakeArray.push(snakePosition)\n\n // But then only render the last X cells according to the latest snake size\n renderArray = snakeArray.slice(-snakeLength)\n\n // Depending on what direction the snake is going, rotate the head accordingly in preparation for rendering\n let headAngle = 0\n switch (currentDirection) {\n case 37:\n headAngle = 180\n break\n case 39:\n headAngle = 0\n break\n case 38:\n headAngle = 270\n break\n case 40:\n headAngle = 90\n break\n }\n\n // Then iterate through the cells that contain the snake in order to render them\n for (x of snakeArray) { // Check everywhere that the snake has been to\n if (renderArray.includes(x)) { // If it's currently part of the snake\n if (renderArray.indexOf(x) == renderArray.length - 1) { // If it's the head, i.e. the last cell in the array\n cells[x].classList.remove('snake') // Stop rendering the body\n cells[x].setAttribute('style', 'transform: rotate(' + headAngle + 'deg)') // Rotate the head\n cells[x].classList.add('snakeHead') // Render the head after it's been rotated\n } else { // Otherwise, for the remaining cells just render the body\n cells[x].classList.remove('snakeHead')\n cells[x].classList.add('snake')\n }\n } else { // Otherwise, for all remaining locations stop rendering and rotate back to normal\n cells[x].classList.remove('snake')\n cells[x].classList.remove('snakeHead')\n cells[x].setAttribute('style', 'transform: rotate(0deg)')\n }\n }\n }", "function move() {\n switch (direction) {\n case 'u':\n if ((head.y)-15 >= 0) {\n var new_head = {x:head.x, y:head.y-15};\n snake.pop();\n snake.unshift(new_head);\n pre_direction = 'u';\n } else {\n quit();\n }\n break;\n case 'd':\n if ((head.y)+15 <= canvas.height) {\n var new_head = {x:head.x, y:head.y+15};\n snake.pop();\n snake.unshift(new_head);\n pre_direction = 'd';\n } else {\n quit();\n }\n break;\n case 'r':\n if ((head.x)+15 <= canvas.width) {\n var new_head = {x:head.x+15, y:head.y};\n snake.pop();\n snake.unshift(new_head); \n pre_direction = 'r';\n } else {\n quit();\n } \n break;\n case 'l':\n if ((head.x)-15 >= 0) {\n var new_head = {x:head.x-15, y:head.y};\n snake.pop();\n snake.unshift(new_head); \n pre_direction = 'l';\n } else {\n quit();\n }\n break;\n }\n \n if (check_eaten()) {\n quit();\n }\n head = snake[0];\n get_food();\n render();\n}", "function moveSnake() {\n $.each(snake, function (index, value) {\n snake[index].oldX = value.x;\n snake[index].oldY = value.y;\n\n // head\n if (index == 0) {\n if (keyPressed === down) {\n snake[index].y = value.y + blockSize;\n } else if (keyPressed === up) {\n snake[index].y = value.y - blockSize;\n } else if (keyPressed === right) {\n snake[index].x = value.x + blockSize;\n } else if (keyPressed === left) {\n snake[index].x = value.x - blockSize;\n }\n } \n // body\n else {\n snake[index].x = snake[index - 1].oldX;\n snake[index].y = snake[index - 1].oldY;\n }\n });\n }", "function Snake() {\n this.nodes = [];\n this.direction = \"left\";\n this.group = new Kinetic.Group();\n this.layer = new Kinetic.Layer();\n this.length = 0;\n\n this.layer.add(this.group);\n this.add(); // head\n this.add(); // tail\n this.move();\n this.add(); // nodes\n this.move();\n count = 0;\n\n stage.add(this.layer);\n }", "move(){\n for(let i = this.snake.length - 1; i > 0; i--){\n this.snake[i].style.left = `${this.snake[i - 1].offsetLeft}px`;\n this.snake[i].style.top = `${this.snake[i - 1].offsetTop}px`;\n }\n switch(this.direction){\n case LEFT:\n this.snakeHead.style.left = `${this.snakeHead.offsetLeft - this.cellWidth}px`;\n break;\n case UP:\n this.snakeHead.style.top = `${this.snakeHead.offsetTop - this.cellWidth}px`;\n break;\n case RIGHT:\n this.snakeHead.style.left = `${this.snakeHead.offsetLeft + this.cellWidth}px`;\n break;\n case DOWN:\n this.snakeHead.style.top = `${this.snakeHead.offsetTop + this.cellWidth}px`;\n break;\n }\n this.lastDirection = this.direction;\n }", "function Snake(options){\n this.initialSize = options.size\n this.size = options.size\n\n // a queue data structure, fist in : tail, last in: head\n // used with push and shift\n this.body = [options.position]\n this.getHead().move = options.direction\n this.getHead().turn = options.direction\n\n // the current quantity of water accumulated\n this.initialWater = options.waterStock\n this.water = options.waterStock\n\n // the direction of the head\n this.direction = options.direction\n }", "moveSnake(){\n\t\t\tlet head = this.growth[0];\n\t\t\tlet newHead;\n\t\t\t\n\t\t\t/*\n\t\t\tsets the current direction to next direction and updates the direction of \n\t\t\tthe snake to the latest pressed direction by the player.\n\t\t\t*/\n\t\t\tthis.currDirection = this.nextDirection;\n\t\t\tif(this.currDirection === 'right'){\n\t\t\t\tnewHead = new Roles(head.x + 1, head.y);\n\t\t\t}\n\t\t\telse if(this.currDirection === 'left'){\n\t\t\t\tnewHead = new Roles(head.x - 1, head.y);\n\t\t\t}\n\t\t\telse if(this.currDirection === 'down'){\n\t\t\t\tnewHead = new Roles(head.x, head.y + 1);\n\t\t\t}\n\t\t\telse if(this.currDirection === 'up'){\n\t\t\t\tnewHead = new Roles(head.x, head.y - 1);\n\t\t\t}\n\n\t\t\t//console.log(newHead);\n\n\t\t\t//checks if the snake has collided with itself or with the wall\n\t\t\tif(this.checkCollision(newHead)){\n\t\t\t\tendGame();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.growth.unshift(newHead);\n\n\t\t\t//checks if the position of the head of the snake and food are same\n\t\t\tif(newHead.checkCollisionRoles(foodObj.position)){\n\t\t\t\tupdateScore(++scoreValue);\n\t\t\t\tfoodObj.moveFood();\n\t\t\t}\n\t\t\telse{\n\t\t\t\tthis.growth.pop();\n\t\t\t}\n\n\t\t}", "function updateSnakePosition() {\n let currentSnakeHeadX = snake[0].x;\n let currentSnakeHeadY = snake[0].y;\n switch (direction) {\n case \"left\":\n snake.unshift({\n x: currentSnakeHeadX - box,\n y: currentSnakeHeadY\n });\n break;\n case \"right\":\n snake.unshift({\n x: currentSnakeHeadX + box,\n y: currentSnakeHeadY\n });\n break;\n case \"up\":\n snake.unshift({\n x: currentSnakeHeadX,\n y: currentSnakeHeadY - box\n });\n break;\n case \"down\":\n snake.unshift({\n x: currentSnakeHeadX,\n y: currentSnakeHeadY + box\n });\n break;\n default:\n break;\n }\n}", "function changeSnakePosition() {\r\n\theadX = headX + xVelocity;\r\n\theadY = headY + yVelocity;\r\n\r\n}", "moveSnakeHead(x, y) {\n if (this.snakeLastDirection === \"D\") {\n return [x, y+1]\n }\n else if (this.snakeLastDirection === \"U\") {\n return [x, y-1]\n }\n else if (this.snakeLastDirection === \"L\") {\n return [x-1, y]\n }\n else if (this.snakeLastDirection === \"R\") {\n return [x+1, y]\n }\n }", "renderBody(direction, didPoorSnakeEat) {\n !didPoorSnakeEat && this.body.splice(-1);\n this.moveAndHiss()[direction]();\n\n this.body = [this.head, ...this.body];\n const bodyLength = this.body.length;\n this.body.forEach((part, index) => {\n let block = snakePaper.rect(part.x, part.y, blockSize, blockSize);\n block.attr(\"fill\", \"#FF0000\");\n block.attr(\"stroke\", \"#FFFFFF\");\n block.blur();\n block.attr(\"opacity\", 1.0 - index/(bodyLength * 2))\n });\n }", "function snakePosition() {\n\tlet x = currentPosition['x'];\n\tlet y = currentPosition['y'];\n\tlet head = snake.push({x: x, y: y}); \n\t\n\tfor (var i = 0; i < snakeLength; i++) {\n\t\tx -= 10\n\t\tsnake.push({\n\t\t\tx: x,\n\t\t\ty: y\n\t\t});\n\t}\n}", "function moveSnakeForward() {\n tail0 = tail[0];\n for (let i = 0; i < tail.length - 1; i++) {\n tail[i] = tail[i + 1];\n }\n tail[totalTail - 1] = { tailX: snakeHeadX, tailY: snakeHeadY };\n snakeHeadX += xSpeed;\n snakeHeadY += ySpeed;\n}", "function moveSnakeBody(prevRow, prevCol) {\n\tlet snakeNode = SNAKE_LL; //Start out 'snakeNode' as the head. This will get immediately replaced with the first non-head body part.\n\tlet tempPrevRow, tempPrevCol;\n\t//While there's still a body part to move...\n\twhile (snakeNode.prev) {\n\t\tsnakeNode = snakeNode.prev;\n\t\t//Get the node's current position (which will become the previous position).\n\t\ttempPrevRow = snakeNode.r;\n\t\ttempPrevCol = snakeNode.c;\n\t\t//Give this node a new position..\n\t\tsnakeNode.r = prevRow;\n\t\tsnakeNode.c = prevCol;\n\t\t//Officially move this body part.\n\t\tSNAKE_BOARD_LOGICAL[tempPrevRow][tempPrevCol] = EMPTY;\n\t\tSNAKE_BOARD_LOGICAL[prevRow][prevCol] = SNAKE_BODY;\n\t\t//Set up for the next iteration.\n\t\tprevRow = tempPrevRow;\n\t\tprevCol = tempPrevCol;\n\t}\n\t//Return information about the current tail. If the snake has just eaten a fruit, this will be needed in order to create a new tail.\n\treturn {\"r\": prevRow, \"c\": prevCol, \"previousTail\": snakeNode};\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Master Words IgnoreList / getIgnoreKeywords_allWords() Concat together the masterlist of handchosen, commonwords for exclusion.
function getIgnoreKeywords_allWords() { var ignorekeywords = []; ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_symbolWords()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_numberWords()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_A_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_B_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_C_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_D_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_E_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_F_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_G_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_H_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_I_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_J_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_K_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_L_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_M_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_N_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_O_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_P_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_Q_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_R_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_S_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_T_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_U_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_V_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_W_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_X_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_Y_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_Z_Words()); ignorekeywords = ignorekeywords.concat(getIgnoreKeywords_allWords_nonEnglishWords()); return ignorekeywords; }
[ "function getListOfAllWords() {\n var completeArray = newWords.concat(learningWords, masteredWords);\n return JSON.stringify(completeArray);\n}", "function getIgnoreKeywords_allWords_X_Words() {\n\t\treturn [\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_R_Words() {\n\t\treturn [\n\t\t\t'rarely',\n\t\t\t'rather',\n\t\t\t'readily',\n\t\t\t'realize',\n\t\t\t'realized',\n\t\t\t'realizes',\n\t\t\t'realizing',\n\t\t\t'really',\n\t\t\t'recent',\n\t\t\t'recently',\n\t\t\t'recieved',\n\t\t\t'recieves',\n\t\t\t'recieving',\n\t\t\t'reckon',\n\t\t\t'reckoned',\n\t\t\t'regard',\n\t\t\t'regarded',\n\t\t\t'regarding',\n\t\t\t'regardless',\n\t\t\t'regardlessly',\n\t\t\t'regards',\n\t\t\t'relatively',\n\t\t\t'remain',\n\t\t\t'remained',\n\t\t\t'remaining',\n\t\t\t'remains',\n\t\t\t'remind',\n\t\t\t'requisite',\n\t\t\t'represents',\n\t\t\t'resulting',\n\t\t\t'rid',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_H_Words() {\n\t\treturn [\n\t\t\t'ha',\n\t\t\t'had',\n\t\t\t'hadn\\'t',\n\t\t\t'half',\n\t\t\t'happen',\n\t\t\t'happened',\n\t\t\t'happens',\n\t\t\t'hardly',\n\t\t\t'has',\n\t\t\t'hast',\t// \"hast thou toketh?\"\n\t\t\t'hath',\n\t\t\t'have',\n\t\t\t'haven\\'t',\n\t\t\t'having',\n\t\t\t'he',\n\t\t\t'he\\'d',\n\t\t\t'he\\'ll',\n\t\t\t'he\\'s',\n\t\t\t'held',\n\t\t\t'hello',\n\t\t\t'hence',\n\t\t\t'henceforth',\n\t\t\t'her',\n\t\t\t'here',\n\t\t\t'here\\'s',\n\t\t\t'hereafter',\n\t\t\t'hereby',\n\t\t\t'herein',\n\t\t\t'heretofore',\n\t\t\t'hers',\n\t\t\t'herself',\n\t\t\t'highly',\n\t\t\t'him',\n\t\t\t'himself',\n\t\t\t'his',\n\t\t\t'hither',\n\t\t\t'hitherto',\n\t\t\t'hold',\n\t\t\t'holding',\n\t\t\t'how',\n\t\t\t'how\\'s',\n\t\t\t'how\\'ll',\n\t\t\t'however',\n\t\t\t'hundreds',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_W_Words() {\n\t\treturn [\n\t\t\t'wait',\n\t\t\t'waited',\n\t\t\t'waiting',\n\t\t\t'waits',\n\t\t\t'want',\n\t\t\t'was',\n\t\t\t'wasn\\'t',\n\t\t\t'way',\n\t\t\t'ways',\n\t\t\t'we',\n\t\t\t'we\\'d',\n\t\t\t'we\\'ll',\n\t\t\t'we\\'re',\n\t\t\t'we\\'ve',\n\t\t\t'well',\n\t\t\t'went',\n\t\t\t'were',\n\t\t\t'what',\n\t\t\t'what\\'s',\n\t\t\t'whatever',\n\t\t\t'whathaveyou',\n\t\t\t'whatsoever',\n\t\t\t'when',\n\t\t\t'whence',\n\t\t\t'whenever',\n\t\t\t'where',\n\t\t\t'where\\'s',\n\t\t\t'whereas',\n\t\t\t'whereby',\n\t\t\t'wherefore',\n\t\t\t'wherefrom',\n\t\t\t'wherein',\n\t\t\t'whereon',\n\t\t\t'wheresoever',\n\t\t\t'whereto',\n\t\t\t'wheretofore',\n\t\t\t'whereupon',\n\t\t\t'wherever',\n\t\t\t'wherewith',\n\t\t\t'whether',\n\t\t\t'which',\n\t\t\t'whichever',\n\t\t\t'while',\n\t\t\t'whilst',\n\t\t\t'who',\n\t\t\t'whoever',\n\t\t\t'whomever',\n\t\t\t'whomsoever',\n\t\t\t'whosoever',\n\t\t\t'whom',\n\t\t\t'whomsoever',\n\t\t\t'whose',\n\t\t\t'why',\n\t\t\t'wide',\n\t\t\t'widely',\n\t\t\t'will',\n\t\t\t'willing',\n\t\t\t'willingly',\n\t\t\t'with',\n\t\t\t'within',\n\t\t\t'without',\n\t\t\t'woman\\'s',\n\t\t\t'won\\'t',\n\t\t\t'wont',\n\t\t\t'would',\n\t\t\t'wouldn\\'t',\n\t\t\t'wouldst', // as in \"wouldst thou toketh?\"\n\t\t\t'write',\n\t\t\t'writes',\n\t\t\t'wrote',\n\t\t\t'wrought',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_G_Words() {\n\t\treturn [\n\t\t\t'gave',\n\t\t\t'general',\n\t\t\t'generally',\n\t\t\t'generic',\n\t\t\t'get',\n\t\t\t'gets',\n\t\t\t'getting',\n\t\t\t'give',\n\t\t\t'given',\n\t\t\t'gives',\n\t\t\t'go',\n\t\t\t'goes',\n\t\t\t'going',\n\t\t\t'goings',\n\t\t\t'goings-on',\n\t\t\t'goingson',\n\t\t\t'goodbye',\n\t\t\t'goodly',\n\t\t\t'got',\t\n\t\t\t'gotten',\n\t\t\t'gradually',\n\t\t\t'great deal',\n\t\t\t'greater',\n\t\t\t'gros', // \"en gros\"\n\t\t\t'grossly',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_O_Words() {\n\t\treturn [\n\t\t\t'obstinately',\n\t\t\t'obviously',\n\t\t\t'occasion',\n\t\t\t'occasionally',\n\t\t\t'occassion',\n\t\t\t'occassionally',\n\t\t\t'occur',\n\t\t\t'occuring',\n\t\t\t'occurs',\n\t\t\t'occurred',\n\t\t\t'of',\n\t\t\t'off',\n\t\t\t'oft',\n\t\t\t'often',\n\t\t\t'oftener',\n\t\t\t'oh',\n\t\t\t'ol',\n\t\t\t'ole',\n\t\t\t'on',\n\t\t\t'once',\n\t\t\t'one',\n\t\t\t'one\\'s',\n\t\t\t'ones',\n\t\t\t'oneself',\n\t\t\t'only',\n\t\t\t'onto',\n\t\t\t'or',\n\t\t\t'ordinarily',\n\t\t\t'originally',\n\t\t\t'other',\n\t\t\t'others',\n\t\t\t'otherwise',\n\t\t\t'ought',\n\t\t\t'our',\n\t\t\t'ourselves',\n\t\t\t'out',\n\t\t\t'outright',\n\t\t\t'outside',\n\t\t\t'o\\'er',\n\t\t\t'over',\n\t\t\t'overlooks',\n\t\t\t'owe',\n\t\t\t'owed',\n\t\t\t'owes',\n\t\t\t'owing',\n\t\t\t'own',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_Q_Words() {\n\t\treturn [\n\t\t\t'quickly',\n\t\t\t'quite',\n\t\t\t'quo',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_Z_Words() {\n\t\treturn [\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_C_Words() {\n\t\treturn [\n\t\t\t'call',\n\t\t\t'called',\n\t\t\t'came',\n\t\t\t'can',\n\t\t\t'can\\'t',\n\t\t\t'cannot',\n\t\t\t'case',\n\t\t\t'certain',\n\t\t\t'certainly',\n\t\t\t'cetera', // LATIN\n\t\t\t'chapter',\n\t\t\t'chiefly',\n\t\t\t'circumstances',\n\t\t\t'claim',\n\t\t\t'claims',\n\t\t\t'clearly',\n\t\t\t'closely',\n\t\t\t'closer',\n\t\t\t'co',\t// i.e., company\n\t\t\t'come',\n\t\t\t'comes',\n\t\t\t'cometh',\n\t\t\t'coming',\n\t\t\t'commit',\n\t\t\t'committed',\n\t\t\t'committing',\n\t\t\t'commits',\n\t\t\t'completely',\n\t\t\t'concerned',\n\t\t\t'concerns',\n\t\t\t'concerning',\n\t\t\t'condition',\n\t\t\t'consequently',\t\n\t\t\t'consider',\n\t\t\t'considerable',\n\t\t\t'considered',\n\t\t\t'considering',\n\t\t\t'consist',\n\t\t\t'consisted',\n\t\t\t'consisting',\n\t\t\t'consists',\n\t\t\t'constantly',\n\t\t\t'constitute',\n\t\t\t'constituted',\n\t\t\t'constitutes',\n\t\t\t'constituting',\n\t\t\t'contain',\n\t\t\t'contained',\n\t\t\t'contains',\n\t\t\t'containing',\n\t\t\t'continually',\n\t\t\t'continuously',\n\t\t\t'contraire', // \"au contraire\"\n\t\t\t'contrarily',\n\t\t\t'contrary',\n\t\t\t'could',\n\t\t\t'couldn\\'t',\n\t\t\t'culpa', // \"mea culpa\"\n\t\t\t'currently',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_M_Words() {\n\t\treturn [\n\t\t\t'm\\'m',\n\t\t\t'made',\n\t\t\t'make',\n\t\t\t'makes',\n\t\t\t'making',\n\t\t\t'main',\t\n\t\t\t'mainly',\n\t\t\t'man\\'s',\n\t\t\t'many',\n\t\t\t'may',\t\n\t\t\t'maybe',\n\t\t\t'me',\n\t\t\t'mea',\t // \"mea culpa\"\n\t\t\t'mean',\n\t\t\t'means',\n\t\t\t'meant',\n\t\t\t'meantime',\n\t\t\t'meanwhile',\n\t\t\t'mere',\n\t\t\t'merely',\n\t\t\t'messrs',\n\t\t\t'met',\n\t\t\t'midst',\n\t\t\t'midsts',\n\t\t\t'min',\n\t\t\t'minor',\n\t\t\t'miss',\n\t\t\t'mister',\n\t\t\t'mlle', // french\n\t\t\t'mme', // french\n\t\t\t'moment',\n\t\t\t'more',\n\t\t\t'moreover',\n\t\t\t'morrow',\n\t\t\t'most',\n\t\t\t'mostly',\n\t\t\t'mr',\n\t\t\t'mrs',\n\t\t\t'much',\n\t\t\t'must',\t\n\t\t\t'my',\n\t\t\t'myself',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_L_Words() {\n\t\treturn [\n\t\t\t'lack',\t\n\t\t\t'lacks',\n\t\t\t'lacking',\n\t\t\t'largely',\n\t\t\t'larger',\n\t\t\t'largest',\n\t\t\t'last',\t\n\t\t\t'lastly',\n\t\t\t'latest',\n\t\t\t'latter',\n\t\t\t'la', // french\n\t\t\t'lat',\t// latitude\n\t\t\t'late',\n\t\t\t'lately',\n\t\t\t'later',\n\t\t\t'le', // french\n\t\t\t'least',\n\t\t\t'leave',\n\t\t\t'les', // french\n\t\t\t'less',\n\t\t\t'lest',\n\t\t\t'let',\n\t\t\t'let\\'s',\n\t\t\t'lets',\n\t\t\t'like',\n\t\t\t'likely',\n\t\t\t'likes',\n\t\t\t'likewise',\n\t\t\t'literally',\n\t\t\t'little',\n\t\t\t'lo',\n\t\t\t'lo\\'',\n\t\t\t'long',\n\t\t\t'longer',\n\t\t\t'longest',\n\t\t\t'longing',\n\t\t\t'look',\n\t\t\t'looked',\n\t\t\t'looking',\n\t\t\t'looks',\n\t\t\t'ltd',\t\n\t\t\t'luckily',\n\t\t];\n\t}", "function getSkipWords() {\n\t\tif($('.ignore-common-words').is(':checked')) {\n\t\t\treturn getIgnoreKeywordsHash();\n\t\t}\n\t\t\n\t\treturn {};\n\t}", "function getIgnoreKeywords_allWords_A_Words() {\n\t\treturn [\n\t\t\t'ab',\t// latin, as in \"ab novo\"\n\t\t\t'abideth',\n\t\t\t'able',\n\t\t\t'above',\n\t\t\t'about',\n\t\t\t'absolutely',\n\t\t\t'according',\n\t\t\t'accordingly',\t\n\t\t\t'achieving',\n\t\t\t'across',\n\t\t\t'actual',\n\t\t\t'actually',\t\n\t\t\t'admit',\n\t\t\t'admittably',\n\t\t\t'admitted',\n\t\t\t'affect',\n\t\t\t'affecting',\n\t\t\t'affects',\n\t\t\t'aforesaid',\n\t\t\t'after',\t\n\t\t\t'afterall',\n\t\t\t'afterward',\n\t\t\t'afterwards',\n\t\t\t'again',\n\t\t\t'against',\n\t\t\t'ago',\n\t\t\t'agree',\t\n\t\t\t'agreed',\n\t\t\t'agrees',\n\t\t\t'agreeing',\n\t\t\t'ah',\n\t\t\t'ahh',\n\t\t\t'ahhh',\t\n\t\t\t'ahhhh',\n\t\t\t'ahhhhh',\n\t\t\t'ahhhhhh',\n\t\t\t'ahhhhhhh',\n\t\t\t'ahead',\n\t\t\t'al', // \"et al\"\n\t\t\t'alas',\n\t\t\t'albeit',\n\t\t\t'alike',\n\t\t\t'all',\n\t\t\t'allage',\n\t\t\t'alleged',\n\t\t\t'allegedly',\n\t\t\t'allow',\n\t\t\t'almost',\n\t\t\t'aloft',\n\t\t\t'along',\n\t\t\t'already',\n\t\t\t'also',\n\t\t\t'although',\n\t\t\t'altogether',\n\t\t\t'always',\n\t\t\t'am',\t\t\n\t\t\t'amid',\n\t\t\t'amidst',\n\t\t\t'among',\n\t\t\t'amongst',\t\n\t\t\t'amount',\n\t\t\t'amounting',\n\t\t\t'amounts',\n\t\t\t'amuck',\n\t\t\t'an',\n\t\t\t'and',\n\t\t\t'another',\n\t\t\t'any',\n\t\t\t'anyhow',\n\t\t\t'anymore',\n\t\t\t'anyway',\n\t\t\t'apart',\n\t\t\t'apparent',\n\t\t\t'apparently',\n\t\t\t'appear',\n\t\t\t'appeared',\n\t\t\t'appearing',\n\t\t\t'appears',\n\t\t\t'apply',\n\t\t\t'are',\n\t\t\t'around',\n\t\t\t'as',\n\t\t\t'aside',\n\t\t\t'ask',\n\t\t\t'aspect',\n\t\t\t'aspects',\n\t\t\t'ass\\'n', // \"assistant\"\n\t\t\t'assume',\n\t\t\t'assumed',\n\t\t\t'assumes',\n\t\t\t'assuming',\n\t\t\t'at',\n\t\t\t'attributable',\n\t\t\t'au', // \"au contraire\"\n\t\t\t'augers', // \"augers well\"\n\t\t\t'aught',\n\t\t\t'away',\n\t\t\t'awhile',\n\t\t\t'aye',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_U_Words() {\n\t\treturn [\n\t\t\t'ultimately',\n\t\t\t'unable',\n\t\t\t'unconsciously',\n\t\t\t'undeniably',\n\t\t\t'under',\n\t\t\t'underlying',\n\t\t\t'undoubtedly',\n\t\t\t'unduly',\n\t\t\t'unfortunately',\n\t\t\t'unless',\n\t\t\t'unlike',\n\t\t\t'unlikely',\n\t\t\t'unlimitedly',\n\t\t\t'unspeakably',\n\t\t\t'utterly',\n\t\t\t'und', // german, \"sturm und drang\"\n\t\t\t'until',\n\t\t\t'unto',\n\t\t\t'up',\n\t\t\t'upon',\n\t\t\t'us',\n\t\t\t'use',\n\t\t\t'used',\n\t\t\t'using',\n\t\t\t'usually',\n\t\t\t'utmost',\n\t\t\t'utter',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_K_Words() {\n\t\treturn [\n\t\t\t'keep',\n\t\t\t'keeping',\n\t\t\t'keeps',\n\t\t\t'kept',\n\t\t\t'kind',\n\t\t\t'kinds',\n\t\t\t'km', // \"kilometer\", metric system\n\t\t\t'knew',\n\t\t\t'know',\n\t\t\t'knowing',\n\t\t\t'knows',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_V_Words() {\n\t\treturn [\n\t\t\t'variably',\n\t\t\t'various',\n\t\t\t'verily',\n\t\t\t'very',\n\t\t\t'view',\t\n\t\t\t'views',\n\t\t\t'virtually',\n\t\t\t'viz',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_T_Words() {\n\t\treturn [\n\t\t\t'take',\t\n\t\t\t'taken',\n\t\t\t'takes',\n\t\t\t'taking',\n\t\t\t'technically',\n\t\t\t'tell',\n\t\t\t'telling',\n\t\t\t'tellingly',\n\t\t\t'tells',\n\t\t\t'temporarily',\n\t\t\t'tend',\n\t\t\t'tends',\n\t\t\t'than',\n\t\t\t'that',\n\t\t\t'that\\'s',\n\t\t\t'the',\n\t\t\t'thee',\t\n\t\t\t'their',\n\t\t\t'theirs',\n\t\t\t'them',\n\t\t\t'themselves',\n\t\t\t'then',\n\t\t\t'thence',\n\t\t\t'thenceforth',\n\t\t\t'there',\n\t\t\t'there\\'ll',\n\t\t\t'there\\'s',\n\t\t\t'thereabouts',\n\t\t\t'thereafter',\n\t\t\t'thereby',\n\t\t\t'therefor',\n\t\t\t'therefore',\n\t\t\t'therefrom',\n\t\t\t'therein',\n\t\t\t'thereof',\n\t\t\t'thereover',\n\t\t\t'these',\n\t\t\t'they',\n\t\t\t'they\\'d',\n\t\t\t'they\\'ll',\n\t\t\t'they\\'re',\n\t\t\t'they\\'ve',\n\t\t\t'thine',\n\t\t\t'thing',\n\t\t\t'things',\n\t\t\t'this',\n\t\t\t'thither',\n\t\t\t'thorough',\n\t\t\t'thoroughly',\n\t\t\t'those',\n\t\t\t'thou',\n\t\t\t'though',\n\t\t\t'thousands',\n\t\t\t'three',\n\t\t\t'through',\n\t\t\t'throughout',\n\t\t\t'thus',\n\t\t\t'thy',\n\t\t\t'thyself',\n\t\t\t'time',\n\t\t\t'tis',\n\t\t\t'to',\n\t\t\t'today',\n\t\t\t'together',\n\t\t\t'told',\n\t\t\t'tonight',\n\t\t\t'too',\n\t\t\t'took',\n\t\t\t'topic',\n\t\t\t'total',\n\t\t\t'totalled',\n\t\t\t'totally',\n\t\t\t'toward',\n\t\t\t'towards',\n\t\t\t'tried',\n\t\t\t'true',\t\n\t\t\t'truly',\n\t\t\t'try',\n\t\t\t'trying',\n\t\t\t'turn',\n\t\t\t'turned',\n\t\t\t'turning',\n\t\t\t'turns',\n\t\t\t'two',\n\t\t];\n\t}", "function getIgnoreKeywords_allWords_E_Words() {\n\t\treturn [\n\t\t\t'each',\t\n\t\t\t'earlier',\n\t\t\t'earlieriest',\n\t\t\t'early',\n\t\t\t'easily',\n\t\t\t'ect',\t\n\t\t\t'effect',\n\t\t\t'effecting',\n\t\t\t'effects',\n\t\t\t'eg', // i.e, \"e.g.\"\n\t\t\t'end',\n\t\t\t'ends',\n\t\t\t'entire',\n\t\t\t'either',\n\t\t\t'else',\n\t\t\t'else’',\n\t\t\t'else\\'s',\n\t\t\t'elsewhere',\n\t\t\t'en', // as in \"en gros\"\n\t\t\t'enough',\n\t\t\t'entirely',\n\t\t\t'ere',\t// short for \"here\"\n\t\t\t'erstwhile',\n\t\t\t'especially',\n\t\t\t'essentially',\n\t\t\t'et', // \"et al\"\n\t\t\t'etc',\n\t\t\t'even',\n\t\t\t'eventually',\n\t\t\t'ever',\n\t\t\t'every',\n\t\t\t'evident',\n\t\t\t'evidently',\n\t\t\t'exactly',\n\t\t\t'example',\n\t\t\t'examples',\n\t\t\t'except',\n\t\t\t'excepted',\n\t\t\t'excepting',\n\t\t\t'excepts',\n\t\t\t'exception',\n\t\t\t'exceptions',\n\t\t\t'exclusively',\n\t\t\t'exercising',\n\t\t\t'exist',\n\t\t\t'exists',\n\t\t\t'expense',\n\t\t\t'explicitly',\n\t\t\t'extent',\n\t\t\t'externally',\n\t\t\t'extremely',\n\t\t];\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Convert the transaction to the format to be imported
convert(transactions) { var transactionsToImport = []; // Filter and map rows for (var i = 0; i < transactions.length; i++) { //We take only the complete rows. var transaction = transactions[i]; if (transaction.length < (this.currentLength)) continue; if ((transaction[this.colDate] && transaction[this.colDate].match(/[0-9\/]+/g)) && (transaction[this.colDateValuta] && transaction[this.colDateValuta].match(/[0-9\/]+/g))) { transactionsToImport.push(this.mapTransaction(transaction)); } } // Sort rows by date (just invert) transactionsToImport = transactionsToImport.reverse(); // Add header and return var header = [["Date", "DateValue", "Doc", "Description", "Income", "Expenses"]]; return header.concat(transactionsToImport); }
[ "convert(transactions) {\n var transactionsToImport = [];\n\n // Filter and map rows\n for (var i = 0; i < transactions.length; i++) {\n //We take only the complete rows.\n var transaction = transactions[i];\n if (transaction.length < (this.colBalance + 1))\n continue;\n if ((transaction[this.colDate] && transaction[this.colDate].match(/[0-9\\.]+/g)) &&\n (transaction[this.colDateValuta] && transaction[this.colDateValuta].match(/[0-9\\.]+/g))) {\n transactionsToImport.push(this.mapTransaction(transaction));\n }\n }\n\n // Sort rows by date (just invert)\n transactionsToImport = transactionsToImport.reverse();\n\n // Add header and return\n var header = [[\"Date\", \"DateValue\", \"Doc\", \"Description\", \"Income\", \"Expenses\"]];\n return header.concat(transactionsToImport);\n }", "function transform(tx){\n return {\n blockchain : 'xrp',\n block : tx.ledger_index,\n id : tx.transaction.hash,\n source : tx.transaction.Account,\n operations : [tx.transaction.TransactionType],\n result : tx.meta.TransactionResult\n }\n}", "function mapToDb(transaction) {\n const {\n txnDate: txn_date,\n accountId: account_id,\n categoryId: category_id,\n ...rest\n } = transaction;\n\n return {\n txn_date,\n account_id,\n category_id,\n ...rest\n };\n}", "formatEthersTx(txFromAPI) {\n const tx = JSON.parse(JSON.stringify(txFromAPI));\n tx.gasLimit = tx.gas;\n tx.gasPrice = utils.bigNumberify(tx.gasPrice);\n tx.value = utils.bigNumberify(tx.value);\n delete tx.gas;\n delete tx.from;\n delete tx.hash;\n return tx;\n }", "function transform() {\n \n // Even if there is <Order></Order> a record will be created. So putting it without a check will create empty records.\n // For an order with a single line item atleast one transaction will be there. So adding Transaction check.\n\n var transactions = ORDER_INRECORD.TransactionArray.Transaction;\n\n if (transactions.length() > 0) {\n\n var i = 0;\n var channelID = \"\";\n\n var site = transactions[0].TransactionSiteID.toString();\n if (typeof site !== 'undefined' && !isEmptyOrNull(site)) {\n var channelIDResult = LOOKUP_SERVICE.get('ChannelIDLookup.csv', [site]);\n if (!isEmptyOrNull(channelIDResult)) {\n channelID = channelIDResult[0];\n }\n }\n\n var buyerFirstName = transactions[0].Buyer.UserFirstName.toString();\n var buyerLastName = transactions[0].Buyer.UserLastName.toString();\n var buyerEmail = transactions[0].Buyer.Email.toString();\n\n var transactionShippingDetail = transactions[0].ShippingDetails;\n\n\n while ( i < transactions.length()) {\n\n // Create an empty order record at the order level\n var order = ORDERS.createOrder();\n order.orderID = ORDER_INRECORD.OrderID.toString();\n order.channelID = channelID;\n order.createdDate = ORDER_INRECORD.CreatedTime.toString();\n\n /* Buyer */\n order.buyerID = ORDER_INRECORD.BuyerUserID.toString();\n order.buyerEmail = buyerEmail;\n order.buyerFirstName = buyerFirstName;\n order.buyerLastName = buyerLastName;\n\n /* Seller */\n order.sellerID = ORDER_INRECORD.SellerUserID.toString();\n\n /* LogisticsPlan */\n var fulFillmentType;\n var logisticsStatus;\n if (ORDER_INRECORD.PickupMethodSelected.length() > 0) {\n fulFillmentType = \"PICKUP\";\n } else {\n fulFillmentType = \"SHIP\";\n }\n order.fulfillmentType = fulFillmentType;\n \n /* FulFillment Type : SHIP */\n if (fulFillmentType == \"SHIP\") {\n\n var shippingType;\n if (ORDER_INRECORD.IsMultiLegShipping == false) {\n shippingType = \"DIRECT\";\n } else {\n shippingType = \"MULTILEG\";\n }\n\n order.shippingType = shippingType;\n order.shippingServiceName = transactionShippingDetail.ShipmentTrackingDetails.ShippingCarrierUsed.toString(); //Assuming seller uses same carrier for multiple packets of an order\n order.shippingMethod = ORDER_INRECORD.ShippingServiceSelected.ShippingService.toString();\n\n order.shipToAddressID = ORDER_INRECORD.ShippingAddress.AddressID.toString();\n order.shipToAddressName = ORDER_INRECORD.ShippingAddress.Name.toString();\n order.shipToAddressPhone = ORDER_INRECORD.ShippingAddress.Phone.toString();\n order.shipToAddressLine1 = ORDER_INRECORD.ShippingAddress.Street1.toString();\n order.shipToAddressLine2 = ORDER_INRECORD.ShippingAddress.Street2.toString();\n order.shipToAddressCity = ORDER_INRECORD.ShippingAddress.CityName.toString();\n order.shipToAddressStateOrProvince = ORDER_INRECORD.ShippingAddress.StateOrProvince.toString();\n order.shipToAddressPostalCode = ORDER_INRECORD.ShippingAddress.PostalCode.toString();\n order.shipToAddressCountry = ORDER_INRECORD.ShippingAddress.Country.toString();\n\n order.expectedDeliveryDate = transactionShippingDetail.ShippingServiceOptions.ShippingPackageInfo.EstimatedDeliveryTimeMax.toString();\n\n /*Set Logistic Status */\n if (ORDER_INRECORD.ShippedTime.length() > 0) {\n logisticsStatus = \"SHIPPED\";\n } else {\n logisticsStatus = \"NOT_SHIPPED\";\n }\n }\n\n /* FulFillment Type : PICKUP */\n if (fulFillmentType == \"PICKUP\") {\n var pickupMethod = ORDER_INRECORD.PickupMethodSelected.PickupMethod.toString();\n if (pickupMethod.toUpperCase() == \"INSTOREPICKUP\") {\n order.pickupType = \"RECIPIENT\";\n }\n order.pickupLocationID = ORDER_INRECORD.PickupMethodSelected.PickupStoreID.toString();\n \n /* Set Pickup Status */\n var pickupStatus = ORDER_INRECORD.PickupMethodSelected.PickupStatus.toString().toUpperCase();\n if (pickupStatus == \"READYTOPICKUP\") {\n logisticsStatus = \"READY_FOR_PICKUP\";\n } else if (pickupStatus == \"PICKEDUP\") {\n logisticsStatus = \"PICKED_UP\";\n } else {\n logisticsStatus = \"NOT_READY_FOR_PICKUP\";\n }\n }\n\n /* LineItem */\n var lineItem_INRECORD = transactions[i];\n\n order.orderID = ORDER_INRECORD.OrderID.toString();\n\n order.lineItemID = lineItem_INRECORD.OrderLineItemID.toString();\n var lineItemSite = lineItem_INRECORD.Item.Site.toString();\n if (typeof lineItemSite !== 'undefined' && !isEmptyOrNull(lineItemSite)) {\n var lineItemChannelIDresult = LOOKUP_SERVICE.get('ChannelIDLookup.csv', [lineItemSite]);\n if (!isEmptyOrNull(lineItemChannelIDresult)) {\n order.listingChannelID = lineItemChannelIDresult[0];\n }\n }\n order.itemID = lineItem_INRECORD.Item.ItemID.toString();\n if (lineItem_INRECORD.Variation.length() > 0){\n\t\t /* MSKU Item */\n\t\t order.SKU = lineItem_INRECORD.Variation.SKU.toString();\n\t\t } else {\n\t\t /* Non-MSKU Item */\n\t\t order.SKU = lineItem_INRECORD.Item.SKU.toString();\n\t\t }\n order.title = lineItem_INRECORD.Item.Title.toString();\n\n order.quantity = lineItem_INRECORD.QuantityPurchased.toString();\n var currencyCode = lineItem_INRECORD.TransactionPrice.@[\"currencyID\"].toString();\n order.unitPrice = lineItem_INRECORD.TransactionPrice.toString();\n order.unitPriceCurrency = currencyCode.toString();\n\n \n /* lineItemPriceLines */\n var lineItemSumTotalAmount = 0;\n var lineItemCurrencyCode = lineItem_INRECORD.TransactionPrice.@[\"currencyID\"].toString();\n \n var lineItemPriceLines = [];\n\n /* LineItem Price */\n var itemAmount = order.unitPrice * order.quantity * 1.00;\n var itemAmountFixed = itemAmount.toFixed(2);\n var itemAmountCurrency = lineItemCurrencyCode;\n lineItemSumTotalAmount = lineItemSumTotalAmount + itemAmount;\n lineItemPriceLines.push(JSON.stringify({\n \"pricelineType\":\"ITEM\",\n \"amount\":itemAmountFixed,\n \"currency\":itemAmountCurrency\n }));\n\n /* LineItem Shipment Price */\n var shipAmount = lineItem_INRECORD.ActualShippingCost * 1.00;\n var shipAmountFixed = shipAmount.toFixed(2);\n var shipAmountCurrency = ORDER_INRECORD.ActualShippingCost.@[\"currencyID\"].toString();\n lineItemSumTotalAmount = lineItemSumTotalAmount + shipAmount;\n lineItemPriceLines.push(JSON.stringify({\n \"pricelineType\":\"SHIPPING\",\n \"amount\":shipAmountFixed,\n \"currency\":shipAmountCurrency\n }));\n\n /* LineItem Tax */\n var j = 0;\n while ( j < lineItem_INRECORD.Taxes.TaxDetails.length()) {\n \n var taxPriceLine_INRECORD = lineItem_INRECORD.Taxes.TaxDetails[j];\n var taxType = taxPriceLine_INRECORD.Imposition.toString().toUpperCase();\n var taxDescription = taxPriceLine_INRECORD.TaxDescription.toString();\n var taxAmount = taxPriceLine_INRECORD.TaxAmount * 1.00;\n var taxAmountFixed = taxAmount.toFixed(2);\n var taxAmountCurrency = taxPriceLine_INRECORD.TaxAmount.@[\"currencyID\"].toString();\n\n lineItemSumTotalAmount = lineItemSumTotalAmount + taxAmount;\n\n if ( taxType == \"SALESTAX\" ) { \n lineItemPriceLines.push(JSON.stringify({\n \"pricelineType\":\"ITEM_TAX\",\n \"description\":taxDescription,\n \"amount\":taxAmountFixed,\n \"currency\":taxAmountCurrency\n }));\n } else if ( taxType == \"WASTERECYCLINGFEE\" ) {\n lineItemPriceLines.push(JSON.stringify({\n \"pricelineType\":\"RECYCLING\",\n \"description\":taxDescription,\n \"amount\":taxAmountFixed,\n \"currency\":taxAmountCurrency\n }));\n }\n j++;\n }\n\n order.lineItemPriceLines = (\"[\" + lineItemPriceLines + \"]\").toString();\n\n /* SumTotal */\n order.lineItemSumTotal = lineItemSumTotalAmount.toFixed(2);\n order.lineItemSumTotalCurrency = lineItemCurrencyCode;\n\n /* Payment */\n if (ORDER_INRECORD.MonetaryDetails.Payments.length() > 0) {\n order.paymentID = ORDER_INRECORD.MonetaryDetails.Payments.Payment.ReferenceID.toString();\n order.paymentTotal = ORDER_INRECORD.MonetaryDetails.Payments.Payment.PaymentAmount.toString();\n order.paymentCurrency = ORDER_INRECORD.MonetaryDetails.Payments.Payment.PaymentAmount.@[\"currencyID\"].toString();\n \n }\n\n /* orderPriceLineItems */\n var orderPriceLines = [];\n\n /* Total Item Price */\n var totalItemPriceLineAmount = ORDER_INRECORD.Subtotal.toString();\n var totalItemPriceLineAmountCurrency = ORDER_INRECORD.Subtotal.@[\"currencyID\"].toString(); //Copying SubTotal as Item level price for order\n orderPriceLines.push(JSON.stringify({\n \"pricelineType\":\"ITEM\",\n \"amount\":totalItemPriceLineAmount,\n \"currency\":totalItemPriceLineAmountCurrency\n }));\n\n /* Total Tax */\n var totalTaxPriceLineAmount = ORDER_INRECORD.ShippingDetails.SalesTax.SalesTaxAmount.toString();\n var totalTaxPriceLineAmountCurrency = ORDER_INRECORD.ShippingDetails.SalesTax.SalesTaxAmount.@[\"currencyID\"].toString();\n orderPriceLines.push(JSON.stringify({\n \"pricelineType\":\"ITEM_TAX\",\n \"amount\":totalTaxPriceLineAmount,\n \"currency\":totalTaxPriceLineAmountCurrency\n }));\n\n /* Total Shipping Price */\n var totalShippingPriceLineAmount = ORDER_INRECORD.ShippingServiceSelected.ShippingServiceCost.toString();\n var totalShippingPriceLineAmountCurrency = ORDER_INRECORD.ShippingServiceSelected.ShippingServiceCost.@[\"currencyID\"].toString();\n orderPriceLines.push(JSON.stringify({\n \"pricelineType\":\"SHIPPING\",\n \"amount\":totalShippingPriceLineAmount,\n \"currency\":totalShippingPriceLineAmountCurrency\n }));\n\n /* Total Discount */\n var totalDiscountPriceLineAmount = ORDER_INRECORD.AdjustmentAmount.toString();\n var totalDiscountPriceLineAmountCurrency = ORDER_INRECORD.AdjustmentAmount.@[\"currencyID\"].toString();\n orderPriceLines.push(JSON.stringify({\n \"pricelineType\":\"DISCOUNT\",\n \"amount\":totalDiscountPriceLineAmount,\n \"currency\":totalDiscountPriceLineAmountCurrency\n }));\n\n order.orderPriceLines = (\"[\" + orderPriceLines + \"]\").toString();\n\n /* Total */\n order.orderSumTotal = ORDER_INRECORD.Total.toString();\n order.orderSumTotalCurrency = ORDER_INRECORD.Total.@[\"currencyID\"].toString();\n\n /* Status */\n var eBayPaymentStatus = ORDER_INRECORD.CheckoutStatus.eBayPaymentStatus.toString().toUpperCase();\n if (eBayPaymentStatus == \"NOPAYMENTFAILURE\"){\n\t order.orderPaymentStatus = \"PAID\";\n\t }\n\t else if (eBayPaymentStatus == \"PAYMENTINPROCESS\" || eBayPaymentStatus == \"PAYPALPAYMENTINPROCESS\" ){\n\t order.orderPaymentStatus = \"PENDING\";\n\t }\n\t else {\n\t order.orderPaymentStatus = \"FAILED\";\n\t } \n\n order.orderLogisticsStatus = logisticsStatus;\n order.note = ORDER_INRECORD.BuyerCheckoutMessage.toString();\n \n i++;\n }\n }\n}", "function AKBFormat1() {\n this.colDate = 0;\n this.colDateValuta = 1;\n this.colDescr = 2;\n this.colDetail = 3;\n this.colDebit = 4;\n this.colCredit = 5;\n this.colBalance = 6;\n\n this.colCount = 7;\n\n /** Return true if the transactions match this format */\n this.match = function (transactions) {\n var formatMatched = false;\n\n if (transactions.length === 0)\n return false;\n\n for (i = 0; i < transactions.length; i++) {\n var transaction = transactions[i];\n\n var formatMatched = false;\n /* array should have all columns */\n if (transaction.length >= this.colCount)\n formatMatched = true;\n else\n formatMatched = false;\n\n if (formatMatched && transaction[this.colDate] &&\n transaction[this.colDate].match(/^[0-9]+\\.[0-9]+\\.[0-9]+$/))\n formatMatched = true;\n else\n formatMatched = false;\n\n if (formatMatched && transaction[this.colDateValuta] &&\n transaction[this.colDateValuta].match(/^[0-9]+\\.[0-9]+\\.[0-9]+$/))\n formatMatched = true;\n else\n formatMatched = false;\n\n if (formatMatched)\n return true;\n }\n return false;\n }\n\n /** Convert the transaction to the format to be imported */\n this.convert = function (transactions) {\n var transactionsToImport = [];\n\n /** Complete, filter and map rows */\n var lastCompleteTransaction = null;\n var isPreviousCompleteTransaction = false;\n\n for (i = 1; i < transactions.length; i++) // First row contains the header\n {\n var transaction = transactions[i];\n\n if (transaction.length === 0) {\n // Righe vuote\n continue;\n } else if (!this.isDetailRow(transaction)) {\n if (isPreviousCompleteTransaction === true)\n transactionsToImport.push(this.mapTransaction(lastCompleteTransaction));\n lastCompleteTransaction = transaction;\n isPreviousCompleteTransaction = true;\n } else {\n this.fillDetailRow(transaction, lastCompleteTransaction);\n transactionsToImport.push(this.mapTransaction(transaction));\n isPreviousCompleteTransaction = false;\n }\n }\n if (isPreviousCompleteTransaction === true) {\n transactionsToImport.push(this.mapTransaction(lastCompleteTransaction));\n }\n\n // Sort rows by date (just invert)\n transactionsToImport = transactionsToImport.reverse();\n\n // Add header and return\n var header = [[\"Date\", \"DateValue\", \"Doc\", \"Description\", \"Income\", \"Expenses\"]];\n return header.concat(transactionsToImport);\n }\n\n /** Return true if the transaction is a transaction row */\n this.isDetailRow = function (transaction) {\n if (transaction[this.colDate].length === 0) // Date (first field) is empty\n return true;\n return false;\n }\n\n /** Fill the detail rows with the missing values. The value are copied from the preceding total row */\n this.fillDetailRow = function (detailRow, totalRow) {\n // Copy dates\n detailRow[this.colDate] = totalRow[this.colDate];\n detailRow[this.colDateValuta] = totalRow[this.colDateValuta];\n\n // Copy amount from complete row to detail row\n if (detailRow[this.colDetail].length > 0) {\n if (totalRow[this.colDebit].length > 0) {\n detailRow[this.colDebit] = detailRow[this.colDetail];\n } else if (totalRow[this.colCredit].length > 0) {\n detailRow[this.colCredit] = detailRow[this.colDetail];\n }\n } else {\n detailRow[this.colDebit] = totalRow[this.colDebit];\n detailRow[this.colCredit] = totalRow[this.colCredit];\n }\n }\n\n /** Return true if the transaction is a transaction row */\n this.mapTransaction = function (element) {\n var mappedLine = [];\n\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate]));\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDateValuta]));\n mappedLine.push(\"\"); // Doc is empty for now\n var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces\n mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));\n mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colCredit], \".\"));\n mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colDebit], \".\"));\n\n return mappedLine;\n }\n}", "transactionToJSON(transaction, signature) {\n var _a;\n const object = {\n Account: '',\n Fee: '',\n Sequence: 0,\n LastLedgerSequence: 0,\n SigningPubKey: '',\n };\n const normalizedAccount = getNormalizedAccount(transaction);\n if (!normalizedAccount) {\n return undefined;\n }\n object.Account = normalizedAccount;\n // Convert XRP denominated fee field.\n const txFee = transaction.getFee();\n if (txFee === undefined) {\n return undefined;\n }\n object.Fee = this.xrpAmountToJSON(txFee);\n // Set sequence numbers\n const sequence = transaction.getSequence();\n object.Sequence = sequence !== undefined ? this.sequenceToJSON(sequence) : 0;\n const lastLedgerSequence = transaction.getLastLedgerSequence();\n object.LastLedgerSequence =\n lastLedgerSequence !== undefined\n ? this.lastLedgerSequenceToJSON(lastLedgerSequence)\n : 0;\n const signingPubKeyBytes = (_a = transaction\n .getSigningPublicKey()) === null || _a === void 0 ? void 0 : _a.getValue_asU8();\n if (signingPubKeyBytes) {\n object.SigningPubKey = utils_1.default.toHex(signingPubKeyBytes);\n }\n if (signature) {\n object.TxnSignature = signature;\n }\n Object.assign(object, this.memosToJSON(transaction.getMemosList()));\n const additionalTransactionData = getAdditionalTransactionData(transaction);\n if (additionalTransactionData === undefined) {\n return undefined;\n }\n const transactionJSON = Object.assign(Object.assign({}, object), additionalTransactionData);\n return transactionJSON;\n }", "transactionToJSON(transaction, signature) {\n var _a;\n const object = {\n Account: '',\n Fee: '',\n Sequence: 0,\n LastLedgerSequence: 0,\n SigningPubKey: '',\n };\n const normalizedAccount = getNormalizedAccount(transaction);\n if (!normalizedAccount) {\n return undefined;\n }\n object.Account = normalizedAccount;\n // Convert XRP denominated fee field.\n const txFee = transaction.getFee();\n if (txFee === undefined) {\n return undefined;\n }\n object.Fee = this.xrpAmountToJSON(txFee);\n // Set sequence numbers\n const sequence = transaction.getSequence();\n object.Sequence = sequence !== undefined ? this.sequenceToJSON(sequence) : 0;\n const lastLedgerSequence = transaction.getLastLedgerSequence();\n object.LastLedgerSequence =\n lastLedgerSequence !== undefined\n ? this.lastLedgerSequenceToJSON(lastLedgerSequence)\n : 0;\n const signingPubKeyBytes = (_a = transaction\n .getSigningPublicKey()) === null || _a === void 0 ? void 0 : _a.getValue_asU8();\n if (signingPubKeyBytes) {\n object.SigningPubKey = utils_1.default.toHex(signingPubKeyBytes);\n }\n if (signature) {\n object.TxnSignature = signature;\n }\n const memoList = transaction.getMemosList();\n if (memoList.length > 0) {\n object.Memos = this.memoListToJSON(memoList);\n }\n const flags = transaction.getFlags();\n if (flags) {\n object.Flags = flags.getValue();\n }\n const additionalTransactionData = getAdditionalTransactionData(transaction);\n if (additionalTransactionData === undefined) {\n return undefined;\n }\n const transactionJSON = Object.assign(Object.assign({}, object), additionalTransactionData);\n return transactionJSON;\n }", "function ZKBFormat4() {\n this.colDate = 0;\n this.colDescr = 1;\n this.colExternalRef = 2;\n this.colDebit = 4;\n this.colCredit = 5;\n this.colDateValuta = 6;\n this.colBalance = 7;\n\n /** Return true if the transactions match this format */\n this.match = function (transactions) {\n if (transactions.length === 0)\n return false;\n if (transactions[0].length === (this.colBalance + 1))\n return true;\n return false;\n }\n\n /** Convert the transaction to the format to be imported */\n this.convert = function (transactions) {\n var transactionsToImport = [];\n\n /** Complete, filter and map rows */\n var lastCompleteTransaction = null;\n var isPreviousCompleteTransaction = false;\n\n for (i = 1; i < transactions.length; i++) // First row contains the header\n {\n var transaction = transactions[i];\n\n if (transaction.length === 0) {\n // Righe vuote\n continue;\n } else if (!this.isDetailRow(transaction)) {\n if (isPreviousCompleteTransaction === true)\n transactionsToImport.push(this.mapTransaction(lastCompleteTransaction));\n lastCompleteTransaction = transaction;\n isPreviousCompleteTransaction = true;\n } else {\n this.fillDetailRow(transaction, lastCompleteTransaction);\n transactionsToImport.push(this.mapTransaction(transaction));\n isPreviousCompleteTransaction = false;\n }\n }\n if (isPreviousCompleteTransaction === true) {\n transactionsToImport.push(this.mapTransaction(lastCompleteTransaction));\n }\n\n // Sort rows by date (just invert)\n transactionsToImport = transactionsToImport.reverse();\n\n // Add header and return\n var header = [[\"Date\", \"DateValue\", \"Doc\", \"Description\", \"Income\", \"Expenses\"]];\n return header.concat(transactionsToImport);\n }\n\n /** Return true if the transaction is a transaction row */\n this.isDetailRow = function (transaction) {\n if (transaction[this.colDate].length === 0) // Date (first field) is empty\n return true;\n return false;\n }\n\n /** Fill the detail rows with the missing values. The value are copied from the preceding total row */\n this.fillDetailRow = function (detailRow, totalRow) {\n // Copy dates\n detailRow[this.colDate] = totalRow[this.colDate];\n detailRow[this.colDateValuta] = totalRow[this.colDateValuta];\n\n // Copy amount from complete row to detail row\n if (detailRow[this.colDetail].length > 0) {\n if (totalRow[this.colDebit].length > 0) {\n detailRow[this.colDebit] = detailRow[this.colDetail];\n } else if (totalRow[this.colCredit].length > 0) {\n detailRow[this.colCredit] = detailRow[this.colDetail];\n }\n } else {\n detailRow[this.colDebit] = totalRow[this.colDebit];\n detailRow[this.colCredit] = totalRow[this.colCredit];\n }\n }\n\n /** Return true if the transaction is a transaction row */\n this.mapTransaction = function (element) {\n var mappedLine = [];\n\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate]));\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDateValuta]));\n mappedLine.push(\"\"); // Doc is empty for now\n var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces\n mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));\n mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colCredit], '.'));\n mappedLine.push(Banana.Converter.toInternalNumberFormat(element[this.colDebit], '.'));\n\n return mappedLine;\n }\n}", "function transactionToCsv() {\n const txs = document.querySelectorAll('div[name=\"postedTransactions\"] tr[name=\"DataContainer\"]');\n const csv = Array.from(txs).map(tx => {\n const date = tx.querySelector('div[name=\"Transaction_TransactionDate\"]').textContent.trim();\n const payer = tx.querySelector('div[name=\"Transaction_CardName\"]').textContent.trim();\n const desc = tx.querySelector('div[name=\"Transaction_TransactionDescription\"]').textContent.trim().replace(/\\s+/g, ' ');\n const amount = tx.querySelector('div[name=\"Transaction_Amount\"]').textContent.trim();\n return [toISODate(date), payer, desc, amount].map(e => `\"${e}\"`).join(',');\n\t});\n return csv.join('\\n');\n}", "function wrapTransaction(transData) {\n\t\ttransData.getDateStr = function() {\n\t\t\treturn new Date(this.date).toLocaleDateString();\n\t\t};\n\t\ttransData.getFromAccount = function() {\n\t\t\tif (this.fromVirtualAccountName) {\n\t\t\t\treturn this.fromVirtualAccountName;\n\t\t\t} else {\n\t\t\t\treturn 'N/A';\n\t\t\t}\n\t\t};\n\t\ttransData.getToAccount = function() {\n\t\t\tif (this.toVirtualAccountName) {\n\t\t\t\treturn this.toVirtualAccountName;\n\t\t\t} else {\n\t\t\t\treturn 'N/A';\n\t\t\t}\n\t\t};\n\t\ttransData.getTypeStr = function() {\n\t\t\tswitch (this.type) {\n\t\t\tcase 'TRANSFER' :\n\t\t\t\treturn '转账';\n\t\t\tcase 'INCOME' :\n\t\t\t\treturn '收入';\n\t\t\tcase 'EXPENSE' :\n\t\t\t\treturn '支出';\n\t\t\tdefault :\n\t\t\t\treturn '未知';\n\t\t\t}\n\t\t};\n\t\treturn transData;\n\t}", "function conversion_function() {\n for (const key in Ledger) {\n // AccountIDs to integer\n let ID_value = Ledger[key].AccountID;\n ID_value = Number(ID_value);\n Ledger[key].AccountID = ID_value;\n\n // TransactionValues to 2decimal strings\n let decimal_value = Ledger[key].TransactionValue;\n decimal_value = decimal_value.toFixed(2);\n Ledger[key].TransactionValue = decimal_value;\n }\n }", "function PFCSVFormat1() {\n\n this.colDate = 0;\n this.colDescr = 1;\n this.colCredit = 2;\n this.colDebit = 3;\n this.colDateValuta = 4;\n this.colBalance = 5;\n\n this.dateFormat = 'dd-mm-yyyy';\n this.decimalSeparator = '.';\n\n\n /** Return true if the transactions match this format */\n this.match = function (transactions) {\n if (transactions.length === 0)\n return false;\n\n for (i = 0; i < transactions.length; i++) {\n var transaction = transactions[i];\n\n var formatMatched = false;\n if (transaction.length === (this.colBalance + 1) || transaction.length === (this.colBalance + 2))\n formatMatched = true;\n else\n formatMatched = false;\n\n if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\\.)[0-9]{2}(\\.)[0-9]{2}/g)) {\n this.dateFormat = 'dd.mm.yy';\n formatMatched = true;\n } else if (formatMatched && transaction[this.colDate].match(/[0-9]{2}(\\.|-)[0-9]{2}(\\.|-)[0-9]{4}/g)) {\n formatMatched = true;\n } else if (formatMatched && transaction[this.colDate].match(/[0-9]{4}(\\.|-)[0-9]{2}(\\.|-)[0-9]{2}/g)) {\n formatMatched = true;\n this.dateFormat = 'yyyy-mm-dd';\n } else {\n formatMatched = false;\n }\n\n if (formatMatched && transaction[this.colDateValuta].match(/[0-9]{2,4}(\\.|-)[0-9]{2}(\\.|-)[0-9]{2,4}/g))\n formatMatched = true;\n else\n formatMatched = false;\n\n if (formatMatched)\n return true;\n }\n\n return false;\n }\n\n\n /** Convert the transaction to the format to be imported */\n this.convert = function (transactions) {\n var transactionsToImport = [];\n\n // Filter and map rows\n for (i = 0; i < transactions.length; i++) {\n var transaction = transactions[i];\n if (transaction.length < (this.colBalance + 1))\n continue;\n if (transaction[this.colDate].match(/[0-9\\.]{3}/g) && transaction[this.colDateValuta].match(/[0-9\\.]{3}/g))\n transactionsToImport.push(this.mapTransaction(transaction));\n }\n\n // Sort rows by date\n transactionsToImport = this.sort(transactionsToImport);\n\n // Add header and return\n var header = [[\"Date\", \"DateValue\", \"Doc\", \"Description\", \"Income\", \"Expenses\"]];\n return header.concat(transactionsToImport);\n }\n\n\n /** Sort transactions by date */\n this.sort = function (transactions) {\n if (transactions.length <= 0)\n return transactions;\n var i = 0;\n var previousDate = transactions[0][this.colDate];\n while (i < transactions.length) {\n var date = transactions[i][this.colDate];\n if (previousDate.length > 0 && previousDate > date)\n return transactions.reverse();\n else if (previousDate.length > 0 && previousDate < date)\n return transactions;\n i++;\n }\n return transactions;\n }\n\n this.mapTransaction = function (element) {\n var mappedLine = [];\n\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDate], this.dateFormat));\n mappedLine.push(Banana.Converter.toInternalDateFormat(element[this.colDateValuta], this.dateFormat));\n mappedLine.push(\"\"); // Doc is empty for now\n var tidyDescr = element[this.colDescr].replace(/ {2,}/g, ''); //remove white spaces\n mappedLine.push(Banana.Converter.stringToCamelCase(tidyDescr));\n var amount = element[this.colCredit].replace(/\\+/g, ''); //remove plus sign\n mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, this.decimalSeparator));\n amount = element[this.colDebit].replace(/-/g, ''); //remove minus sign\n mappedLine.push(Banana.Converter.toInternalNumberFormat(amount, this.decimalSeparator));\n\n return mappedLine;\n }\n}", "function saveTransaction(transaction) {\n // generate current date and tansform it to locale string\n var date = new Date().toLocaleDateString();\n // get all chars before \"@\" as paypee\n var payee = transaction.email.match(/.+?(?=@)/)[0];\n // unshift(push to front) payment-detail object to recentTransaction\n recentTransaction.unshift({\n date: date,\n payee: payee,\n amount: transaction.currency.symbol + transaction.amount,\n });\n }", "formatEmailTransaction(tx, app) {}", "static hexlifyTransaction(transaction, allowExtra) {\n // Check only allowed properties are given\n const allowed = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__[\"shallowCopy\"])(allowedTransactionKeys);\n if (allowExtra) {\n for (const key in allowExtra) {\n if (allowExtra[key]) {\n allowed[key] = true;\n }\n }\n }\n Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__[\"checkProperties\"])(transaction, allowed);\n const result = {};\n // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.\n [\"gasLimit\", \"gasPrice\", \"type\", \"nonce\", \"value\"].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n const value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__[\"hexValue\"])(transaction[key]);\n if (key === \"gasLimit\") {\n key = \"gas\";\n }\n result[key] = value;\n });\n [\"from\", \"to\", \"data\"].forEach(function (key) {\n if (transaction[key] == null) {\n return;\n }\n result[key] = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__[\"hexlify\"])(transaction[key]);\n });\n if (transaction.accessList) {\n result[\"accessList\"] = Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_6__[\"accessListify\"])(transaction.accessList);\n }\n return result;\n }", "function parse_only_transactions( value, account_name )\n{\nvar ret = \"{ \\n\";\nret += '\"actions\" : [\\n';\n\n\nvar size = value.actions.length;\n\n \nvar cnt2 = 0; \n \nfor ( var i=0; i<size; i++ )\n {\n \n var account_action_seq = value.actions[i].account_action_seq; \n \n var action_account = value.actions[i].action_trace.act.account; \n var action_name = value.actions[i].action_trace.act.name; \n var block_time = value.actions[i].block_time; \n var ts = Math.floor( (new Date(block_time)).getTime() / 1000 );\n \n \n \n if (action_name == 'transfer')\n {\n var data_from = value.actions[i].action_trace.act.data.from;\n var data_memo = value.actions[i].action_trace.act.data.memo;\n var data_quantity = value.actions[i].action_trace.act.data.quantity;\n var data_to = value.actions[i].action_trace.act.data.to; \n var receiver = value.actions[i].action_trace.receipt.receiver; \n\n data_memo = JSON.stringify(data_memo, undefined, 1);\n\n\n if (receiver == data_to)\n {\n \n if (cnt2 > 0 ) \n ret += ',\\n'; else\n ret += '\\n';\n cnt2++; \n \n \n qarray = data_quantity.split(\" \"); \n var data_amount = qarray[0];\n var data_token = qarray[1];\n \n ret += '{\"seq\": \"'+account_action_seq+'\",\"time\": \"'+ts+'\", \"contract\":\"'+action_account+'\" , \"from\":\"'+data_from+'\" , \"to\":\"'+data_to+'\" , \"quantity\":\"'+data_quantity+'\" , \"amount\":\"'+data_amount+'\" , \"token\":\"'+data_token+'\" , \"memo\":'+data_memo+' }';\n \n } // if (receiver == action_account)\n\n } // if (action_name == 'transfer')\n \n \n \n \n } // for...\n \n \n \n \nret += ']\\n';\nret += '}\\n';\n \n \n\nreturn(ret);\n} // parse_only_transactions", "jsonToModelMap(jsonData) {\n const transactions = [];\n if (jsonData.length > 0) {\n jsonData.map(t => {\n const tempTran = new Transaction();\n const tempTramAmnt = new TransactionAmount();\n tempTran.setDate(new Date(t.date));\n tempTran.setUserId(t.user_id);\n tempTran.setUserType(t.user_type);\n tempTran.setTransactionType(t.type);\n tempTramAmnt.setAmount(t.operation.amount);\n tempTramAmnt.setCurrency(t.operation.currency);\n tempTran.setOperation(tempTramAmnt);\n transactions.push(tempTran);\n });\n }\n return transactions;\n }", "unmarshalIntoBlockWithTransactionData(blockWithHexValues) {\n const block = Object.assign(Object.assign({}, blockWithHexValues), { gasLimit: utils_2.utils.convertHexToNumber(blockWithHexValues.gasLimit), gasUsed: utils_2.utils.convertHexToNumber(blockWithHexValues.gasUsed), size: utils_2.utils.convertHexToNumber(blockWithHexValues.size), timestamp: utils_2.utils.convertHexToNumber(blockWithHexValues.timestamp), number: blockWithHexValues.number === null ? null : utils_2.utils.convertHexToNumber(blockWithHexValues.number), difficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.difficulty), totalDifficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.totalDifficulty), transactions: [] });\n block.transactions = _.map(blockWithHexValues.transactions, (tx) => {\n const transaction = exports.marshaller.unmarshalTransaction(tx);\n return transaction;\n });\n return block;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
A function for testing float packing/unpacking.
function testPack2Floats() { var tests = [ vec2(0.0, 3.0), vec2(20.0, 0.2), vec2(1.0, 1.0), vec2(1.0, 0.0), vec2(0.0, 1.0), ]; for(var i = 0; i < tests.length; i++) { var orig = tests[i]; var packed = pack2Floats(orig[0], orig[1]); var unpacked = unpack2Floats(packed); console.log(orig + "packed to " + packed + " and unpacked to " + unpacked); } console.log("3276801 unpacks to " + unpack2Floats(3276801)); }
[ "function _float(data) {\n return number(data) && data % 1 !== 0;\n }", "function _float(data) {\n return number(data) && data % 1 !== 0;\n}", "function isFloat (s)\r\n\r\n{ if (isEmpty(s)) \r\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\r\n else return (isFloat.arguments[1] == true);\r\n\r\n return reFloat.test(s)\r\n}", "function floatEqual (f1, f2) {\n return (Math.abs(f1 - f2) < 0.000001);\n }", "function isFloat(n){\n\t return parseFloat(n.match(/^-?\\d*(\\.\\d+)?$/))>0;\n\t}", "readFloat(){return this.__readFloatingPointNumber(4)}", "function is_float(v) {\r\n if (is_numeric(v)) {\r\n if (is_int(v)) {\r\n return false;\r\n } else {\r\n return true;\r\n }\r\n } else {\r\n return false;\r\n }\r\n}", "function testFloatPositive(val)\n {\n return /^([0-9]+|[0-9]+\\.|\\.[0-9]+|[0-9]+\\.[0-9]+)$/.test(val);\n }", "function isFloat(val) {\n return +val === val && (!isFinite(val) || !!(val % 1)); // http://locutus.io/php/var/is_float/\n }", "function isFloat(valueOfStr){\r\n\tvar patrn1 = /^([+|-]?\\d+)(\\.\\d+)?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloat(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "readFloat() {\n const helper = new misc_functions_1.ReturnHelper();\n const start = this.cursor;\n const readToTest = this.readWhileRegexp(StringReader.charAllowedNumber);\n\n if (readToTest.length === 0) {\n return helper.fail(EXCEPTIONS.EXPECTED_FLOAT.create(start, this.string.length));\n } // The Java readInt throws upon multiple `.`s, but Javascript's doesn't\n\n\n if ((readToTest.match(/\\./g) || []).length > 1) {\n return helper.fail(EXCEPTIONS.INVALID_FLOAT.create(start, this.cursor, this.string.substring(start, this.cursor)));\n }\n\n try {\n return helper.succeed(parseFloat(readToTest));\n } catch (error) {\n return helper.fail(EXCEPTIONS.INVALID_FLOAT.create(start, this.cursor, readToTest));\n }\n }", "function isFloat (element)\n{\n\treturn typeof element === \"number\" && element % 1 !== 0;\n}", "function isFloat(value) {\n\tvar floatReg = /[0-9]+(\\.[0-9]+)?/g;\n\tif (value.search(floatReg) != -1) {\n\t\treturn true;\n\t}\n\treturn false;\n}", "function isFloat(value){\n var floatReg = /[0-9]+(\\.[0-9]+)?/g;\n if( value.search(floatReg) != -1 ){\n return true;\n }\n return false;\n}", "function is_float(object)\n{\n return object != undefined && object.toFixed != undefined && parseInt(object) != object;\n}", "parseBinaryFloat(buf) {\n buf = Buffer.from(buf);\n if (buf[0] & 0x80) {\n buf[0] &= 0x7f;\n } else {\n // complement the bits for a negative number\n buf[0] ^= 0xff;\n buf[1] ^= 0xff;\n buf[2] ^= 0xff;\n buf[3] ^= 0xff;\n }\n return buf.readFloatBE();\n }", "_tryWriteFloat(str) {\n buf_8.writeDoubleBE(str);\n if((buf_8.readDoubleBE() + '') === str) {\n this._writeUInt8(CborTypes.TYPE_FLOAT_64);\n this._mInOut.write(buf_8);\n return true;\n } else {\n return false;\n }\n }", "function floatBits(f) {\n let buf = new ArrayBuffer(4);\n (new Float32Array(buf))[0] = f;\n let bits = (new Uint32Array(buf))[0];\n // Return as a signed integer.\n return bits | 0;\n}", "function parseFloat24 ([b1, b2, b3]) {\n const v = new DataView (new ArrayBuffer (4))\n\tconst shortValue = (b1 << 16) | (b2 << 8) | b3\n\tconst sign = (shortValue & 0x800000) >>> 23\n\tconst exponent = ((shortValue & 0x7e0000) >>> 17) - 32\n\tconst mantissa = (shortValue & 0x01ffff) << 6\n\tconst value = (sign << 31) | ((exponent + 127) << 23) | mantissa\n v.setUint32 (0, value)\n const f = v.getFloat32 (0)\n //log (f)\n return f\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Compile a single token value to a register, examples: 1, "string", local, global
compileSingleTokenToRegister(opts, result) { let program = this._program; result.dataSize = 1; if (opts.identifier && opts.identifier.getType) { this.setLastRecordType(opts.identifier.getType().type); } if (opts.expression.tokens[0].cls === t.TOKEN_NUMBER) { program.addCommand($.CMD_SET, $.T_NUM_L, this._scope.getStackOffset(), $.T_NUM_C, opts.expression.tokens[0].value); helper.setReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK); helper.addToReg(this._program, opts.reg, $.T_NUM_C, this._scope.getStackOffset()); } else if (opts.identifier === null) { let token = opts.expression.tokens[0]; throw errors.createError(err.UNDEFINED_IDENTIFIER, token, 'Undefined identifier "' + token.lexeme + '".'); } else if (opts.identifier instanceof Proc) { this._compiler.getUseInfo().setUseProc(opts.identifier.getName(), opts.identifier); // Set the proc as used... helper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getEntryPoint() - 1); result.type = t.LEXEME_PROC; } else { if (opts.identifier.getWithOffset() !== null) { helper.setReg(this._program, $.REG_PTR, $.T_NUM_L, opts.identifier.getWithOffset()); if (opts.identifier.getType().type === t.LEXEME_PROC) { this._lastProcField = opts.identifier.getProc(); if (opts.selfPointerStackOffset !== false) { // It's a method to call then save the self pointer on the stack! helper.saveSelfPointerToLocal(program, opts.selfPointerStackOffset, opts.reg); } } if (opts.reg === $.REG_PTR) { program.addCommand( $.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset() ); } else { program.addCommand( $.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset(), $.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_G, $.REG_PTR ); } } else if (opts.identifier.getPointer() && (opts.identifier.getType().type === t.LEXEME_STRING)) { helper.setReg(this._program, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset()); // If it's a "with" field then the offset is relative to the pointer on the stack not to the stack register itself! if (!opts.identifier.getGlobal() && (opts.identifier.getWithOffset() === null)) { helper.addToReg(this._program, $.REG_PTR, $.T_NUM_G, $.REG_STACK); } program.addCommand($.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0); } else { result.dataSize = opts.identifier.getTotalSize(); helper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getOffset()); if (opts.identifier.getWithOffset() === null) { if (opts.identifier.getPointer() && !opts.forWriting && (opts.identifier.getType().type !== t.LEXEME_NUMBER)) { if (!opts.identifier.getGlobal()) { helper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK); } program.addCommand( $.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_G, opts.reg, $.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0 ); } else if (!opts.identifier.getGlobal()) { helper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK); } } } result.type = opts.identifier; } if (opts.identifier && opts.identifier.getArraySize && opts.identifier.getArraySize()) { result.fullArrayAddress = false; } return result; }
[ "compileSingleTokenToRegister(opts, result) {\n let program = this._program;\n result.dataSize = 1;\n if (opts.identifier && opts.identifier.getType) {\n this.setLastRecordType(opts.identifier.getType().type);\n }\n if (opts.expression.tokens[0].cls === t.TOKEN_NUMBER) {\n program.addCommand($.CMD_SET, $.T_NUM_L, this._scope.getStackOffset(), $.T_NUM_C, opts.expression.tokens[0].value);\n helper.setReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\n helper.addToReg(this._program, opts.reg, $.T_NUM_C, this._scope.getStackOffset());\n } else if (opts.identifier === null) {\n let token = opts.expression.tokens[0];\n throw errors.createError(err.UNDEFINED_IDENTIFIER, token, 'Undefined identifier \"' + token.lexeme + '\".');\n } else if (opts.identifier instanceof Proc) {\n this._compiler.getUseInfo().setUseProc(opts.identifier.getName(), opts.identifier); // Set the proc as used...\n helper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getEntryPoint() - 1);\n result.type = t.LEXEME_PROC;\n } else {\n if (opts.identifier.getWithOffset() !== null) {\n helper.setReg(this._program, $.REG_PTR, $.T_NUM_L, opts.identifier.getWithOffset());\n if (opts.identifier.getType().type === t.LEXEME_PROC) {\n this._lastProcField = opts.identifier.getProc();\n if (opts.selfPointerStackOffset !== false) {\n // It's a method to call then save the self pointer on the stack!\n helper.saveSelfPointerToLocal(program, opts.selfPointerStackOffset, opts.reg);\n }\n }\n if (opts.reg === $.REG_PTR) {\n program.addCommand(\n $.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset()\n );\n } else {\n program.addCommand(\n $.CMD_ADD, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset(),\n $.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_G, $.REG_PTR\n );\n }\n } else if (opts.identifier.getPointer() && (opts.identifier.getType().type === t.LEXEME_STRING)) {\n helper.setReg(this._program, $.REG_PTR, $.T_NUM_C, opts.identifier.getOffset());\n // If it's a \"with\" field then the offset is relative to the pointer on the stack not to the stack register itself!\n if (!opts.identifier.getGlobal() && (opts.identifier.getWithOffset() === null)) {\n helper.addToReg(this._program, $.REG_PTR, $.T_NUM_G, $.REG_STACK);\n }\n program.addCommand($.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0);\n } else {\n result.dataSize = opts.identifier.getTotalSize();\n helper.setReg(this._program, opts.reg, $.T_NUM_C, opts.identifier.getOffset());\n if (opts.identifier.getWithOffset() === null) {\n if (opts.identifier.getPointer() && !opts.forWriting && (opts.identifier.getType().type !== t.LEXEME_NUMBER)) {\n if (!opts.identifier.getGlobal()) {\n helper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\n }\n program.addCommand(\n $.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_G, opts.reg,\n $.CMD_SET, $.T_NUM_G, opts.reg, $.T_NUM_P, 0\n );\n } else if (!opts.identifier.getGlobal()) {\n helper.addToReg(this._program, opts.reg, $.T_NUM_G, $.REG_STACK);\n }\n }\n }\n result.type = opts.identifier;\n }\n if (opts.identifier && opts.identifier.getArraySize && opts.identifier.getArraySize()) {\n result.fullArrayAddress = false;\n }\n return result;\n }", "function getToken(scanner, ctx) {\n return field(scanner, ctx)\n || repeaterPlaceholder(scanner)\n || repeaterNumber(scanner)\n || repeater$1(scanner)\n || whiteSpace(scanner)\n || literal$1(scanner, ctx)\n || operator(scanner)\n || quote(scanner)\n || bracket(scanner);\n}", "function token(typ,val){\n\treturn new Token(typ,val,-1,0);\n}", "function getToken(scanner, ctx) {\n return field(scanner, ctx) ||\n repeaterPlaceholder(scanner) ||\n repeaterNumber(scanner) ||\n repeater$1(scanner) ||\n whiteSpace(scanner) ||\n literal$1(scanner, ctx) ||\n operator(scanner) ||\n quote(scanner) ||\n bracket(scanner);\n }", "function lit(value) { return new TLiteral(value); }", "function token(typ,val){\n\t\treturn new Token(typ,val,-1,0);\n\t}", "function convertTokenToValue(token){\n var value;\n var instr, result, opToken;\n opToken = token[0]; //array of 1, but its simpler to just convert to 1 token\n \n instr = opToken.id;\n var index, tempHold;\n var isNeg = false;\n if(opToken.id.charAt(0) === \"-\"){\n isNeg =true;\n opToken.id = opToken.id.slice(1);\n }\n if(opToken.type === \"ID\"){\n instr = \"\\\"\" + instr + \"\\\"\"; //when pushing conversion instruction it will read \"Value \"var\" \"\n index = varIsDeclared(opToken.id);\n let printResult;\n if(index !== -1){//not a new variable\n var valueType = getVarType(index);\n if(valueType === \"TRUE\"){\n value = 1;\n result = \"True\";\n printResult = result;\n }else if(valueType === \"FALSE\"){\n value = 0;\n result = \"False\";\n printResult = result;\n }else if(valueType === \"FLOAT\"){\n value = Number.parseFloat(getVarValue(index));\n result = value;\n printResult = result;\n }else if(valueType === \"STRING\"){\n value = getVarValue(index);\n printResult = result;\n result = value;\n }else if(valueType === \"BINARY\"){\n tempHold = getVarValue(index);\n tempHold = tempHold.slice(2); //remove \"0b\" before parsing\n value = Number.parseInt(tempHold, 2);\n result = value;\n printResult = \"0b\" + tempHold;\n }else if(valueType === \"OCTAL\"){\n tempHold = getVarValue(index);\n tempHold = tempHold.slice(2);\n value = Number.parseInt(tempHold, 8);\n result = value;\n printResult = \"0o\" + tempHold;\n }else if(valueType === \"HEX\"){\n tempHold = getVarValue(index);\n tempHold = tempHold.slice(2);\n value = Number.parseInt(tempHold, 16);\n result = value;\n printResult = \"0x\" + tempHold;\n }else if(valueType === \"NUMBER\"){\n value = Number.parseInt(getVarValue(index), 10);//assumes to be an int at this point\n result = value;\n printResult = result;\n }\n opToken.type = valueType;\n }else{//new variable, but it can't be declared here\n runtime_error(\"UNDECLARED_VAR\");\n }\n pushInstr(\"Variable \" + instr, \" is resolved to \" + printResult, cmdCount, opToken.line_no, 0);\n }else{\n switch(opToken.type){\n case \"FLOAT\":\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = Number.parseFloat(opToken.id);\n break;\n case \"NUMBER\":\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = Number.parseInt(opToken.id, 10);\n break;\n case \"BINARY\":\n opToken.id = opToken.id.slice(2); //slice off 0b for conversion\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = Number.parseInt(opToken.id, 2);\n break;\n case \"OCTAL\":\n opToken.id = opToken.id.slice(2); //slice off 0o for conversion\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = Number.parseInt(opToken.id, 8);\n break;\n case \"HEX\":\n opToken.id = opToken.id.slice(2); //slice off 0x for conversion\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = Number.parseInt(opToken.id, 16);\n break;\n case \"STRING\":\n if(isNeg)\n opToken.id = \"-\" + opToken.id;\n value = opToken.id;\n break;\n case \"TRUE\":\n value = 1;\n break;\n case \"FALSE\":\n value = 0;\n break;\n case \"STRING\":\n value = opToken.id;\n break;\n }\n }\n var returnVal = {\n value: value,\n type: opToken.type\n };\n //console.log(returnVal.value + \" \" + returnVal.type);\n return returnVal;\n}", "_compileValue(node) {\n\t\tif (!node) return;\n\t\tswitch (node.type) {\n\t\t\tcase 'block':\n\t\t\t\treturn this.compileBlock(node, this.compileValue);\n\t\t\tcase 'call':\n\t\t\t\treturn this.compileCall(node, values);\n\t\t\tcase 'enum':\n\t\t\t\treturn this.compileEnum(node);\n\t\t\tcase 'not':\n\t\t\t\treturn this.compileNot(node);\n\t\t\tcase 'number':\n\t\t\t\treturn new CompiledNode(types.number, node.value);\n\t\t\tcase 'boolean':\n\t\t\t\treturn new CompiledNode(types.boolean, node.value);\n\t\t\tcase 'player':\n\t\t\t\treturn new CompiledNode(types.player, 'Event Player');\n\t\t\tcase 'id':\n\t\t\t\treturn this.compileIdentifier(node, this.env);\n\t\t}\n\t}", "function translateRegisterNames(token) {\n var toRet = token.replace(registerKey, \"\").replace(programCounter, \"\");\n\n // We either have a programCounter or a null register\n // Just return what we were given\n if (toRet === null || \"\" === toRet) {\n return token;\n }\n\n // If the token doesn't start with a number, we will\n // try and translate it\n if (isNaN(toRet[0])) {\n return registerKey + regNames[toRet];\n }\n \n // If it was a number, just return what we were given\n return token;\n}", "function Literal(node_type, token)\n{\n return {\n type: node_type,\n start: token.offset,\n end: token.offset + token.text.length,\n value: token.value,\n };\n}", "function asToken(v) {\n var line = -1, col = -1;\n if (v instanceof Array) {\n line = v[1];\n col = v[2];\n v = v[0];\n }\n\n if (typeof v == \"string\") {\n return Token.makeStr('\"' + v + '\"', line, col);\n } else if (typeof v == \"number\") {\n return Token.makeNum(v, line, col);\n } else if (v instanceof RegExp) {\n var flags = (v.global ? \"g\" : \"\") + (v.multiline ? \"m\" : \"\") + (v.ignoreCase ? \"i\" : \"\");\n return Token.make(\"REGEXP\", { body: v.source, flags: flags }, line, col);\n } else if (typeof v == \"object\") {\n if (v === eof) {\n return Token.makeEof(line, col);\n } else if (v === unquote) {\n return Token.makeUnquote(line, col);\n } else if (v === unquote_s) {\n return Token.makeUnquoteSplicing(line, col);\n } else if (v.identifier !== undefined) {\n return Token.makeIdent(v.identifier, line, col);\n } else if (v.hash_identifier !== undefined) {\n return Token.make(\"HASH_IDENTIFIER\", v.hash_identifier, line, col);\n } else if (v.indent !== undefined) {\n return Token.makeIndent(v.indent, line, col)\n } else if (v.symbol !== undefined) {\n return Token.make(v.symbol, v.symbol, line, col);\n } else if (v.operator !== undefined) {\n return Token.make(\"OPERATOR\", v.operator, line, col);\n } else if (v.qualifier !== undefined) {\n return Token.make(\"QUALIFIER\", v.qualifier, line, col);\n } else if (v.comment !== undefined) {\n return Token.makePreservedComment(v.comment, line, col);\n } else if (v.istrhead !== undefined) {\n return Token.makeInterpolatedStrHead(v.istrhead, line, col);\n } else if (v.istrpart !== undefined) {\n return Token.makeInterpolatedStrPart(v.istrpart, line, col);\n } else if (v.istrtail !== undefined) {\n return Token.makeInterpolatedStrTail(v.istrtail, line, col);\n } else if (v.regexphead !== undefined) {\n return Token.makeInterpolatedRegexpHead(v.regexphead, line, col);\n } else if (v.regexppart !== undefined) {\n return Token.makeInterpolatedRegexpPart(v.regexppart, line, col);\n } else if (v.regexptail !== undefined) {\n return Token.makeInterpolatedRegexpTail(v.regexptail, v.flags, line, col);\n } else {\n throw \"asToken: Unknown type \" + JSON.stringify(v);\n }\n } else {\n throw \"asToken: Unknown type \" + JSON.stringify(v);\n }\n}", "function operatorToken(tokenIn, type) {\n this.token = tokenIn;\n this.arguments = type;\n}", "async compileTerm () {\n this.pushScope('compile term')\n await this.pause()\n const { tokenizer } = this\n tokenizer.advance()\n const type = tokenizer.tokenType()\n\n switch (type) {\n case TOKEN_TYPE.INTEGER_CONSTANT:\n this.vmWriter.writePush(SEGMENTS.CONSTANT, tokenizer.intVal())\n break\n case TOKEN_TYPE.STRING_CONSTANT:\n this.compileStringConstant(tokenizer.stringVal())\n break\n case TOKEN_TYPE.KEYWORD:\n tokenizer.back()\n this.compileKeywordConstant()\n break\n case TOKEN_TYPE.SYMBOL: {\n const tokenValue = tokenizer.tokenValue()\n if (tokenValue === '(') {\n await this.compileExpression()\n this.assert({ [TOKEN_TYPE.SYMBOL]: ')' })\n } else if (UNARY_OPERATORS.includes(tokenValue)) {\n this.compileTerm()\n this.vmWriter.writeArithmetic(VM_UNARY_COMMANDS_MAPPING[tokenValue])\n } else {\n throw new ParserException(\n `Expected '(' OR '-, ~' but found ${type.toUpperCase()} '${tokenValue}'`\n )\n }\n }\n break\n case TOKEN_TYPE.IDENTIFIER:\n // is function/method call\n if (this.lookAhead(['.', '('])) {\n tokenizer.back()\n await this.compileSubroutineCall()\n } else if (this.lookAhead('[')) {\n const identifier = tokenizer.tokenValue()\n // array call\n this.assert({ [TOKEN_TYPE.SYMBOL]: '[' })\n await this.compileExpression()\n this.assert({ [TOKEN_TYPE.SYMBOL]: ']' })\n this.compileArrayValue(identifier)\n } else {\n this.compileIdentifier(tokenizer.tokenValue())\n }\n break\n default: {\n const tokenTypes = [TOKEN_TYPE.INTEGER_CONSTANT, TOKEN_TYPE.STRING_CONSTANT, TOKEN_TYPE.IDENTIFIER]\n const msg = `${tokenTypes.map(t => t.toUpperCase()).join(' | ')} | 'true, false, null, this' |\n 'varName[expression]' | 'subroutineCall' | '(expression)' | '-, ~'`\n throw new ParserException(`Expected ${msg} but found ${type.toUpperCase()} ${tokenizer.tokenValue()}`)\n }\n }\n this.popScope()\n }", "function token(typ,val,line,region){\n\t\treturn new Token(typ,val,line,region);\n\t}", "function createLiteral(value, type) {\n return obj(\"@value\", value, \"@type\", type );\n }", "function toValue(register, prefix) {\n if (isVariable(register)) {\n return prefix[register.id];\n }\n return register;\n}", "createRawToken(type, value, referToken){\n return this.stc.flkit.createRawToken(type, value, referToken);\n }", "function createLiteral(value, type) {\n return { value: value, type: type };\n }", "function typeToken() {\n\t\tvar type = thisToken;\n\t\tif (lastToken == '*')\n\t\t\ttype = '*' + type;\n\t\tgetToken();\n\t\tremoveNewLine();\n\t\tif (thisToken == '*' || thisToken == '&') {\n\t\t\tif (thisToken == '*')\n\t\t\t\ttype = thisToken + type;\n\t\t\tgetToken();\n\t\t}\n\t\t//type cast, not implemented\n\t\tif (thisToken == ')') {\n\t\t\tgetToken();\n\t\t\texecut();\n\t\t\treturn;\n\t\t}\n\t\tgetToken();\n\t\t//call function registration\n\t\tif (thisToken == '(') {\n\t\t\tpreviousToken();\n\t\t\taddFunction(type);\n\t\t} else if (thisToken == '[') {\n\t\t\taddArray(type);\n\t\t}\n\t\t//declaration of variables of the same type, separated by commas, assignment is not supported\n\t\telse if (thisToken == ',') {\n\t\t\tpreviousToken();\n\t\t\taddVar(type);\n\t\t\tgetToken();\n\t\t\twhile (thisToken && thisToken != ';') {\n\t\t\t\tgetToken();\n\t\t\t\taddVar(type);\n\t\t\t\tgetToken();\n\t\t\t\tif (!(thisToken == ',' || thisToken == ';'))\n\t\t\t\t\tputError(lineCount, 17, '');\n\t\t\t\t//info(\"\" + lineCount + \" unsupported variable declaration\");\n\t\t\t}\n\t\t} else {\n\t\t\tpreviousToken();\n\t\t\taddVar(type);\n\t\t}\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Clamps a value between a minimum and a maximum.
function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); }
[ "function clamp(value, min, max) {\n return value < min ? min : (value > max ? max : value);\n }", "function clamp(value, min, max) {\n return value < min ? min : (value > max ? max : value);\n }", "function clamp$1(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}", "function clamp(val, min, max){\n return Math.max(min, Math.min(max, val));\n }", "function clamp(value, min, max) {\n return Math.max(min, Math.min(max, value));\n}", "function clamp(value, min, max){\n return (value > max ? max : (value < min ? min : value));\n }", "function clamp(val, min, max){\r\n return Math.max(min, Math.min(max, val));\r\n}", "function clamp(val, min, max){\n\treturn Math.max(min, Math.min(max, val));\n}", "function clamp(value, min, max){\n return value > max ? max : value < min ? min : value\n}", "function clamp$1(value, max) {\n return Math.max(0, Math.min(max, value));\n }", "function clamp$1(value, max) {\n return Math.max(0, Math.min(max, value));\n}", "function clamp(value, min, max) {\n if (isNaN(value) || isNaN(min) || isNaN(max)) return false;\n if (min > value) return min;\n if (max < value) return max;\n return value;\n }", "function clamp(min, x, max) { return Math.min(Math.max(x, min), max); }", "function clampValue(item, min, max){\n if (max != null && item.value > max){\n item.value = max;\n }\n else if (min != null && item.value < min){\n item.value = min;\n }\n}", "function clampValue(min, n, max) {\n\t return Math.min(Math.max(min, n), max);\n\t}", "function clamp(x, min_val, max_val) {\n return Math.max(min_val, Math.min(max_val, x));\n}", "function clamp(x, min_val, max_val) {\n return Math.max(min_val, Math.min(max_val, x));\n }", "function clampValue(min, n, max) {\n return Math.min(Math.max(min, n), max);\n}", "function clamp(num, min, max) {\n return Math.max(min, Math.min(max, num));\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
To stay backwards compatible with puppeteer's (and our) default export after adding `addExtra` we need to defer the check if we have a puppeteer instance to work with. Otherwise we would throw even if the user intends to use their nonstandard puppeteer implementation.
get pptr() { if (this._pptr) { return this._pptr; } // Whoopsie console.warn(` Puppeteer is missing. :-) Note: puppeteer is a peer dependency of puppeteer-extra, which means you can install your own preferred version. - To get the latest stable version run: 'yarn add puppeteer' or 'npm i puppeteer' Alternatively: - To get puppeteer without the bundled Chromium browser install 'puppeteer-core' - To use puppeteer-firefox install 'puppeteer-firefox' and use the 'addExtra' export `); throw this._requireError || new Error('No puppeteer instance provided.'); }
[ "async function givePage(){\n const browser = await puppeteer.launch({headless: false})\n const page = await browser.newPage();\n return page;\n}", "setup() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._options.browser)\n this._browser = this._options.browser;\n else\n this._browser = yield puppeteer_1.default.launch();\n if (this._options.page)\n this._page = this._options.page;\n else\n this._page = yield this._browser.newPage();\n for (const plugin of this._plugins)\n if (!plugin.options.page)\n plugin.options.page = this._page;\n });\n }", "async function instance(){\n\tconst browser = await puppeteer.launch({\n\t\theadless: false\n\t})\n\n\tconst page = await browser.newPage()\n\treturn {page, browser}\n}", "static async build(){\n const browser = await puppeteer.launch({\n headless: true,\n args: ['--no-sandbox']\n });\n\n const page = await browser.newPage();\n const customPage = new CustomPage(page);\n\n return new Proxy(customPage, {\n get: function(target, property){\n // we include browser because in our test suite,\n // we use browser to get a page and then close the browser and page\n // by including browser here, we never have to work with the browser obj anymore\n // we let our proxy handle all browser functions such as creating a page\n // browser is given a higher priority than page here so that when page.close()\n // is called it calls browser's close fn and not page's close fn\n return customPage[property] || browser[property] || page[property];\n }\n });\n }", "static async build() {\n // Generate the browser and page from puppeteer\n const browser = await puppeteer.launch({\n headless: true,\n args: ['--no-sandbox'],\n });\n const page = await browser.newPage();\n\n // Construct the TestingPage instance with an internal reference to the puppeteer page implementation\n const testingPage = new TestingPage(page);\n\n // Return a Proxy which prioritizes our custom methods first, and falls back to the others if undefined\n return new Proxy(testingPage, {\n get: function(target, property) {\n // Get really crazy, and use the proxy to give us access to methods on all three objects\n // We only ever use browser for launching a new page, so we don't really need a separate browser instance\n return target[property] || browser[property] || page[property];\n },\n });\n }", "async function setup ({ headless = false, numWorkers = 0, userDataDir, userDownloadDir }) {\n const browser = await puppeteer.launch({\n headless,\n userDataDir\n })\n const mainPage = await getFirst(browser)\n await mainPage._client.send('Page.setDownloadBehavior', {\n behavior: 'allow',\n downloadPath: userDownloadDir\n })\n\n const workers = []\n for (let w = 0; w < numWorkers; w++) {\n const worker = await pageInNewWindow(browser, mainPage, w)\n workers.push(worker)\n }\n\n return {\n browser,\n mainPage,\n workers\n }\n}", "static async build() {\n // Create a new browser object\n const browser = await puppeteer.launch({\n headless: false\n });\n const page = await browser.newPage();\n const customPage = new CustomPage(page);\n\n return new Proxy(customPage, {\n get: function(target, property) {\n // Proxy access to methods on all three objects\n // e.g., customPage.login(), page.goto() or browser.close()\n return customPage[property] || browser[property] || page[property];\n }\n });\n }", "static async build() { // <-- creates method: CustomPage.build()\n const browser = await puppeteer.launch({\n headless: true,\n args: ['--no-sandbox'] // so we don't need to mess around with travis's VM settings\n })\n\n const page = await browser.newPage();\n const proxiedPage = new ProxiedPage(page)\n\n // tells Proxy to look for property on customPage --> page --> browser in that order\n return new Proxy(proxiedPage, {\n get: function (target, property) {\n // change order of these fxns in order of priority\n return proxiedPage[property] || browser[property] || page[property];\n }\n })\n }", "resolvePluginDependencies () {\n // Request missing dependencies from all plugins and flatten to a single Set\n const missingPlugins = this._plugins\n .map(p => p._getMissingDependencies(this._plugins))\n .reduce((combined, list) => {\n return new Set([...combined, ...list])\n }, new Set())\n if (!missingPlugins.size) {\n debug('no dependencies are missing')\n return\n }\n debug('dependencies missing', missingPlugins)\n // Loop through all dependencies declared missing by plugins\n for (let name of [...missingPlugins]) {\n // Check if the dependency hasn't been registered as plugin already.\n // This might happen when multiple plugins have nested dependencies.\n if (this.pluginNames.includes(name)) {\n debug(`ignoring dependency '${name}', which has been required already.`)\n continue\n }\n // We follow a plugin naming convention, but let's rather enforce it <3\n name = name.startsWith('puppeteer-extra-plugin') ? name : `puppeteer-extra-plugin-${name}`\n // In case a module sub resource is requested print out the main package name\n // e.g. puppeteer-extra-plugin-stealth/evasions/console.debug => puppeteer-extra-plugin-stealth\n const packageName = name.split('/')[0]\n let dep = null\n try {\n // Try to require and instantiate the stated dependency\n dep = require(name)()\n // Register it with `puppeteer-extra` as plugin\n this.use(dep)\n } catch (err) {\n console.warn(`\n A plugin listed '${name}' as dependency,\n which is currently missing. Please install it:\n\n yarn add ${packageName}\n\n Note: You don't need to require the plugin yourself,\n unless you want to modify it's default settings.\n `)\n throw err\n }\n // Handle nested dependencies :D\n if (dep.dependencies.size) {\n this.resolvePluginDependencies()\n }\n }\n }", "async function getBrowserPage() {\n if (!browser) {\n const ignoreHTTPSErrors = process.env.IGNORE_HTTPS_ERRORS || false;\n\n browser = await puppeteer.launch({\n headless: 'new',\n executablePath: 'google-chrome-stable',\n ignoreHTTPSErrors: ignoreHTTPSErrors,\n devtools: false,\n args: [\n '--no-sandbox',\n '--disable-setuid-sandbox'\n ]\n });\n }\n\n let page = await browser.newPage();\n\n return page;\n}", "_patchPageCreationMethods(browser) {\n if (!browser || !browser._createPageInContext) {\n return;\n }\n browser._createPageInContext = (function (originalMethod, context) {\n return async function () {\n const page = await originalMethod.apply(context, arguments);\n await page.goto('about:blank');\n return page;\n };\n })(browser._createPageInContext, browser);\n }", "_patchPageCreationMethods (browser) {\n browser._createPageInContext = (function (originalMethod, context) {\n return async function (contextId) {\n const page = await originalMethod.apply(context, arguments)\n await page.goto('about:blank')\n return page\n }\n })(browser._createPageInContext, browser)\n }", "_patchPageCreationMethods(browser) {\r\n if (!browser || !browser._createPageInContext) {\r\n return;\r\n }\r\n browser._createPageInContext = (function (originalMethod, context) {\r\n return async function () {\r\n const page = await originalMethod.apply(context, arguments);\r\n await page.goto('about:blank');\r\n return page;\r\n };\r\n })(browser._createPageInContext, browser);\r\n }", "function obsBrowser(options = scullyConfig.puppeteerLaunchOptions || {}) {\n if (showBrowser) {\n options.headless = false;\n }\n options.ignoreHTTPSErrors = true;\n options.args = options.args || [];\n // options.args = ['--no-sandbox', '--disable-setuid-sandbox'];\n const { SCULLY_PUPPETEER_EXECUTABLE_PATH } = process.env;\n if (SCULLY_PUPPETEER_EXECUTABLE_PATH) {\n log(`Launching puppeteer with executablePath ${SCULLY_PUPPETEER_EXECUTABLE_PATH}`);\n options.executablePath = SCULLY_PUPPETEER_EXECUTABLE_PATH;\n options.args = [...options.args, '--disable-dev-shm-usage'];\n }\n let isLaunching = false;\n return new Observable((obs) => {\n const startPupetteer = () => {\n if (!isLaunching) {\n isLaunching = true;\n launchPuppeteerWithRetry(options).then((b) => {\n /** I will only come here when puppeteer is actually launched */\n browser = b;\n b.on('disconnected', () => reLaunch('disconnect'));\n obs.next(b);\n /** only allow a relaunch in a next cycle */\n setTimeout(() => (isLaunching = false), 1000);\n });\n // launch(options)\n // .then((b) => {\n // browser = b;\n // b.on('disconnected', () => reLaunch('disconnect'));\n // // logWarn(green('Browser successfully launched'));\n // obs.next(b);\n // setTimeout(() => (isLaunching = false), 1000);\n // /** reset fail counter on successful launch */\n // failedLaunces = 0;\n // return b;\n // })\n // .catch((e) => {\n // if (e.message.includes('Could not find browser revision')) {\n // logError(\n // `Puppeteer cannot find chromium installation. Try adding 'puppeteerLaunchOptions: {executablePath: CHROMIUM_PATH}' to your scully.*.config.ts file.`\n // );\n // } else if (++failedLaunces < 3) {\n // logError(`Puppeteer launch error`, e);\n // return launches.next();\n // }\n // captureException(e);\n // logError(`Puppeteer launch error.`, e);\n // obs.error(e);\n // process.exit(15);\n // });\n }\n };\n launches\n .pipe(\n /** ignore request while the browser is already starting, we can only launch 1 */\n filter(() => !isLaunching), \n /** the long throttleTime is to cater for the concurrently running browsers to crash and burn. */\n throttleTime(15000), \n // provide enough time for the current async operations to finish before killing the current browser instance\n delayWhen(() => merge(\n /** timout at 25 seconds */\n timer(25000), \n /** or then the number of pages hits <=1 */\n interval(500).pipe(\n /** if the browser is active get the pages promise */\n switchMap(() => (browser ? browser.pages() : of([]))), \n /** only go ahead when there is <=1 pages (the browser itself) */\n filter((p) => browser === undefined || p.length <= 1))).pipe(\n /** use take 1 to make sure we complete when one of the above fires */\n take(1), \n /** if something _really_ unwieldy happens with the browser, ignore and go ahead */\n catchError(() => of([])))))\n .subscribe({\n next: () => {\n try {\n if (browser && browser.process() != null) {\n browser.process().kill('SIGINT');\n }\n }\n catch (_a) {\n /** ignored */\n }\n startPupetteer();\n },\n });\n return () => {\n if (browser) {\n browser.close();\n browser = undefined;\n }\n };\n });\n}", "async function getBrowserPage() {\n if (!browser) {\n browser = await puppeteer.launch({\n args: [\n '--no-sandbox',\n '--disable-setuid-sandbox'\n ]\n });\n }\n\n return browser.newPage();\n}", "_patchPageCreationMethods(browser) {\r\n if (!browser._createPageInContext) {\r\n debug('warning: _patchPageCreationMethods failed (no browser._createPageInContext)');\r\n return;\r\n }\r\n browser._createPageInContext = (function (originalMethod, context) {\r\n return async function () {\r\n const page = await originalMethod.apply(context, arguments);\r\n await page.goto('about:blank');\r\n return page;\r\n };\r\n })(browser._createPageInContext, browser);\r\n }", "_launchInstance() {\n const id = this.browserCounter++;\n this.log.debug('Launching new browser', { id });\n\n const browserPromise = this.launchPuppeteerFunction();\n\n const instance = new PuppeteerInstance(id, browserPromise);\n this.activeInstances[id] = instance;\n\n // Handle the async stuff elsewhere.\n this._initBrowser(browserPromise, instance);\n\n return instance;\n }", "async attach() {\n if (!this._page) {\n Log('attaching:');\n this._page = await Pup.connect(this.description.pup);\n }\n }", "async start() {\n\n if (this.config.custom_func) {\n if (fs.existsSync(this.config.custom_func)) {\n try {\n const PluggableClass = require(this.config.custom_func);\n this.pluggable = new PluggableClass({\n config: this.config,\n context: this.context\n });\n } catch (exception) {\n console.error(exception);\n return false;\n }\n } else {\n console.error(`File \"${this.config.custom_func}\" does not exist!`);\n return false;\n }\n }\n\n const chrome_flags = _.clone(this.config.chrome_flags);\n\n if (this.pluggable && this.pluggable.start_browser) {\n launch_args.config = this.config;\n this.browser = await this.pluggable.start_browser({\n config: this.config,\n });\n this.page = await this.browser.newPage();\n } else {\n // if no custom start_browser functionality was given\n // use puppeteer-cluster for scraping\n\n let proxies;\n // if we have at least one proxy, always use CONCURRENCY_BROWSER\n // and set maxConcurrency to this.config.proxies.length + 1\n // else use whatever this.configuration was passed\n if (this.config.proxies && this.config.proxies.length > 0) {\n\n // because we use real browsers, we ran out of memory on normal laptops\n // when using more than maybe 5 or 6 browsers.\n // therefore hardcode a limit here\n // TODO not sure this what we want\n this.numClusters = Math.min(\n this.config.proxies.length + (this.config.use_proxies_only ? 0 : 1),\n MAX_ALLOWED_BROWSERS\n );\n proxies = _.clone(this.config.proxies);\n\n // Insert a first config without proxy if use_proxy_only is false\n if (this.config.use_proxies_only === false) {\n proxies.unshift(null);\n }\n\n } else {\n this.numClusters = this.config.puppeteer_cluster_config.maxConcurrency;\n proxies = _.times(this.numClusters, null);\n }\n\n this.logger.info(`Using ${this.numClusters} clusters.`);\n\n // Give the per browser options\n const perBrowserOptions = _.map(proxies, (proxy) => {\n const userAgent = (this.config.random_user_agent) ? (new UserAgent({deviceCategory: 'desktop'})).toString() : this.config.user_agent;\n let args = chrome_flags.concat([`--user-agent=${userAgent}`]);\n\n if (proxy) {\n args = args.concat([`--proxy-server=${proxy}`]);\n }\n\n return {\n headless: this.config.headless,\n ignoreHTTPSErrors: true,\n args\n };\n });\n\n debug('perBrowserOptions=%O', perBrowserOptions)\n\n this.cluster = await Cluster.launch({\n monitor: this.config.puppeteer_cluster_config.monitor,\n timeout: this.config.puppeteer_cluster_config.timeout, // max timeout set to 30 minutes\n concurrency: CustomConcurrencyImpl,\n maxConcurrency: this.numClusters,\n puppeteerOptions: {\n perBrowserOptions: perBrowserOptions\n }\n });\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Set the church that will benefit from the sharing.
function setBenefitingChurch(org, closeFancybox) { $.cookie('supporting_church', JSON.stringify(org)); currentOrganization = org; var ogImage = $('meta[property="og:image"]').attr('content'); var shareURL = location.protocol + '//' + location.host + location.pathname + '?gamify_token=' + org.gamify_token; var twitterlink = 'https://twitter.com/intent/tweet?url=' + encodeURIComponent(shareURL) + '&text=' + encodeURIComponent(gamifyShareText) + '&via=M_Digerati'; var pinterestLink = 'http://pinterest.com/pin/create/button/?url=' + encodeURIComponent(shareURL) + '&description=' + encodeURIComponent(gamifyShareText) + '&media=' + encodeURIComponent(ogImage); var linkedInLink = 'http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(shareURL) + '&title=' + encodeURIComponent('Faith & Tech Training') + '&summary=' + encodeURIComponent(gamifyShareText) + '&source=' + encodeURIComponent('Missional Digerati'); $('.twitter-share-link a').attr('href', twitterlink); $('.pinterest-share-link a').attr('href', pinterestLink); $('.linkedin-share-link a').attr('href', linkedInLink); window.history.replaceState({}, 'Sharable Link', location.pathname + '?gamify_token=' + org.gamify_token); $('p.needs_church').fadeOut('slow', function() { $('p.has_church a.church_link').text(org.name).attr('data-original-title', 'Everytime you share this web page with your friends, '+org.name+' will earn points towards new classes they can host at their church. Start sharing today!'); $('p.has_church span.total_points').html(org.game_points_earned+' <i class="icon-picons-winner"></i>'); $('p.has_church').fadeIn('slow', function() { if (closeFancybox === true) { $.fancybox.close(); } else { $("select#form_organization").val(org.id); }; }); }); }
[ "function assignChores() {\n\n makeChores();\n distributionCheck();\n displayChoreAssignments(); \n assignChoresEvents(); \n }", "function cc_js_set_share (value)\n{\n cc_js_share = value;\n cc_js_modify();\n}", "set reach(value){\n this._reach = value;\n }", "function setRandomSponsor() {\r\n // set the random other sponsor with a booth to link to\r\n var otherSponsorRefs = conSponsors.filter(function(sponsor) {\r\n return sponsor.ref != conGlobal.current.pageRef && !sponsor.noBooth;\r\n }).map(function(sponsor) {\r\n return sponsor.ref;\r\n });\r\n conGlobal.randomOtherSponsor = otherSponsorRefs[Math.floor(Math.random()*otherSponsorRefs.length)];\r\n}", "function setShareOfTicketsReissued (input) {\n share_of_tickets_reissued = input;\n }", "setCampaign(campaign) {\n dispatch(setCampaign(campaign));\n }", "forShare() {\n this._single.lock = lockMode.forShare;\n this._single.lockTables = helpers.normalizeArr.apply(null, arguments);\n return this;\n }", "_setContributions(contributions){\n \t this.contributions = contributions;\n \t this.currentContribution = this.contributions.length - 1;\n \t if(this.currentContribution > -1)\n \t \tthis._updateContent(this.contributions[this.currentContribution].content);\n }", "async setHoldOvers(holdOvers) {\n const newSrc = {};\n const tmpHoldOvers = {};\n const resolvedHoldOvers = await holdOvers;\n if (!Object.keys(resolvedHoldOvers).length) {\n this.holdOvers = newSrc;\n }\n else if (!_.has(resolvedHoldOvers, 'src')) {\n // eslint-disable-line no-lonely-if\n this.holdOvers = {...resolvedHoldOvers};\n }\n else {\n const origin = await this.getOrigin();\n\n for (let i = 0; i < Object.keys(resolvedHoldOvers.src).length; i += 1) {\n tmpHoldOvers[Object.keys(resolvedHoldOvers.src)[i]] = _.get(\n origin,\n resolvedHoldOvers.src[Object.keys(resolvedHoldOvers.src)[i]],\n ''\n );\n }\n const slSrc = {...tmpHoldOvers};\n\n this.holdOvers = _.merge(resolvedHoldOvers, slSrc);\n }\n }", "setCampaign(campaign) {\n dispatch(setCampaign(campaign));\n dispatch(campaignsRefetchRequire());\n }", "function channel(c){\nthisChannel = c;\n}", "setViaHeader(branch, transport) {\n // FIXME: Hack\n if (this.options.hackViaTcp) {\n transport = \"TCP\";\n }\n let via = \"SIP/2.0/\" + transport;\n via += \" \" + this.options.viaHost + \";branch=\" + branch;\n if (this.options.forceRport) {\n via += \";rport\";\n }\n this.setHeader(\"via\", via);\n this.branch = branch;\n }", "function changeSponsor(title, id) {\n return database.ref('sponsored/').set({\n channelTitle: title,\n channelId: id\n })\n }", "setContributionsQuery({ dispatch }, { pagination, filters, sorter }) {\n dispatch('setPagination', pagination)\n dispatch('setFilters', filters)\n dispatch('setSorter', sorter)\n dispatch('fetchContributions')\n }", "function changeAttribution() {\n var attributionHTML = $('.leaflet-control-attribution')[0].innerHTML;\n var credit = 'View <a href=\"' + googleDocURL + '\" target=\"_blank\">data</a>';\n var name = getSetting('_authorName');\n var url = getSetting('_authorURL');\n\n if (name && url) {\n if (url.indexOf('@') > 0) { url = 'mailto:' + url; }\n credit += ' by <a href=\"' + url + '\">' + name + '</a> | ';\n } else if (name) {\n credit += ' by ' + name + ' | ';\n } else {\n credit += ' | ';\n }\n\n credit += 'View <a href=\"' + getSetting('_githubRepo') + '\">code</a>';\n if (getSetting('_codeCredit')) credit += ' by ' + getSetting('_codeCredit');\n credit += ' with ';\n $('.leaflet-control-attribution')[0].innerHTML = credit + attributionHTML;\n }", "setChampion(championID) {\n myChampion = champions[championID]\n }", "function changeAttribution() {\n\t\tvar attributionHTML = $('.leaflet-control-attribution')[0].innerHTML;\n\t\tvar credit = 'Data from <a href=\"https://www.kcca.go.ug/\" target=\"_blank\">KCCA</a>, Vizualisation by <a href=\"https://www.geogecko.com/\" target=\"_blank\">GeoGecko</a>';\n\t\tvar name = getSetting('_authorName');\n\t\tvar url = getSetting('_authorURL');\n\n\t\tif (name && url) {\n\t\t\tif (url.indexOf('@') > 0) { url = 'mailto:' + url; }\n\t\t\tcredit += ' by <a href=\"' + url + '\">' + name + '</a> | ';\n\t\t} else if (name) {\n\t\t\tcredit += ' by ' + name + ' | ';\n\t\t} else {\n\t\t\tcredit += ' | ';\n\t\t}\n\n\t\t//\t\tcredit += 'View <a href=\"' + getSetting('_githubRepo') + '\">code</a>';\n\t\t//\t\tif (getSetting('_codeCredit')) credit += ' by ' + getSetting('_codeCredit');\n\t\t//\t\tcredit += ' with ';\n\t\t$('.leaflet-control-attribution')[0].innerHTML = credit + attributionHTML;\n\t}", "setGenome(mod, args) {\n\t\tthis.ready['setGenome'] = true;\n\t\tthis.genome = mod(args);\n\t}", "setRiverTurn() {\n const card = this.deck.getCard();\n this.players.forEach(player => player.addCard(card));\n this.tableHand.push(card);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
removeOverlay(false) will not restore the scollbar afterwards
removeOverlay(showScroll = true) { if (this.overlay) { Object(_util_helpers__WEBPACK_IMPORTED_MODULE_1__["addOnceEventListener"])(this.overlay.$el, 'transitionend', () => { if (!this.overlay || !this.overlay.$el || !this.overlay.$el.parentNode || this.overlay.value) return; this.overlay.$el.parentNode.removeChild(this.overlay.$el); this.overlay.$destroy(); this.overlay = null; }); this.overlay.value = false; } showScroll && this.showScroll(); }
[ "removeOverlay() {\n _store_global__WEBPACK_IMPORTED_MODULE_3__[\"dispatch\"].ui.showOverlay(false);\n const $el = OverlayService.getElement();\n $el.parentNode && $el.parentNode.removeChild($el);\n }", "removeOverlay(showScroll = true) {\n if (this.overlay) {\n addOnceEventListener(this.overlay.$el, 'transitionend', () => {\n if (!this.overlay || !this.overlay.$el || !this.overlay.$el.parentNode || this.overlay.value) return;\n this.overlay.$el.parentNode.removeChild(this.overlay.$el);\n this.overlay.$destroy();\n this.overlay = null;\n });\n this.overlay.value = false;\n }\n\n showScroll && this.showScroll();\n }", "removeOverlay(showScroll = true) {\n if (this.overlay) {\n Object(helpers[\"a\" /* addOnceEventListener */])(this.overlay.$el, 'transitionend', () => {\n if (!this.overlay || !this.overlay.$el || !this.overlay.$el.parentNode || this.overlay.value) return;\n this.overlay.$el.parentNode.removeChild(this.overlay.$el);\n this.overlay.$destroy();\n this.overlay = null;\n }); // Cancel animation frame in case\n // overlay is removed before it\n // has finished its animation\n\n cancelAnimationFrame(this.animationFrame);\n this.overlay.value = false;\n }\n\n showScroll && this.showScroll();\n }", "function disable_overlay() {\n overlay.remove();\n chrome.storage.sync.set({overlay_on: false}, function() {\n console.log('disable overlay');\n });\n document.documentElement.style.overflow = page_overflow;\n }", "removeOverlay() {\n dispatch.ui.showOverlay(false);\n const $el = OverlayService.getElement();\n $el.parentNode && $el.parentNode.removeChild($el);\n }", "function removeOverlay() {\n if (overlay == undefined || overlay.length == 0) {\n overlay = getOverlay();\n }\n overlay.remove();\n }", "function hideOverlay(e) {\n\n if (e.type === 'scroll' || e.type === 'click' && e.currentTarget === scrim) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n e.preventDefault();\n\n // Clean up event handlers.\n scrim.removeEventListener('click', hideOverlay);\n window.removeEventListener('scroll', hideOverlay);\n\n scrim.className = scrim.className.replace(/\\bvisible\\b/g, '');\n\n window.setTimeout(function () {\n body.removeChild(scrim);\n overlay_open = false;\n }, 180);\n }\n }", "function removeOverlay() {\r\n uploadingOverlay.remove();\r\n }", "removeFakeScrollBar() {\n this.scrollBar.destroy();\n }", "function hide_overlay() {\n page_overlay_element.height(0);\n page_overlay_element.width(0);\n }", "function hideOverlay(){\n overlay.hideNow()\n }", "removeScrollHandling() {}", "function removeOverlay(){\n if (typeof parkOverlay != 'undefined') {\n parkOverlay.setMap(null);\n };\n map.setOptions(enabled_map);\n}", "function hideOverlay() {\n document.getElementById(\"explaain-overlay\").style.opacity = \"0\";\n document.getElementById(\"explaain-overlay\").style.pointerEvents = \"none\";\n // document.getElementById(\"explaain-overlay\").style.visibility = \"hidden\";\n\n document.getElementsByTagName(\"body\")[0].style.overflow = \"scroll\";\n overlayShowing = false;\n }", "function delete_overlay(){\r\n\t\tdiv_overlay.remove()\r\n\t}", "function hideNativeScrollbars() {\n\t\tnativeBarSize.x = scrollingArea.offsetHeight - scrollingArea.clientHeight;\n\t\tnativeBarSize.y = scrollingArea.offsetWidth - scrollingArea.clientWidth;\n\t\tObject.assign(scrollingArea.style, {\n\t\t\tmargin: `0 -${nativeBarSize.y}px -${nativeBarSize.x}px 0`,\n\t\t\tpadding: `0 ${nativeBarSize.y}px ${nativeBarSize.x}px 0`\n\t\t});\n\t}", "function disarmWindowScroller() {\n window.removeEventListener('mousemove', updateMousePosition);\n window.removeEventListener('touchmove', updateMousePosition);\n mousePosition = undefined;\n window.clearTimeout(next$1);\n resetScrolling$1();\n }", "function removeLeftOverlay() {\n $('#original-image-overlay').style.display = 'none';\n $('#original-canvas-overlay').style.display = 'none';\n $('#original-prediction-overlay').style.display = 'none';\n}", "clearOverlay() {\n if (this.transitionTimeout) {\n clearTimeout(this.transitionTimeout);\n this.transitionTimeout = null;\n }\n\n if (this.activeAnchor) {\n this.activateAnchors(null, false);\n }\n\n EL.overlay.classList.remove(CSS.visible);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function to add a dot (".") to the number.
function addDot() { for (var i = 0; i < number.length; i++) { if(number.charAt(i) === ".") return; }; number += "."; displayF(number); }
[ "function addDots(n)\r\n{\r\n\tn += '';\r\n\tvar rgx = /(\\d+)(\\d{3})/;\r\n\twhile (rgx.test(n)) {\r\n\t\tn = n.replace(rgx, '$1' + '.' + '$2');\r\n\t}\r\n\treturn n;\r\n}", "addDot() {\n let lastOperation = this.getLastOperation();\n if (typeof lastOperation === 'string' && lastOperation.indexOf('.') > -1) return;\n\n if (this.isOperator(lastOperation) || !lastOperation) {\n this.pushOperation('0.');\n } else {\n this.setLastNumberToDisplay(lastOperation.toString() + '.');\n }\n this.setLastNumberToDisplay();\n }", "function addDecimal() {\n if (this.currentInput.length == 0) {\n //no leading \".\", use \"0.\"\n this.currentInput = \"0.\";\n }\n else {\n // First make sure one doesn't exist\n if (this.currentInput.indexOf(\".\") == -1) {\n this.currentInput = this.currentInput + \".\";\n }\n }\n this.displayCurrentInput();\n}", "function numberToDots(number) {\n return '.'.repeat(~~number);\n }", "function addDot() {\n\tconst regexp = new RegExp(/(^|[\\+\\-\\*\\/\\%])\\d+$/);\n\n\tif (regexp.test($display.textContent)) {\n\t\t$display.textContent += '.';\n\t}\n}", "appendNumber(number) {\n if (number === \".\" && this.currentOperand.includes(\".\")) return //Cannot add \".\" more than 1 time to screen\n this.currentOperand = this.currentOperand.toString() + number.toString() //convert to string to avoid JS adding numbers together.\n }", "operatorDot() {\n // Check if already decimal\n if (this.currentValueString.indexOf('.') > -1) {\n return;\n }\n // If not, add a . at the end of currentValueString\n this.currentValueString += \".\";\n this.hasInput = true;\n }", "function dot() {\n if (currentDisplay.textContent.indexOf(\".\") === -1) {\n append(\".\");\n }\n}", "function moveTheDot(number, changePosition){\n\n var stringForm=String(number);\n //save old dot position\n var oldDotPosition=stringForm.search(/\\./);\n //handle case if there is no dot, .search returns -1\n if (oldDotPosition===-1 && changePosition<0){\n oldDotPosition=stringForm.length;\n }\n //remove the dot(replace the dot with nothing)\n var withoutDot=stringForm.replace(/\\./, '');\n // combines string of number preceding new decimal position with, the decimal point, and the string of number after the new decimal position\n var withNewDot=withoutDot.substr(0, oldDotPosition+changePosition)+'.'+ withoutDot.substr(oldDotPosition+changePosition);\n return withNewDot;\n }", "function addDecimal()\n {\n if (currentInput.length == 0)\n {\n //no leading \".\", use \"0.\"\n currentInput = \"0.\";\n }\n else\n {\n // First make sure one doesn't exist\n if (currentInput.indexOf(\".\") == -1)\n {\n currentInput = currentInput + \".\";\n }\n }\n displayCurrentInput();\n }", "function addDecimal() {\n if (toClear) clearScreen();\n if (screen.textContent === \"\") screen.textContent = \"0\";\n if (screen.textContent.includes(\".\")) return;\n screen.textContent += \".\";\n}", "function addDecimal()\n {\n if (current_input.length == 0)\n {\n //no leading \".\", use \"0.\"\n current_input = \"0.\";\n }\n else\n {\n // First make sure one doesn't exist\n if (current_input.indexOf(\".\") == -1)\n {\n current_input = current_input + \".\";\n }\n }\n displayCurrentInput();\n }", "appendNum(num) {\n\t\"use strict\";\n if (this.currNumTE.innerText === \"0\") {\n this.currNum = num.toString()\n } else if (!(this.currNumTE.innerText.toString().includes(\".\") && num === \".\")) {\n this.currNum = this.currNum.toString() + num.toString()\n }\n this.disp()\n }", "function insertDot() {\n if (errorCheck.respondToErrors()) clearDisplay();\n if (contentCheck.reasonableDots(display.textContent)) {\n display.textContent += \".\";\n display.scrollTo(display.scrollWidth, 0);\n }\n}", "function addDecimal() {\n if (currentInput.length == 0) {\n //no leading \".\", use \"0.\"\n currentInput = \"0.\";\n }\n else {\n // First make sure one doesn't exist\n if (currentInput.indexOf(\".\") == -1) {\n currentInput = currentInput + \".\";\n }\n }\n displayCurrentInput();\n}", "function addTrailingZeros(num) {\n\tvar str = (Number(num.toFixed(2))).toString();\n\tvar length = str.length;\n\tvar dot = str.length;\n\tfor (i=0; i < length; i++) {\n\t\tif (str[i] == '.') {\n\t\t\tdot = i;\n\t\t}\n\t}\n\tif (dot == length) {\n\t\tstr = str.concat('.00');\n\t\tdot = length - 3;\n\t}\n\twhile (length - dot < 3) {\n\t\tstr = str.concat('0');\n\t\tdot--;\n\t}\n\treturn str;\n}", "appendDecimal(num, digits) {\n let stringNum = String(num);\n if (!stringNum.includes(\".\"))\n stringNum += \".\";\n return Number(stringNum + digits);\n }", "function addDecimal(dot){\n if(!calculator.screenValue.includes(dot)){\n // calculator.screenValue = calculator.screenValue + dot;\n calculator.screenValue += dot;\n }\n}", "function setDecimal(element) {\n\tvar textlong = element.value.length;\n\tvar text = element.value.replace(/\\./g, \"\");\n\tvar number = \"\" + text;\n\tvar longNumber = number.length;\n\tvar newNumbwe = \"\";\n\tvar cont = 0;\n\n\tfor (var i = longNumber; i >= 1; i--) {\n\t\tvar res = number.slice(i - 1, i);\n\t\tif (cont == 3) {\n\t\t\tres += \".\";\n\t\t\tcont = 0;\n\t\t}\n\t\tnewNumbwe = res + newNumbwe;\n\n\t\tcont++;\n\n\t}\n\n\telement.value = newNumbwe;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Delete DataType from FinanceCube
function deleteFinanceCubeDataType(dataTypeId) { var selectDataTypes = $scope.separate; var financeCubeDataTypes = $scope.financeCube.dataTypes; for (var i = 0; i < financeCubeDataTypes.length; i++) { if (financeCubeDataTypes[i].dataTypeId === dataTypeId) { if (isPossibleDeleteDataType(financeCubeDataTypes[i])) { if (financeCubeDataTypes[i].subType == 4 && financeCubeDataTypes[i].measureClass != null && financeCubeDataTypes[i].measureClass == 1) { removeFromRollUpRuleLines(financeCubeDataTypes[i].dataTypeId); } selectDataTypes.push(financeCubeDataTypes[i]); financeCubeDataTypes.splice(i, 1); } } } }
[ "function deleteDataType( dataType ) {\n if ( dataType ) {\n debug && console.log( \"JSONData.deleteDataType: Deleting all \" + dataType + \" objects\" );\n _.each( getObjectsByDataType( dataType ), function( objectInList ) {\n if ( objectInList.webId ) {\n deleteJSON( dataType, objectInList.webId );\n }\n });\n }\n }", "function removeDataType(type) {\n\t\t\tfor(var j=0; j<data.types.length; j++) {\n\t\t\t\tif(data.types[j].type === type) {\n\t\t\t\t\tdata.types.splice(j, 1);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}", "function deleteSelectDataType(dataTypeId) {\n var selectDataTypes = $scope.separate;\n\n for (var i = 0; i < selectDataTypes.length; i++) {\n if (selectDataTypes[i].dataTypeId === dataTypeId) {\n selectDataTypes.splice(i, 1);\n }\n }\n }", "function delete_type(type) {\n // we need to look up type info since domain/namespace id may no longer be valid\n var type_info = acre.freebase.mqlread({\n guid: type.guid,\n key: [{value: null, namespace: null, optional:true}],\n \"/type/type/domain\": {id:null, optional:true}\n }).result;\n var q = {\n guid: type.guid,\n type: {id: \"/type/type\", connect: \"delete\"}\n };\n if (type_info) {\n if (type_info.key && type_info.key.length) {\n q.key = [{value:k.value, namespace:k.namespace, connect:\"delete\"} for each (k in type_info.key)];\n }\n if (type_info[\"/type/type/domain\"]) {\n q[\"/type/type/domain\"] = {id:type_info[\"/type/type/domain\"].id, connect: \"delete\"};\n }\n }\n var deleted = acre.freebase.mqlwrite(q).result;\n deleted.domain = deleted[\"/type/type/domain\"];\n return deleted;\n}", "function deleteFinanceCube(selectedModelId, selectedFinanceCubeId, selectedFinanceCubeVisId) {\n $http.delete(url + \"/\" + selectedModelId + \"/\" + selectedFinanceCubeId).success(function(data) {\n if (data.success == false) {\n Flash.create('danger', data.message);\n } else {\n getFinanceCubesFromDatabase();\n Flash.create('success', \"Finance Cube = \" + selectedFinanceCubeVisId + \" deleted.\");\n }\n });\n }", "function deleteData() {\n\t\n}", "remove(exec = true) {\n this.dc.del(`datasets.${this.id}`)\n this.dc.ww.just('dataset-op', {\n id: this.id,\n type: 'del',\n exec: exec\n })\n delete this.dc.dss[this.id]\n }", "function deleteData() {\n // delete personal commute calc data\n LS.deleteData('commute-storage');\n // reset state, which will now use defaults\n setState();\n }", "function delete_one(entityType, input) {\r\n\r\n console.log(input.requestIdentifier + \": data_adapter.delete_one() : \" + entityType);\r\n\r\n models[entityType].findByIdAndRemove(input.documentId,\r\n function(error, returnData) {\r\n if (error) {\r\n throw \"Error: \" + JSON.stringify(error);\r\n } else {\r\n console.log(input.requestIdentifier + \": Successful delete\");\r\n // send HTTP OK\r\n // this is to convert numeric data into a string\r\n sendResponse(input, 200, \"text\", \"\" + returnData._id);\r\n }\r\n }\r\n );\r\n}", "function del() {\n\n // read existing dataset\n getDataset( data.del, existing_dataset => {\n\n // delete dataset and perform callback with deleted dataset\n collection.deleteOne( { _id: convertKey( data.del ) }, () => finish( existing_dataset ) );\n\n } );\n\n }", "function deleteRemovedType(){\n\t//Delete every single item from the removedMember list\n\tfor(i in $removedType){\n\t\tdelete $removedType[i];\n\t}\n}", "function deleteMetalType(elem){\n\telem.parent('span').remove();\n}", "function deleteDataset(input) {\n //delete front end component\n var iD = input.id;\n var parts = iD.split(\"l\");\n var idNum = Number(parts[1]);\n if (document.getElementById(\"checkdata\" + idNum)) {\n var checkbox = document.getElementById(\"checkdata\" + idNum);\n checkbox.checked = false;\n console.log(\"unchecked\");\n }\n if (document.getElementById(\"data\" + idNum)) {\n var datasetDiv = document.getElementById(\"data\" + idNum);\n datasetDiv.remove();\n //make data = null in datasets array\n datasets[idNum - 1] = undefined;\n datasetsUncer[idNum - 1] = undefined;\n rejectedData[idNum - 1] = undefined;\n }\n updateEvaluationSettings(false);\n}", "function dropRelationType () {\n\tRelationType.drop(); \n}", "function removeSimulationData(type, query) {\n var simCollectionName = type + \"_simulation\";\n var dataCollectionName = type + \"_data\";\n var simCollection = db[simCollectionName];\n var dataCollection = db[dataCollectionName];\n var c = simCollection.find(query);\n\n while (c.hasNext()) {\n var doc = c.next();\n var sim_id = doc['_id'];\n dataCollection.remove({\"simulation_id\": sim_id});\n }\n\n simCollection.remove(query);\n\n}", "function deleteType(type) {\n return new Promise((fullfill, reject) => {\n ARGS.type = type;\n client.delete(ARGS, (err, res) => {\n if(err) {\n reject(err); \n } else \n fullfill(res);\n } \n });\n }); \n}", "function deleteRecord(datain)\r\n{\r\n nlapiDeleteRecord(datain.recordtype, datain.id); // e.g recordtype=\"customer\", id=\"769\"\r\n}", "function deleteCubeEdge(x){\n\tlet cube = scene.getObjectByName( \"(\" + x + \")\");\n\tgroupSurface.remove(cube);\n}", "onUserDataRemove({ data, type }) {\n SavedDataHandler.remove(data, () => {\n this.client.send(type);\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sets push in to false on the elevio library. See:
disablePushin() { get(this, '_elevio').pushin = 'false'; }
[ "enablePushin() {\n get(this, '_elevio').pushin = 'true';\n }", "togglePush() {\n if (this.isPushEnabled) {\n this.unsubscribe()\n } else {\n this.subscribe()\n }\n }", "function handlePusher() {\n setPusher();\n }", "function togglePushPin() {\n $('.infobox .pushpin-button').toggleClass('pushed');\n displayedCode.is_pinned = $('.infobox .pushpin-button').hasClass('pushed');\n receiveMapBoundsEvent();\n}", "setMultiNotificationMode(on: boolean) {\n\t\tPushwooshModule.setMultiNotificationMode(on);\n\t}", "function turnPinOn(e) {\n\te.writeSync(0);\n}", "function pushable(build){\n\treturn !(\n\t\tbuild.block instanceof CoreBlock||\n\t\tbuild.dead||\n\t\tisBlockMoving(build)\n\t);\n}", "function toggle_pano_ui(state){\n\t\t// nothing changes, exit\n\t\tif(!!state == !!_p.pano_viewer) return;\n\t\t// remove pinch, scroll, drag, keyboard on active pano\n\t\tObject.assign(mygallery.options, {\n\t\t\tpinchToClose: !state,\n\t\t\tcloseOnScroll: !state,\n\t\t\tcloseOnVerticalDrag: !state,\n\t\t\tarrowKeys: state ? false : _p.slides.length > 1\n\t\t});\n\t}", "function setLevelFiveFalse(){\n\tblueTwo.opClick = false;\n\tgreenTwo2.opClick = false;\n\tredSeven.opClick = false;\n\tredTwo.opClick = false;\n\tredSix.opClick = false;\n\tyellowSeven.opClick = false;\n\tredFive2.opClick = false;\n}", "silentBasketOnce() {\n silent = true;\n }", "toggle() {\n this.on = !this.on;\n }", "onOffPushNotification(value) {\n if (value == false) {\n this.oneSignal.setSubscription(false);\n }\n else {\n this.oneSignal.setSubscription(true);\n }\n this.updateSetting();\n }", "function on_external_disable()\n {\n options.do_sync_data_across_devices = false;\n return local.save(Key.Configuration, options);\n }", "function Pushable() {\n this.pushable = 1;\n \n this.pushMe = function(who) {\n let retval = {};\n retval[\"fin\"] = 0;\n retval[\"input\"] = \"&gt;\";\n if (IsAdjacent(this,who,\"nodiag\")) {\n retval[\"fin\"] = 1;\n let diffx = this.getx() - who.getx();\n let diffy = this.gety() - who.gety();\n let objmap = who.getHomeMap();\n let pushto = objmap.getTile(this.getx()+diffx,this.gety()+diffy);\n if (pushto === \"OoB\") { return this.pullMe(); }\n let canmove = pushto.canMoveHere(MOVE_WALK);\n let canpush = 0;\n if (canmove[\"canmove\"]) {\n canpush = 1;\n let fea = pushto.features.getAll();\n for (let i=0;i<fea.length;i++) {\n if (fea[i].nopush) { canpush = 0; }\n }\n }\n if (canpush) {\n objmap.moveThing(this.getx()+diffx,this.gety()+diffy,this);\n retval[\"txt\"] = \"Push: \" + this.getDesc() + \".\";\n if (\"facing\" in this) {\n let graphic;\n if (diffx > 0) { this.facing = 1; graphic = this.getGraphicFromFacing(1); }\n else if (diffx < 0) { this.facing = 3; graphic = this.getGraphicFromFacing(3); }\n else if (diffy > 0) { this.facing = 2; graphic = this.getGraphicFromFacing(2); }\n else if (diffy < 0) { this.facing = 0; graphic = this.getGraphicFromFacing(0); }\n this.setGraphicArray(graphic);\n }\n if ((typeof this.getLight === \"function\") && (this.getLight() !== 0)) {\n if (PC.getHomeMap() === objmap) {\n DrawMainFrame(\"draw\",objmap,PC.getx(),PC.gety());\n }\n } else {\n if ((PC.getHomeMap() === objmap) && (GetDistance(PC.getx(),PC.gety(),this.getx(),this.gety(),\"square\") <= 6)) {\n DrawMainFrame(\"one\",objmap,this.getx(),this.gety());\n DrawMainFrame(\"one\",objmap,this.getx()-diffx,this.gety()-diffy);\n }\n }\n } else {\n retval = this.pullMe(who);\n }\n } else {\n retval[\"txt\"] = \"You can't push that from here.\";\n }\n return retval;\n }\n this.pullMe = function(who) {\n let retval = {fin:1,input:\"&gt;\"};\n let objmap = this.getHomeMap();\n let diffx = this.getx()-who.getx();\n let diffy = this.gety()-who.gety();\n let movetox = who.getx();\n let movetoy = who.gety();\n if (movetox && movetoy && this.getx() && this.gety()) {\n objmap.moveThing(0,0,this);\n } else { objmap.moveThing(3,3,this); }\n let moveval = who.moveMe(diffx,diffy);\n objmap.moveThing(movetox,movetoy,this);\n retval[\"txt\"] = \"Pull: \" + this.getDesc() + \".\";\n retval[\"canmove\"] = moveval[\"canmove\"];\n if (\"facing\" in this) {\n let graphic;\n if (diffx > 0) { this.facing = 1; graphic = this.getGraphicFromFacing(1); }\n else if (diffx < 0) { this.facing = 3; graphic = this.getGraphicFromFacing(3); }\n else if (diffy > 0) { this.facing = 2; graphic = this.getGraphicFromFacing(2); }\n else if (diffy < 0) { this.facing = 0; graphic = this.getGraphicFromFacing(0); }\n this.setGraphicArray(graphic);\n }\n if (objmap === PC.getHomeMap()) { DrawMainFrame(\"one\",objmap,movetox,movetoy); }\n\n if ((typeof this.getLight === \"function\") && (this.getLight() !== 0)) {\n if (PC.getHomeMap() === objmap) {\n DrawMainFrame(\"draw\",objmap,PC.getx(),PC.gety());\n }\n } else {\n if ((PC.getHomeMap() === objmap) && (GetDistance(PC,this,\"square\") <= 6)) {\n DrawMainFrame(\"one\",objmap,this.getx(),this.gety());\n DrawMainFrame(\"one\",objmap,this.getx()-diffx,this.gety()-diffy);\n }\n }\n \n return retval;\n }\n}", "function isPushNotifyDisabled() {\n // Return the value of the master push rule as a default\n const processor = new PushProcessor(MatrixClientPeg.get());\n const masterRule = processor.getPushRuleById(\".m.rule.master\");\n\n if (!masterRule) {\n console.warn(\"No master push rule! Notifications are disabled for this user.\");\n return true;\n }\n\n // If the rule is enabled then check it does not notify on everything\n return masterRule.enabled && !masterRule.actions.includes(\"notify\");\n}", "rsvpFalse() {\n this.rsvp(false);\n }", "function setEmoticonsEnabled( state ) {\n\twindow.debug.log('Linkinus.setEmoticonsEnabled', state);\n\tPhonograph.fire(document, \"style:setting\", {key:'Emoticons', value:state});\n}", "function setInaktiv_LogExt() {\r\n\tFLG_LogMousemove_LogExt = false;\r\n}", "function strictOnOff() {\t\r\n\tevents.emit(\"StrictOnOff\", strictLightButton);\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find the venue expense
function findVenue(expense) { return expense.type === 'Venue'; }
[ "function getExpenseList(){\n\t\treturn Expenses.index()\n\t}", "static expense() {\r\n return {\r\n total: 0,\r\n list: [],\r\n length: 0\r\n }\r\n }", "getExpenses () {\n\t\treturn this.expenses;\n\t}", "function getExpenses(evt){\n\tlet choice = this.value;\n\tlet earnings = Number($(\"#earnings-self-emp\").val());\n\n\tlet expenses = calcExpenses(choice, earnings);\n\t\n\t$(\"#expense-input\").removeClass(\"hidden\");\n\t$(\"#expense-input\").val(expenses);\n}", "public function evade()\n\t{\n\t\tif(Random.Range(0.0, 100.0) <= getEvasionRate())\n\t\t{\n\t\t\treturn -1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn getDefense();\n\t\t}\n\t}", "getExpenses() {\n return fetch(this.baseUrl).then(res => res.json())\n }", "findInvestment(projectId) {\n if(!(projectId in this.investments))\n return null;\n\n return this.investments[projectId];\n }", "function getIncentives() {\n $scope.incentiveList = [];\n $scope.env.currentIncentive = null;\n\n // BeniComp Select\n if ($scope.env.currentClient.products.beniCompSelect) {\n // employers.getBenefitYearBcs($scope.env.currentClient.id).then(function(response) {\n // $scope.incentiveList = response;\n // if ($scope.incentiveList.length > 0) {\n // $scope.env.currentIncentive = $scope.incentiveList[0];\n // }\n // });\n } else {\n // BeniComp Advantage\n }\n\n return employers.getEmployerWithIncentive({\n id: $scope.env.currentClient.id\n }, false).then(function (response) {\n $scope.incentiveList = response.incentives;\n if ($scope.incentiveList.length > 0) {\n $scope.env.currentIncentive = $scope.incentiveList[0];\n }\n });\n }", "fetchOne(_id) {\n return new Promise((resolve, reject) => {\n this.database.findOne(\n {\n _id\n },\n (error, result) => {\n if (error) {\n console.log(\"[-] Error: failed to fetch expense by id\");\n reject(error);\n }\n\n resolve(result);\n }\n );\n });\n }", "function Expense(id,desc,value) {\n this.id = id;\n this.desc = desc;\n this.value = value;\n }", "function getExpenseById() {\n vm.primaryToolbarContext = false;\n vm.currentThread = \"ssss\";\n\n var client = $serviceCall.setClient(\"getExpenseByKey\", \"expense\"); // method name and service\n client.ifSuccess(function(data) { //success\n console.log(data);\n if (data)\n vm.expenseForUniquekey = data\n \n if (vm.expenseForUniquekey.status == 'Unpaid') { //check the status and deside the menu option active or inactive\n vm.markAs = \"Mark as Paid\";\n } else if (vm.expenseForUniquekey.status == 'Paid') {\n vm.markAs = \"Mark as Unpaid\";\n }\n else if (vm.expenseForUniquekey.status == 'Cancelled'){\n vm.markAs = \"Mark as Paid\";\n }\n extractImage();\n vm.spinnerService.hide('exp-details-spinner');\n })\n client.ifError(function(data) { //false\n vm.spinnerService.hide('exp-details-spinner');\n console.log(\"error get expense by id\");\n })\n client.uniqueID($state.params.itemId); // send projectID as url parameters\n client.getReq();\n }", "function calculateExpense() {\n vm.expenseSum += vm.expense.amt;\n vm.expenseList.push({\n \"des\": vm.expense.des,\n \"amt\": vm.expense.amt\n });\n\n checkRent();\n calculateDiff();\n resetExpense();\n }", "getVenueHours({ venue_id }) {\n const urlString =\n this.apiUrl +\n this.apiFeature +\n \"/\" +\n venue_id +\n \"/hours?\" +\n querystring.stringify(this.credentials);\n return request(urlString);\n }", "function calcTotalExpense() {\r\n //TOTAL COST OF PERSONNEL & NON PERSONNEL\r\n\r\n totalPersonnel = personnelSubtotal + nonpersonnelSubtotal;\r\n\r\n //reserve fund\r\n reserveFundPercentage = 0.05;\r\n reserveFund = reserveFundPercentage * totalPersonnel;\r\n\r\n //Total expense\r\n totalExpense = totalPersonnel + reserveFund;\r\n}", "async index ({ response}) {\n var date=new Date(Date.now())\n date.setDate(date.getDate())\n date.setHours(-1,-1,-1,-1)\n const expenses=await Expense\n .query()\n .orderBy('service_delivery')\n .having('updated_at','>', date)\n .fetch()\n for (let i in expenses.rows) {\n const expense = expenses.rows[i]\n expense.expense_type=await expense.expenseType().fetch()\n }\n return response.status(201).json(expenses)\n }", "addExpense(expense) {}", "function getAndDisplayExpenses() {\n\tdisplayGasExpenses();\n\tdisplayGroceryExpenses();\n\tdisplayRestaurantExpenses();\n\tdisplayEntertainmentExpenses();\n\tdisplayMedicalExpenses();\n\tdisplayMiscExpenses();\t\n}", "async function getEmpireProduction(req, res) {\n const currentGameId = Session.getCurrentGameId(req);\n if (!currentGameId) {\n return res.status(401).send('no active game');\n }\n const player = await Player.getActivePlayer(currentGameId);\n const cities = await City.find({player});\n\n const empireProduction = {\n culture: {income: 0, storage: player.storage.culture},\n gold: {income: 0, storage: player.storage.gold},\n science: {income: 0, storage: player.storage.science},\n };\n\n for (let i in cities) {\n const cityProduction = await cities[i].getTotalProduction();\n empireProduction.culture.income += cityProduction.culture;\n empireProduction.gold.income += cityProduction.gold;\n empireProduction.science.income += cityProduction.science;\n }\n\n res.send(empireProduction);\n}", "function Offense() {\n\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to Load all Contacts Records.
function loadRecords() { var promiseGetContacts = SinglePageCRUDService.getContacts(); promiseGetContacts.then(function (pl) { $scope.Contacts = pl.data }, function (errorPl) { $scope.error = 'failure loading Contact', errorPl; }); }
[ "function loadContacts() {\n fetch(\"api/contact\")\n .then((r) => {\n r.json().then((json) => {\n const tbody = document.querySelector(\"tbody\");\n // Clear the table\n while (tbody.firstChild) {\n tbody.removeChild(tbody.firstChild);\n }\n\n // Create a new entry for each contact\n for (let x in json) {\n const contact = json[x];\n const tr = tbody.insertRow();\n createContactRow(contact, tr);\n }\n sortTable(tbody);\n });\n });\n }", "function loadContacts() {\n\n\t\t/**\n\t\t * retrievePersonalAddressBook(success, failure) Retrieve all entries of\n\t\t * the user's personal address book\n\t\t * \n\t\t * @params <function> success, <function> failure\n\t\t */\n\t\tKandyAPI.Phone\n\t\t\t\t.retrievePersonalAddressBook(\n\t\t\t\t\t\tfunction(results) {\n\n\t\t\t\t\t\t\t// results object is an array of address book\n\t\t\t\t\t\t\t// entries sent by Kandy\n\t\t\t\t\t\t\t// on successful address book retrieval\n\t\t\t\t\t\t\tvar addressJson = results;\n\t\t\t\t\t\t\t// alert(addressJson.length);\n\n\t\t\t\t\t\t\tif (addressJson.length > 0) {\n\n\t\t\t\t\t\t\t\tfor (var i = 0; i < addressJson.length; i++) {\n\t\t\t\t\t\t\t\t\tvar data = addressJson[i];\n\t\t\t\t\t\t\t\t\tvar $option = $('<option>');\n\n\t\t\t\t\t\t\t\t\t$option.val(data.name)\n\t\t\t\t\t\t\t\t\t\t\t.text(data.first_name);\n\t\t\t\t\t\t\t\t\t$('#chat-contacts').append($option);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\talert('Sorry, you have no contacts in your address book');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\talert('Error - something went wrong when we tried to access your address book.');\n\t\t\t\t\t\t});\n\t}", "function loadContacts() {\n\n /** retrievePersonalAddressBook(success, failure)\n Retrieve all entries of the user's personal address book\n @params <function> success, <function> failure\n */\n KandyAPI.Phone.retrievePersonalAddressBook(function(results) {\n\n // results object is an array of address book entries sent by Kandy\n // on successful address book retrieval\n if (results.length) {\n\n // Iterate through entries and append contacts to DOM\n results.forEach(function(entry) {\n var $option = $('<option>');\n\n $option.val(entry.contact_user_name).text(entry.contact_user_name);\n // CC ADDED\n //$('#chat-contacts').append($option);\n });\n } else {\n alert('Sorry, you have no contacts in your address book');\n }\n }, function () {\n alert('Error - something went wrong when we tried to access your address book.');\n });\n }", "function loadContacts(){\n\t\n\t// Cycle through the first 10 (or however many specified) contacts and add them to the page\n\tfor (i = 0; i <= currentBottomContact; i++){\n\t\tcard = createContactCard(i);\n\t\taddToPage(card);\n\t};\n\n}", "static loadContacts() {\r\n Contact.list.forEach((contact) => {\r\n let contactOBJ = new Contact(\r\n contact.name,\r\n contact.phone_number,\r\n contact.website,\r\n contact.description\r\n );\r\n contactOBJ.createContact();\r\n });\r\n }", "function getContactsList(){\n\tpopulateContacts();\n}", "function getContacts() {\n\tvar req = new RequestObject();\n\treq.addListener(\"loadend\", \"contacts\");\n\treq.send(\"get\", \"contacts\", null);\n}", "function loadContacts() {\n\tcontactArray.length = 0;\n\tloadingContact = 0;\n\tif(contactURLArray.length > loadingContact) {\n\t\tloadNextContact(contactURLArray[loadingContact]);\n\t} \n}", "function loadContacts() {\n $phonebook.empty();\n $phonebook.html('<li>Loading &hellip;</li>');\n\n //By default Method is GET\n $.ajax({\n url: host + '.json',\n success: loadSuccess\n });\n\n function loadSuccess(data) {\n //.empty() -> remove all child nodes\n $phonebook.empty();\n \n for (const key in data) {\n let entry = data[key];\n appendContact(entry, key);\n }\n };\n }", "function loadContacts() {\n// clear the previous list\n// grab the tbody element that will hold the new list of addresss\n// Make an Ajax GET call to the 'addresss' endpoint. Iterate through\n// each of the JSON objects that are returned and render them to the\n// summary table.\n $.ajax({\n url: \"address\"\n }).success(function (data, status) {\n fillAddressTable(data, status);\n });\n}", "getAgendaContacts() {\n\t\t\t\tconst store = getStore();\n\t\t\t\tmyFetch(store.baseURL, \"/agenda/\" + store.agendaName, \"GET\", null).then(data =>\n\t\t\t\t\tsetStore({ contacts: data })\n\t\t\t\t);\n\t\t\t}", "function loadContacts() {\n phonebookElement.innerHTML = '';\n phonebookElement.innerHTML = '<li>Loading &hellip;</li>';\n\n //By default Method is GET\n function success(data) { \n phonebookElement.innerHTML = '';\n\n for (const key in data) {\n let entry = data[key];\n appendContact(entry, key);\n }\n };\n\n function error(err) {\n console.log(err);\n };\n\n const url = host + '.json';\n fetch(url)\n .then((response) => response.json())\n .then((data) => success(data))\n .catch((err) => error(err));\n }", "function getContacts() {\n\t\t$.get('/api/contacts', function(data) {\n\t\t\tvar rowsToAdd = [];\n\t\t\tfor (var i = 0; i < data.dbContacts.length; i++) {\n\t\t\t\trowsToAdd.push(createContactsRow(data.dbContacts[i]));\n\t\t\t}\n\t\t\trenderContactsList(rowsToAdd);\n\t\t\tnameInput.val('');\n\t\t});\n\t}", "function loadContacts() {\n\n\t\t\t// $http.get(\"http://localhost:8081/chasqui-mock/usuarios/grupos/\"+vm.idGrupo+\"/integrantes\")\n\t\t\t// .then(doOk)\n\n\t\t\tfunction doOk(response) {\n\t\t\t\t// vm.productos=response.data;\n\t\t\t\tvm.allContacts = response.data;\n\n\t\t\t\tangular.forEach(vm.allContacts, function(integrante) {\n\t\t\t\t\tintegrante._lowername = integrante.nombre.toLowerCase();\n\t\t\t\t\tif (integrante.isEnGrupo) {\n\t\t\t\t\t\tvm.contacts.push(integrante);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\trestProxy.get(CTE_REST.integrantesGrupo(vm.idGrupo), {}, doOk);\n\n\t\t}", "function readContacts(){\n readContactsData();\n readContactsEphemeralKeys();\n}", "async function loadContacts() {\n let page = 1, itemsPerPage = 20;\n const contacts = []\n\n let res = await getContacts(page, itemsPerPage)\n let contactsFrag = res.contacts\n let totalItems = res.totalItems\n\n contacts.push(...contactsFrag)\n\n while (totalItems && page * itemsPerPage < totalItems) {\n page++\n\n let res = await getContacts(page, itemsPerPage)\n contactsFrag = res.contacts\n totalItems = res.totalItems\n\n contacts.push(...contactsFrag)\n }\n\n contacts.sort((a, b) => {\n const contact1 = a.firstName.concat(a.lastName)\n const contact2 = b.firstName.concat(b.lastName)\n\n if (contact1.toUpperCase() > contact2.toUpperCase())\n return 1\n else\n return -1\n })\n\n setContacts(contacts)\n }", "function loadContacts() {\n $.ajax({\n url: host + '.json',\n success: loadSuccess\n\n });\n }", "function loadContactsOffline() {\n localData.allDocs({\n include_docs: true,\n attachments: true\n }).then(function (result) {\n console.log(result);\n console.log(result.rows.length);\n if(result.rows.length == 0){\n loadRemoteData();\n }\n else {\n $(result.rows).each(function () {\n // : Create contacts for each record\n const savedContact = createContact(this.doc);\n // : Append contacts (li elements) to ul#contactList\n $(`#contactList`).append(savedContact);\n });\n }\n $(`button`).addClass(`btn btn-default btn-xs btn-danger delete`);\n //attach delete handler\n $(`.delete`).on(`click`, handleContactDelete);\n }).catch(function (err) {\n console.log(`error loading saved contacts`);\n console.log(err);\n });\n }", "function loadContacts() {\n // Get our JSON object from the endpoint\n $.ajax({\n url: 'contacts'\n }).success(function (data, status) {\n fillContactTable(data, status);\n });\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Creates a new function in the module's table and returns its pointer. Note that only actual WebAssembly functions, i.e. as exported by the module, are supported.
function newFunction(fn) { if (typeof fn.original === "function") fn = fn.original; var index = table.length; table.grow(1); table.set(index, fn); return index; }
[ "function addWasmFunction(func) {\r\n var table = wasmTable;\r\n var ret = table.length;\r\n table.grow(1);\r\n table.set(ret, func);\r\n return ret;\r\n}", "function addWasmFunction(func) {\n var table = Module['wasmTable'];\n var ret = table.length;\n table.grow(1);\n table.set(ret, func);\n return ret;\n}", "function __getFunction(ptr) {\n if (!table) throw Error(E_NO_EXPORT_TABLE);\n const index = new Uint32Array(memory.buffer)[ptr >>> 2];\n return table.get(index);\n }", "function newFunction(fn) {\n if (typeof fn.original === \"function\") fn = fn.original;\n var index = table.length;\n table.grow(1);\n table.set(index, fn);\n return index;\n }", "function createFunction() {\n function someFunction(){\n console.log(\"hello\")\n }\n return someFunction\n }", "function addFunctionWasm(func,sig){var table=wasmTable;// Check if the function is already in the table, to ensure each function\n// gets a unique index. First, create the map if this is the first use.\nif(!functionsInTableMap){functionsInTableMap=new WeakMap();for(var i=0;i<table.length;i++){var item=table.get(i);// Ignore null values.\nif(item){functionsInTableMap.set(item,i);}}}if(functionsInTableMap.has(func)){return functionsInTableMap.get(func);}// It's not in the table, add it now.\nvar ret;// Reuse a free index if there is one, otherwise grow.\nif(freeTableIndexes.length){ret=freeTableIndexes.pop();}else{ret=table.length;// Grow the table\ntry{table.grow(1);}catch(err){if(!(err instanceof RangeError)){throw err;}throw'Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.';}}// Set the new value.\ntry{// Attempting to call this with JS function will cause of table.set() to fail\ntable.set(ret,func);}catch(err){if(!(err instanceof TypeError)){throw err;}var wrapped=convertJsFunctionToWasm(func,sig);table.set(ret,wrapped);}functionsInTableMap.set(func,ret);return ret;}", "function createFunction() {\n return function() {\n return \"hello world\"\n }\n}", "function newFunction() {\n\tvar rsName = _RecordsetName.getValue();\n\tvar funcName = 'get' + rsName.substr(0, 1).toUpperCase() + rsName.substr(1,rsName.length-1);\n\tvar ret = dwscripts.callCommand('CreateNewCFCFunction.htm',funcName);\n\tif (ret) {\n\t _cffunction__tag.initializeUI();\n\t\t_cffunction__tag.listControl.setIndex(_cffunction__tag.listControl.getLen()-1);\n\t}\n}", "function createFunction() {\n return function(){\n console.log('hello')\n }\n}", "function createFunction() {\n return function () {\n console.log('hello')\n }\n}", "function createFunction() {\n function multiplyBy2(num){\n return num+2;\n }\n return multiplyBy2;\n}", "function getFunction(ptr) {\n return wrapFunction(table.get(ptr), setargc);\n }", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n \n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!err instanceof RangeError) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n \n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!err instanceof TypeError) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n \n return ret;\n }", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n\n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!(err instanceof RangeError)) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n\n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!(err instanceof TypeError)) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n\n return ret;\n }", "function addFunction(func,sig){return addFunctionWasm(func,sig);}", "function addFunctionWasm(func, sig) {\r\n var table = wasmTable;\r\n var ret = table.length;\r\n\r\n // Grow the table\r\n try {\r\n table.grow(1);\r\n } catch (err) {\r\n if (!err instanceof RangeError) {\r\n throw err;\r\n }\r\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\r\n }\r\n\r\n // Insert new element\r\n try {\r\n // Attempting to call this with JS function will cause of table.set() to fail\r\n table.set(ret, func);\r\n } catch (err) {\r\n if (!err instanceof TypeError) {\r\n throw err;\r\n }\r\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\r\n var wrapped = convertJsFunctionToWasm(func, sig);\r\n table.set(ret, wrapped);\r\n }\r\n\r\n return ret;\r\n}", "function addFunctionWasm(func, sig) {\r\n var table = wasmTable;\r\n var ret = table.length;\r\n\r\n // Grow the table\r\n try {\r\n table.grow(1);\r\n } catch (err) {\r\n if (!(err instanceof RangeError)) {\r\n throw err;\r\n }\r\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\r\n }\r\n\r\n // Insert new element\r\n try {\r\n // Attempting to call this with JS function will cause of table.set() to fail\r\n table.set(ret, func);\r\n } catch (err) {\r\n if (!(err instanceof TypeError)) {\r\n throw err;\r\n }\r\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\r\n var wrapped = convertJsFunctionToWasm(func, sig);\r\n table.set(ret, wrapped);\r\n }\r\n\r\n return ret;\r\n}", "function addFunctionWasm(func, sig) {\n var table = wasmTable;\n var ret = table.length;\n\n // Grow the table\n try {\n table.grow(1);\n } catch (err) {\n if (!err instanceof RangeError) {\n throw err;\n }\n throw 'Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH.';\n }\n\n // Insert new element\n try {\n // Attempting to call this with JS function will cause of table.set() to fail\n table.set(ret, func);\n } catch (err) {\n if (!err instanceof TypeError) {\n throw err;\n }\n assert(typeof sig !== 'undefined', 'Missing signature argument to addFunction');\n var wrapped = convertJsFunctionToWasm(func, sig);\n table.set(ret, wrapped);\n }\n\n return ret;\n}", "function functionPointer() {\n return {\n semantics() {\n return {\n // Handle Table definitions\n [Syntax.ImmutableDeclaration]: next => function (args) {\n const [decl, context] = args;\n\n // Short circuit since memory is a special type of declaration\n if (!context.locals && decl.type === 'Table') {\n return _extends({}, decl, {\n meta: _extends({}, decl.meta, {\n [GLOBAL_INDEX]: -1\n })\n });\n }\n\n return next(args);\n },\n [Syntax.Identifier]: next => function (args) {\n const [node, context] = args;\n const { functions, table, scopes } = context;\n\n if (scope_4(scopes, node.value) || !functions[node.value]) {\n return next(args);\n }\n\n if (table[node.value] == null) {\n table[node.value] = functions[node.value];\n }\n return _extends({}, node, {\n type: 'i32',\n meta: {\n [FUNCTION_INDEX]: functions[node.value].meta[FUNCTION_INDEX]\n },\n value: Object.keys(table).indexOf(node.value),\n Type: Syntax.FunctionPointer\n });\n },\n [Syntax.FunctionResult]: next => (args, transform) => {\n const [node, context] = args;\n const { types } = context;\n if (!types[node.type]) {\n return next(args);\n }\n\n return next([extendNode({\n type: 'i32',\n meta: { ALIAS: node.type },\n params: node.params.map(p => transform([p, context]))\n }, node), context]);\n },\n [Syntax.FunctionCall]: next => function (args, transform) {\n const [call, context] = args;\n const { scopes, types } = context;\n const ref = scope_4(scopes, call.value);\n // Nothing we need transform\n if (!ref) {\n return next(args);\n }\n\n const typedef = types[ref.type];\n const typeIndex = Object.keys(types).indexOf(ref.type);\n\n // We will short all of the other middleware so transform the parameters\n // here and append an identifier which will be used to get the table\n // value\n const params = [...call.params.slice(1), _extends({}, ref, { Type: Syntax.Identifier })].map(p => transform([p, context]));\n\n return _extends({}, call, {\n meta: _extends({}, call.meta, ref.meta, {\n [TYPE_INDEX]: typeIndex\n }),\n type: typedef != null ? typedef.type : call.type,\n params,\n Type: Syntax.IndirectFunctionCall\n });\n }\n };\n }\n };\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to loop every frame of the mainLoop. If the checks (checkbottom and checkbottombox) fail, run reset()
mainLoop() { this.y++; this.frame ++; if (this.checkBottom(this.y) && this.checkBox(this.x, this.y)){ this.render(); } else { this.y --; this.frame--; this.reset(); } }
[ "reset() {\n this.message.style.display = \"none\";\n this.board.reset();\n this.allCheckers.forEach(checker => {\n checker.removeAttribute(\"tabindex\");\n checker.style.transitionDuration = \"1.75s\";\n checker.style.top = \"100vh\" // drops checker off screen\n checker.addEventListener(\"webkitTransitionEnd\", () => {\n checker.remove(); // deletes the checker\n });\n });\n this.startGame();\n }", "function checkLoop() {\n if (obj.loopState) {\n loop();\n } else {\n noLoop();\n }\n }", "function gameReset(){\r\n\t\tlives = 3;\r\n g_ball.reset();\r\n o_ball.reset();\r\n \r\n g_paddle1.halfWidth = 50;\r\n o_paddle1.halfWidth = 50;\r\n \r\n doubleBall = false;\r\n doublePaddle = false;\r\n bigPadd = false;\r\n smallPadd = false;\r\n \r\n for (var i=0; i<columnNum; i++) {\r\n \t\tfor (var j=0; j<rowNum; j++) {\r\n bricks[i][j].clear = false;\r\n }\r\n }\r\n \r\n}", "function startChecking() {\n var dot_count = 1;\n function stepDots() {\n setResult('Checking' + new Array(++dot_count).join('.'));\n if (dot_count === 6)\n dot_count = 1; \n }\n\n stepDots();\n checking_interval = setInterval(stepDots, 800);\n }", "function resetGame() {\n // Clear the main boxes and the minimap boxes\n for(var rIndex = 0; rIndex < NUM_ROWS; rIndex++) {\n for(var cIndex = 0; cIndex < NUM_COLS; cIndex++) {\n // Clear main boxes\n boxes[rIndex][cIndex].classList.remove(xClass, oClass);\n boxes[rIndex][cIndex].textContent = \"\";\n // Clear minimap boxes\n miniboxes[rIndex][cIndex].classList.remove(xClass, oClass);\n miniboxes[rIndex][cIndex].textContent = \"\";\n }\n }\n\n // Hide end game text\n $(victoryText).hide();\n\n // Reset number of filled boxes\n boxCount = 0;\n\n // Start the game again\n gameOver = false;\n }", "mainLoop() {\n if(this.lastFrame != this.currentFrame || this.ledCommand === \"sync\") {\n\n if(this.pixelsDirty) {\n this.drawCurrentPixelIndexes();\n this.pixelsDirty = false;\n }\n if(this.matrixDirty) {\n if(this.matrix && this.config.panelType === \"rpi-rgb-led-matrix\") {\n this.matrix.update();\n }\n \n this.matrixDirty = false;\n }\n this.lastFrame = this.currentFrame;\n }\n clearTimeout(this.mainLoopTimeout);\n this.mainLoopTimeout = setTimeout(this.mainLoop.bind(this), 5);\n }", "function checkRepeatState() {\n numOfColors = Number(calculatedColors.value);\n numOfBalls = Number(calculatedBalls.value);\n if (numOfBalls > numOfColors) {\n solutionRepeatCheck.checked = true;\n solutionRepeatCheck.disabled = true;\n guessRepeatCheck.checked = true;\n guessRepeatCheck.disabled = true;\n ariaCheck(solutionRepeatCheck);\n ariaCheck(guessRepeatCheck);\n } else {\n solutionRepeatCheck.disabled = false;\n ariaCheck(solutionRepeatCheck);\n }\n\n if (!solutionRepeatCheck.checked) {\n guessRepeatCheck.disabled = false;\n ariaCheck(guessRepeatCheck);\n } else {\n guessRepeatCheck.disabled = true;\n guessRepeatCheck.checked = true;\n ariaCheck(guessRepeatCheck);\n }\n}", "function resetGame() {\n cheater = false;\n moveCounter = 0;\n resetButton.style.display = \"none\";\n easyButton.style.display = \"block\";\n normalButton.style.display = \"block\";\n hardButton.style.display = \"block\";\n testButton.style.display = \"block\";\n while (threePanels[0].firstChild) {\n threePanels[1].appendChild(threePanels[0].firstChild);\n }\n while (threePanels[2].firstChild) {\n threePanels[1].appendChild(threePanels[2].firstChild);\n }\n for (let i = 0; i < 6; i++) {\n threePanels[0].appendChild(anyBox[i]);\n anyBox[i].style.margin = \"2px 0px\";\n }\n panelContainer.style.display = \"flex\";\n winScreen.style.display = \"none\";\n moveCounter = 0;\n moveCounterBox[0].innerHTML = moveCounter;\n moveCounterBox[1].innerHTML = moveCounter;\n}", "function CheckFrame()\r\n{\r\n if (Root.currentFrame == Root.totalFrames - 1)\r\n {\r\n Root.removeEventListener(\"tick\", CheckFrame);\r\n \r\n //waits out a little more to make sure we won't see the \"jump\" of the frames \r\n setTimeout(Wait, 400);\r\n \r\n }\r\n}", "function checkLoop() {\n if (obj.loopState) {\n loop();\n } else {\n noLoop();\n }\n}", "function startAnimation() {\n timedLoop(33, function() {\n updatePlayerPaddle();\n updateBall();\n updateEnemyPaddle();\n checkPaddleCollisions();\n checkBoundaries();\n checkWinLose();\n });\n}", "check_Reset(){\n if (this.scene.reset) {\n this.state = 'START';\n this.view.stopTimer();\n this.view.resetTimer();\n this.deselectAllPieces();\n this.newTimer =true;\n this.locked = false;\n return true;\n }\n return false;\n }", "function reset() {\n if (!correct1) {\n carbonDioxideGroup.move(0, 0);\n isFilled1 = false;\n }\n if (!correct2) {\n lightEnergyGroup.move(0, 0);\n isFilled2 = false;\n }\n if (!correct3) {\n waterGroup.move(0, 0);\n isFilled3 = false;\n }\n oxygenGroup.move(0, 0);\n sugarGroup.move(0, 0);\n soilGroup.move(0, 0);\n heatEnergyGroup.move(0, 0);\n}", "function check(){\n\tif(checkBorder()){\n\t\tgameover();\n\t}\n}", "function boardStateCheck() {\n rowCheckForWin();\n colCheckForWin();\n diagCheckForWin();\n checkForDraw();\n lockBoard();\n scoreUpdate();\n}", "function resetButtonIsClicked() {\n resetColor = '#FF5533';\n testball_status = \"init\";\n placeTestBall();\n setTimeout(() => {\n resetColor = '#16C79A';\n }, 100);\n COLLISION = false;\n }", "function check()\n{\n\t//Will activate if Game[x] is the same value as Color\n\t//Used to check if click was equal to game pattern.\n\tif (Game[x] == Color)\n\t{\n\t\tconsole.log('correct'); //Writes to the console 'correct'.\n\t\tx++; //increments x.\n\t}\n\t//Activates else if the click value was incorrect from game pattern.\n\telse\n\t{\n\t\tvar Incorrect = new Audio(\"sound/Fail.mp3\"); //Creates a audio clip from sound folder named Fail.mp3 that defines Incorrect.\n\t\tIncorrect.play(); //Plays the sound.\n\t\tconsole.log('wrong'); //Writes to the console that you were 'wrong'.\n\t\tImgTorF = false; //Stops Images from changeimg().\n\t\tTorF = false; //Stops clicking from returninput().\n\t\tfailshowed() //Calls to failshowed().\n\t}\n}", "function mainFuntion(){\r\n\t//Checks if the start button has been clicked. \r\n\tif(startBtnClick === false){\r\n\t\tstartBtnClick = true;\r\n\t\tstartBtn.innerHTML = \"Restart\";\r\n\t\t//Runs this for loop for each one of the 480 square on the board. \r\n\t\tfor(var i = 1; i <= 480; i++){\r\n\t\t\t//If the squareCount reaches 30 it will add one to the RowCount and set the squareCount back to 1.\r\n\t\t\tif(squareCount === 30){\r\n\t\t\t\tlistSquareAndCreateEventListener();\r\n\t\t\t\tsquareCount = 1;\r\n\t\t\t\trowCount++;\r\n\t\t\t}\r\n\t\t\t//If the squareCount is below 30 it will continue to add to the squareCount.\r\n\t\t\telse{\r\n\t\t\t\tlistSquareAndCreateEventListener();\r\n\t\t\t\tsquareCount++;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//RandomBombPlacer generates the bombs. FindEmpty finds all the squares that are not bombs and are not touching bombs. \r\n\t\trandomBombPlacer();\r\n\t\tfindEmpty();\t\r\n\t\tdocument.getElementById(\"message\").innerHTML = \"Get To Sweep'in\";\r\n\t\ttimer();\r\n\t}\r\n\telse{\r\n\t\tstartBtnClick = false;\r\n\t\trestartGame();\r\n\t}\r\n}", "function clearLoop(temp) {\n\n console.log(\"Stopping the loop of fireworks....\");\n if(temp !== true){\n numberRockets = 0;\n console.log(\"Clearing rockets....\");\n }\n\n else {\n context.clearRect(0, 0, canvas.width, canvas.height);\n console.log(\"Clearing canvas....\");\n }\n done = true;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function for loading a stream plot in content div
function loadStreamPlot( object_id, stream_id ){ // Create plot container var streamPlot = $( '<div class="plot-container" id="plot-'+object_id+'-'+stream_id+'">'+ '</div>' ); // Load Highcharts streamPlot.highcharts({ chart: { type: 'spline' }, title: { text: 'Plot Title' }, subtitle: { text: 'Plot Subtitle' }, xAxis: { type: 'datetime', dateTimeLabelFormats: { // don't display the dummy year month: '%e. %b', year: '%b' }, title: { text: 'Date' } }, yAxis: { title: { text: 'Y-Label' } }, tooltip: { headerFormat: '<b>{series.name}</b><br>', pointFormat: '{point.x:%e. %b}: {point.y:.2f} m' }, plotOptions: { spline: { marker: { enabled: true } } } }); // Add to page $('div#content-Plots div.content-left').append( streamPlot ); // Hide plots that are not active if ( !active ) { streamPlot.hide(); }else{ reloadPlotAndExport( object_id, stream_id ); } }
[ "function showSocialStream() {\n $.get(\"views/fragments/socialstream.home.php\", function (data) {\n $(\".social-stream-widget\").html(data);\n });\n }", "function loadStreamIcon( object_id, stream_id ){\n // Add Icon\n var streamIcon = $(\n '<div class=\"col-sm-2 data-select\" '+\n 'id=\"select-'+object_id+'-'+stream_id+'\">'+\n ' <span class=\"glyphicon glyphicon-signal\"></span>'+\n ' <h4>'+object_id+'</h4>'+\n ' <span class=\"text-muted\">'+stream_id+'</span>'+\n '</div>'\n );\n $('div#dashboard-select').append( streamIcon );\n\n // Set initial selected\n if ( active ){\n streamIcon.addClass('active');\n }\n\n // Setup click function\n streamIcon.click(function(e) {\n console.log( \"Change streams and update plot\" );\n // Prevent browser from opening link\n e.preventDefault();\n // Select current element\n var $this = $(this);\n if (!$this.hasClass('active')) {\n // Remove the class 'active' from all elements\n $('.data-select.active').removeClass('active');\n // Add the class 'active' to current element\n $this.addClass('active');\n\n // Reload plot using most recent data\n var id = $this.attr('id');\n var id_array = id.split('-');\n var the_object_id = id_array[1];\n var the_stream_id = id_array[2];\n reloadPlotAndExport( the_object_id, the_stream_id );\n\n // Change which plot is shown\n $('.plot-container').hide();\n $('#plot-'+the_object_id+'-'+the_stream_id+'.plot-container').show();\n }\n });\n\n\n}", "async _streamData() {\n this.currentChart = \"DISCO WORM\";\n let xVals = [];\n let yVals = [];\n\n let self = this;\n dataService.startStreaming(5, function(x, y) {\n xVals.push(x);\n yVals.push(y);\n self.graphPoints = self._convertGraphPoints(xVals, yVals);\n self._generateTable([\"x\", \"y\"]);\n });\n }", "function show(stream, isRemote) {\n const id = isRemote ? stream.id : 'local';\n\n const container = document.createElement('div');\n container.id = id + 'Container';\n container.style.display = 'inline-flex';\n document.getElementById(isRemote ? 'remotes' : 'local').appendChild(container);\n document.getElementById(isRemote ? 'remotes' : 'local').appendChild(document.createElement('br'));\n\n const v = document.createElement('video');\n v.autoplay = true;\n v.srcObject = stream;\n v.onresize = () => v.title = 'video dimensions: ' + v.videoWidth + 'x' + v.videoHeight;\n container.appendChild(v);\n\n const bitrateCanvas = document.createElement('canvas');\n bitrateCanvas.id = id + 'BitrateCanvas';\n bitrateCanvas.title = 'Bitrate';\n container.appendChild(bitrateCanvas);\n\n const bitrateGraph = new TimelineGraphView(id + 'Container', id + 'BitrateCanvas');\n bitrateGraph.updateEndDate();\n\n bitrateSeries[id] = id === 'local' ? new Map() : new TimelineDataSeries();\n bitrateGraphs[id] = bitrateGraph;\n\n const framerateCanvas = document.createElement('canvas');\n framerateCanvas.id = id + 'FramerateCanvas';\n framerateCanvas.title = 'Framerate';\n container.appendChild(framerateCanvas);\n\n const framerateGraph = new TimelineGraphView(id + 'Container', id + 'FramerateCanvas');\n framerateGraph.updateEndDate();\n\n framerateSeries[id] = id === 'local' ? new Map() : new TimelineDataSeries();\n framerateGraphs[id] = framerateGraph;\n\n const qpCanvas = document.createElement('canvas');\n qpCanvas.id = id + 'qpCanvas';\n qpCanvas.title = 'qp';\n container.appendChild(qpCanvas);\n\n const qpGraph = new TimelineGraphView(id + 'Container', id + 'qpCanvas');\n qpGraph.updateEndDate();\n\n qpSeries[id] = id === 'local' ? new Map() : new TimelineDataSeries();\n qpGraphs[id] = qpGraph;\n\n const current = document.createElement('span');\n current.id = id + '_currentData';\n current.style['padding-left'] = '10px';\n current.innerText = 'Stream: ' + id;\n container.appendChild(current);\n}", "function addStreamToLayout(streamId){\n\tvar dataEl = document.createElement('iframe');\n\tdataEl.id = \"vid\" + streamId + \"data\";\n\tdataEl.hidden = true;\n\tdataEl.style.width = '100%';\n\tdataEl.style.top = \"-2px\";\n\tdataEl.style.left = \"-2px\";\n\n\tvar vidEl = document.createElement('video');\n\tvidEl.id = \"vid\" + streamId;\n\tvidEl.muted = true;\n\tvidEl.style.width = \"100%\";\n\n\t// get position of this stream\n\tvar pos = layout[streamId];\n\n\t// create container that can do cropping\n\tvar cropEl = document.createElement('div');\n\tcropEl.className = 'crop';\n\tcropEl.id = 'crop' + streamId;\n\tcropEl.style.top = (pos.top * 100) + \"%\";\n\tcropEl.style.left = (pos.left * 100) + \"%\";\n\tcropEl.style.width = (pos.width * 100) + \"%\";\n\tcropEl.style.height = (pos.height * 100) + \"%\";\n\n // add position identifier\n var posNumberEl = document.createElement('div');\n posNumberEl.className = 'pos-number';\n posNumberEl.textContent = (1+streamId);\n\n\t// add container to montage\n\tvar container = document.getElementById('montage');\n\tcontainer.appendChild(cropEl);\n cropEl.appendChild(posNumberEl);\n\tcropEl.appendChild(vidEl);\n\tcropEl.appendChild(dataEl);\n\n // reverse highlight\n function getSelectClip() {\n var ol = document.getElementById('vidList'+(1+streamId));\n return ol.parentElement;\n };\n cropEl.addEventListener(\"mouseenter\", function(ev){\n getSelectClip().className = 'selectClip highlight';\n });\n cropEl.addEventListener(\"mouseleave\", function(ev){\n getSelectClip().className = 'selectClip';\n });\n cropEl.addEventListener(\"click\", function(ev){\n var r = getSelectClip().getBoundingClientRect();\n window.scrollTo(r.x,r.y);\n });\n\n\treturn vidEl;\n}", "function aw_api_controller_show_streams_layout(data){\n aw_api_view_streams_layout_render(data);\n}", "function parseNetworkData( data ){\n $('div#dashboard-select').html('');\n // Setup the dashboard\n var active = true;\n // For each \"object\" in the \"network\"\n if ( data.hasOwnProperty(\"objects\") ) {\n for ( var object_id in data.objects ){\n //console.log( object_id );\n if ( data.objects.hasOwnProperty(object_id) ) {\n //console.log( data.objects[object_id] );\n // For each \"stream\" in the \"object\"\n if ( data.objects[object_id].hasOwnProperty(\"streams\") ) {\n for ( var stream_id in data.objects[object_id].streams ){\n //console.log( stream_id );\n if (data.objects[object_id].streams.hasOwnProperty(stream_id)) {\n //console.log( data.objects[object_id].streams[stream_id] );\n\n // Load a plot for this stream\n loadStreamPlot( object_id, stream_id, active );\n\n // Load an icon for this stream\n loadStreamIcon( object_id, stream_id, active );\n\n // Set the \"first\" stream as active\n if( active ){\n active = false;\n }\n }\n }\n }\n }\n }\n }\n\n\n}", "function getData() {\n sc.firstDataLoad = true;\n plotDataHttp.provider.get(sc.src)\n .success(function(data, status, headers, config) {\n if (headers(\"Content-Type\").indexOf('application/json') == 0)\n format = 'json';\n processData(data);\n })\n .error(function() {\n throw Error(\"failed to read data from \" + sc.src);\n });\n }", "function createStreamElement(stream, htmlContent) {\n if (stream.channel) {\n htmlContent += '<div class=\"stream\"><span class=\"first-row\">' + '<i class=\"fa fa-star fa-lg\" data-stream-name=' + stream.channel.display_name + '></i><a class=\"stream-title\" target=\"_blank\" href=\"' + stream.channel.url + '\">' + stream.channel.display_name + '</a> - ' + stream.viewers.toLocaleString() + '<svg class=\"svg-glyph_live\" height=\"16px\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16px\" x=\"0px\" y=\"0px\"> <path clip-rule=\"evenodd\" d=\"M11,14H5H2v-1l3-3h2L5,8V2h6v6l-2,2h2l3,3v1H11z\" fill-rule=\"evenodd\"></path> </svg></span><span>' + (stream.channel.status != null ? stream.channel.status.substring(0, 90) : '') + '</span> <div class=\"stream-logo\" style=\"background-image:url(' + stream.channel.logo + ')\">' + '</div>';\n //Race icon if race found in stream status\n if (stream.channel.status != null) {\n if (stream.channel.status.match(/terran/i)) {\n htmlContent += '<div class=\"icon terran\"></div>';\n }\n if (stream.channel.status.match(/zerg/i)) {\n htmlContent += '<div class=\"icon zerg\"></div>';\n }\n if (stream.channel.status.match(/protoss/i) || stream.channel.status.match(/(^|\\W)toss($|\\W)/i)) {\n htmlContent += '<div class=\"icon protoss\"></div>';\n }\n if (stream.channel.status.match(/random/i)) {\n htmlContent += '<div class=\"icon random\"></div>';\n }\n }\n htmlContent += '</div>';\n }\n return htmlContent\n}", "function DisplayStreamWidget() {\n this.stream;\n this.board_widget=new BoardWidget();\n // gametree will not change unless we are recording!\n // we assume it has already been loaded...\n this.gametree;\n this.current_time;\n // additional data... (atm used for \"testing\")\n this.data;\n this._action_list_future=[];\n \n}", "function createStreamElement(stream, htmlContent) {\n if (stream.channel) {\n htmlContent += '<div class=\"stream\">'\n + '<i class=\"fa fa-star fa-lg\" data-stream-name=' \n + stream.channel.display_name + '></i><a class=\"stream-title\" target=\"_blank\" href=\"' + stream.channel.url + '\">' \n + stream.channel.display_name + '</a> - ' + stream.viewers.toLocaleString() + ' viewers'\n + '<span>' + stream.channel.status.substring(0, 90) + '</span> <div class=\"stream-logo\" style=\"background-image:url(' + stream.channel.logo + ')\">'\n + '</div>';\n //Race icon if race found in stream status\n if (stream.channel.status != null) {\n if (stream.channel.status.match(/terran/i)) {\n htmlContent += '<div class=\"icon terran\"></div>';\n }\n if (stream.channel.status.match(/zerg/i)) {\n htmlContent += '<div class=\"icon zerg\"></div>';\n }\n if (stream.channel.status.match(/protoss/i)) {\n htmlContent += '<div class=\"icon protoss\"></div>';\n }\n if (stream.channel.status.match(/random/i)) {\n htmlContent += '<div class=\"icon random\"></div>';\n }\n }\n htmlContent += '</div>';\n }\n return htmlContent\n }", "function createDivs() {\n if (streamOffset === -1) return\n const mainStreamsDiv = document.querySelector('.main__streams')\n if (!mainStreamsDiv.querySelector('h1')) {\n const gameTitleH1 = document.createElement('h1')\n mainStreamsDiv.appendChild(gameTitleH1)\n }\n const afterStreams =\n `<div class=\"empty\"></div>\n <div class=\"empty\"></div>\n <div class=\"linebreaker\"></div>\n <button class=\"load__more\">Load More</button>`\n\n if (document.querySelectorAll('.empty').length > 0) {\n const removeAfterStreams = document.querySelector('.main__streams').innerHTML.replace(afterStreams, '')\n document.querySelector('.main__streams').innerHTML = removeAfterStreams\n }\n for (let i = 0; i < 20; i++) {\n streamDivNum = `stream__${streamOffset + 1}`\n const streamDiv =\n `<div class=\"stream__container ${streamDivNum}\">\n <a href=\"\" target=\"_blank\">\n <div class=\"stream__preview\">\n </div>\n <div class=\"stream__info\">\n <div class=\"stream__avatar\">\n </div>\n <div class=\"stream__title\">\n </div>\n </div>\n </a>\n </div>`\n document.querySelector('.main__streams').innerHTML += streamDiv\n streamOffset += 1\n }\n document.querySelector('.main__streams').innerHTML += afterStreams\n}", "function buildPlots() {\n function log10Transform(v) {\n return Math.log(v)/Math.log(10);\n }\n function log10InverseTransform(v) {\n return Math.pow(10,v);\n }\n function log10TickGenerator(axis) {\n if( axis.min <= 0 ) { throw 'Negative range for log scale'; }\n var res = [], c = 1, // prefactor c*10^p\n a, p = Math.floor(Math.log(axis.min)/Math.log(10)); // exponent\n\n do {\n a = c*Math.pow(10,p);\n if( a >= axis.min && a <= axis.max ) {\n if( c == 1 ) {\n res.push([a,'10<sup>'+p+'</sup>']);\n } else {\n res.push([a,'']);\n }\n }\n\n c++;\n if( c == 10 ) {\n c = 1;\n p++;\n }\n } while(a < axis.max )\n\n return res;\n }\n\n $('div.plot').each( function(i,e) {\n function onDataReceived(file) {\n $.each( ['xaxis','yaxis'], function( i, axis ) { \n if( file.aux[axis] = 'log' ) {\n file.options[axis].ticks = log10TickGenerator;\n file.options[axis].transform = log10Transform;\n file.options[axis].inverseTransform = log10InverseTransform;\n }\n } );\n $.plot($(e), file.data, file.options);\n }\n var url = $(e).data('file');\n if( url.substr(0,1) == '#' ) {\n onDataReceived( $.parseJSON( $(url).html() ) );\n } else {\n $.ajax({\n url: url,\n method: 'GET',\n dataType: 'json',\n success: onDataReceived,\n error: function(x,t,e) { $(e).html('Error:'+t).css('background-color','red'); }\n });\n }\n });\n }", "fetchStreams() {\n this.isLoadingStreams = true\n request.get(window.origin + '/api/streams', { json: true }).then(fetchedStreams => {\n fetchedStreams.streams.forEach(stream => {\n this.processStream(stream)\n })\n this.isLoadingStreams = false\n });\n }", "function loadContent () {\n\t\t$feedOverlay.removeClass(\"hidden\");\n\t\tMassIdea.loadHTML(SEL_CONTENT, URL_LOAD_FEED, function () {\n\t\t\t$feedOverlay.addClass(\"hidden\");\n\t\t\tresetTimer();\n\t\t});\n\t}", "function displayStreams() {\n document.getElementById('stream').innerHTML = '';\n for (var i = 0; i < currentStreams[currentPage - 1].length; i++) {\n document.getElementById('stream').innerHTML += currentStreams[currentPage - 1][i];\n }\n}", "function displayStreamingLinks(guidebox){var isTvShow=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;// Streaming links data -- GUIDEBOX DATA\n$(STREAMING_LINKS_CONTAINER).empty();if(!isTvShow){hide(TV_CONTAINER);$(STREAMING_LINKS_CONTAINER).removeClass('tv-sources');}else{$(STREAMING_LINKS_CONTAINER).append('<hr class=\"shadow-hr\">\\n <h3>Episode '+guidebox.episode_number+' Stream Links</h3>').addClass('tv-sources');}show(STREAMING_LINKS_CONTAINER);var movie=guidebox;// GUIDEBOX\nvar hasSource=false;if(movie.in_theaters){if(movie.other_sources.movie_theater){$(STREAMING_LINKS_CONTAINER).append('<div id=\"theater-source-container\">\\n <h3>STILL IN THEATERS</h3>\\n <h4>Grab Tickets</h4>\\n '+getTheaterSources(movie)+'\\n </div>');hasSource=true;}}var respData=guidebox;// GUIDEBOX \nvar purch_srcs=respData.purchase_web_sources;var sub_srcs=respData.subscription_web_sources;var tv_srcs=respData.tv_everywhere_web_sources;var free_srcs=respData.free_web_sources;if(purch_srcs.length){var purch_slides=getSources(purch_srcs,'purchase');var purch_slider='<label for=\"purch-links\">Buy / Rent</label>\\n <ul id=\"purch-links\" class=\"purchase-links streaming-links-slider\">\\n '+purch_slides.join('')+'\\n </ul>';$(STREAMING_LINKS_CONTAINER).append(purch_slider);hasSource=true;}if(sub_srcs.length){var sub_slides=getSources(sub_srcs,'subscription');var sub_slider='<label for=\"sub-links\">Subscription</label>\\n <ul id=\"sub-links\" class=\"subscription-links streaming-links-slider\">\\n '+sub_slides.join('')+'\\n </ul>';$(STREAMING_LINKS_CONTAINER).append(sub_slider);hasSource=true;}if(tv_srcs.length){var tv_slides=getSources(tv_srcs,'tv');var tv_slider='<label for=\"tv-links\">TV Everywhere</label>\\n <ul id=\"tv-links\" class=\"TV-links streaming-links-slider\">\\n '+tv_slides.join('')+'\\n </ul>';$(STREAMING_LINKS_CONTAINER).append(tv_slider);hasSource=true;}if(free_srcs.length){var free_slides=getSources(free_srcs,'free');var free_slider='<label for=\"free-links\">Free</label>\\n <ul id=\"free-links\" class=\"free-links streaming-links-slider\">\\n '+free_slides.join('')+'\\n </ul>';$(STREAMING_LINKS_CONTAINER).append(free_slider);hasSource=true;}if(hasSource){$(STREAMING_LINKS_CONTAINER).append('<hr class=\"shadow-hr\">');}isTvShow?initTvStreamLinksSlider():initStreamingLinksSlider();// init slick slider\n}// * * * * * * * * * * * * * * * * * * * * * * * * * ", "function streamData(sample) {\n // send sample to plot\n server.streamData(sample);\n process.stdout.write(\"Streaming sample...\\r\");\n}", "function setupMainPlot() {\n plot = $.plot($(\"#placeholder\"), \n getRecentData(), \n options \n );\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the week template node ready for injection.
static getWeekNode() { return document.querySelector('[data-template-calendar-week]') .content .cloneNode(true) .querySelector('[data-calendar-week]'); }
[ "function generateWeekNode() {\n var week_node = document.createElement('div');\n week_node.className = WEEK_CLASS;\n return week_node;\n }", "function buildWeekNode() {\n\t\t\t\tnode = document.createElement('ul');\n\t\t\t\tnode.classList.add('cm_week');\n\t\t\t\treturn node;\n\t\t\t}", "static getDayNode()\n {\n return document.querySelector('[data-template-calendar-day]')\n .content\n .cloneNode(true)\n .querySelector('[data-calendar-day]');\n }", "getTemplate() {\n const parser = new DOMParser();\n const doc = parser.parseFromString(this.view, \"text/html\");\n return doc.querySelector('template');\n }", "async function fetchEntryTemplateNode() {\n let res = await fetch('public/src/views.php?getView=entry');\n let entry_outerHtml = await res.text();\n let entryTemplateNode = createNodeFromOuterHtml(entry_outerHtml);\n return entryTemplateNode;\n}", "function getWeekNumber_() {\n return Number(Utilities.formatDate(new Date(), \"GMT\", \"w\"));\n}", "function getJSDocTemplateTag(node){return getFirstJSDocTag(node,isJSDocTemplateTag);}", "get template() {\n const templatesStore = getEnv(self).workflowTemplatesStore;\n const template = templatesStore.getTemplate(self.workflowTemplateId);\n if (!template) return undefined;\n return template.getVersion(self.workflowTemplateVer);\n }", "function week (tsk) {\n _week = tsk.week\n return '# CW ' + _week + '\\n'\n }", "get importantDatesTemplate() {\n\t\treturn this.nativeElement ? this.nativeElement.importantDatesTemplate : undefined;\n\t}", "function templateNode () {\n return{\n id: '',\n label: '',\n level: '',\n title: '',\n image: '',\n shape: 'image'\n }\n}", "get weeks() {\n\t\treturn this.nativeElement ? this.nativeElement.weeks : undefined;\n\t}", "get _columnTemplate() {\n\t\tvar template = dom(this).querySelector('template');\n\t\tlet slot = dom(this).querySelector('slot');\n\t\tif (!template && slot) {\n\t\t\tlet nodes = dom(slot).getDistributedNodes();\n\t\t\ttemplate = nodes.find(node => {\n\t\t\t\treturn node.nodeName == \"TEMPLATE\"\n\t\t\t})\n\t\t}\n\t\t\n\t\tif (!template) {\n\t\t\tswitch (this.type.toLowerCase()) {\n\t\t\t\tcase \"string\":\n\t\t\t\t\ttemplate = this.$.defaultTemplate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"boolean\":\n\t\t\t\t\ttemplate = this.$.booleanTemplate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"date\":\n\t\t\t\t\ttemplate = this.$.dateTemplate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"datetime\":\n\t\t\t\t\ttemplate = this.$.dateTimeTemplate;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"string_with_id\":\n\t\t\t\t\ttemplate = this.$.stringWithIdTemplate;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\ttemplate = this.$.defaultTemplate;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn template;\n\t}", "get template() {\n\t\t return(\"systems/mysystem/templates/sheets/thing_sheet.html\");\n\t }", "function getCurrentWeek() \n{\t\n\tif (realMode) {\n\t\t//TODO: retrieve the current week from Python\n\t}\n\telse \n\t\treturn parseInt(sim_in_progress_games[0].week);\n}", "create_element(run) {\n var element = document.importNode(this.template, true);\n element.querySelector(\".game-name\").innerText = run.game;\n element.querySelector(\".runner-name\").innerText = run.runner;\n element.querySelector(\".team-name\").innerText = run.team;\n element.querySelector(\".start-time\").innerText = run.start_time.fromNow();\n\n return element;\n }", "daysOfWeekDOM () {\n let config = this.config,\n locale = config.i18n,\n firstDay = config.firstDay || locale.firstDay\n\n let weekDays = []\n\n for (let i = 0, dow = firstDay; i < locale.shorterDays.length; i++, dow++) {\n weekDays.push(locale.shorterDays[dow % 7])\n }\n\n return `<span>${weekDays.join('</span><span>')}</span>`\n }", "_renderWeekView() {\n const startDate = timeUtils.getFirstDayOfWeek(this.state.viewDate);\n const endDate = timeUtils.addDays(startDate, 7);\n return this._renderDays(startDate, endDate);\n }", "async function createCurrentWeek() {\n\tlet tasksForWeek = [];\n\tconst defaultTasks = [...initialTasks];\n\n\tconst startWeek = DateTime.local().startOf('week');\n\tconst daysOfWeek = createDaysOfWeek();\n\n\tfor (let i = 0; i < defaultTasks.length; i++) {\n\t\tconst taskForWeek = await taskModel.create({\n\t\t\ttitle: defaultTasks[i].title,\n\t\t\treward: defaultTasks[i].reward,\n\t\t\timageUrl: defaultTasks[i].imageUrl,\n\t\t\tdays: daysOfWeek,\n\t\t});\n\n\t\ttasksForWeek.push(taskForWeek);\n\t}\n\n\tconst currentWeek = await weekModel.create({\n\t\tstartWeekDate: startWeek.toFormat('dd-MM-yyyy'),\n\t\tendWeekDate: startWeek.plus({ days: 6 }).toFormat('dd-MM-yyyy'),\n\t\tpointsGained: 0,\n\t\tpointsPlanned: 0,\n\t\ttasks: tasksForWeek,\n\t});\n\n\treturn currentWeek;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Variable hoisting actually makes this work. I thought it would have to be split into two lines. ======================================================= DG: I'd prefer to have the lists at the top context rather than buried inside a function! However, that would require creating handlers for every configuration since the definitions include a factorygenerated function. This is a convoluted solution to preventing allocation each time this module is initialized. By using factories that only run once, we can avoid allocation except during app initialization, which is equivalent to (or better than) having the lists included in the top context. =======================================================
function createHandlerList() { var config = chooseConfig(); // @FIXME/dg: If we get a third configuration, change to something more efficient than if/else if (config === 'desktop') { return { 'toggleTo:input': handlerFactory('setFocus:input'), // Toggling from step mode to input just finished 'toggleTo:step': handlerFactory('setFocus:input'), // Toggling from input to step mode just finished 'focus:postHint': handlerFactory('setFocus:step'), // A hint has just been displayed in step-by-step mode 'focus:postWrong': handlerFactory('setFocus:input'), // A wrong answer was submitted and the user is now encouraged to try again 'submit:cleanup': handlerFactory('remove:inputEntry') // This removes the keypad // 'step:scroll': null // Scrolling occurred within the step-by-step widget }; } else if (config === 'tablet') { return { // 'toggleTo:input': null, // Do nothing. Focusing the input causes an input helper (keypad) to appear, which obscures the text message // 'toggleTo:step': null, // Do nothing. Focusing the input causes an input helper (keypad) to appear, which obscures the text message // 'focus:postHint': null, // Do nothing. Focusing the step causes an input helper (keypad) to appear, which obscures the hint 'focus:postWrong': handlerFactory('loseFocus:input'), // Specifically cause the inputs to blur 'submit:cleanup': handlerFactory(['remove:inputEntry', 'loseFocus:input']), // Remove the keypad and ensure the input is blurred 'step:scroll': handlerFactory(['remove:inputEntry', 'loseFocus:input']) // Remove the keypad and ensure the input is blurred }; } fw.warning('Event router: unknown configuration'); return {}; }
[ "function globals_list() {\n\n}", "createAppsLists() {\n this.hostIds = this.getUniqueHostIds();\n\n this.hostIds.forEach((id) => {\n const appsList = new AppsList(id, this.getTopAppsByHost(id));\n this.appsLists.push(appsList);\n this.listContainer.appendChild(appsList.renderList());\n });\n\n this.listToggle.init();\n }", "function initListCreation() {\n $.getScript(riskapp.utils.getSpHostUrl() + \"/_layouts/15/SP.RequestExecutor.js\", function () {\n var activeListConfig = listConfigs[listName + \"ListConfig\"];\n riskapp.listHandling.setupList(activeListConfig, function () {\n //Success handler\n $this.siblings(\".listStateIndicator\").addClass(\"listStateAvailable\");\n updateListState();\n });\n });\n }", "init(lists, onRemove){\n for(let i = 0; i < lists.length; i++) {\n toDoLists.add(lists[i]);\n }\n toDoLists.onRemove = onRemove;\n }", "function createConfigList() {\n var hostUrl = decodeURIComponent(getQueryStringParameter(\"SPHostUrl\"));\n var currentcontext = new SP.ClientContext.get_current();\n var hostcontext = new SP.AppContextSite(currentcontext, hostUrl);\n var hostweb = hostcontext.get_web();\n\n //Set ListCreationInfomation()\n var listCreationInfo = new SP.ListCreationInformation();\n listCreationInfo.set_title('spConfig');\n listCreationInfo.set_templateType(SP.ListTemplateType.genericList);\n var newList = hostweb.get_lists().add(listCreationInfo);\n newList.set_hidden(true);\n newList.set_onQuickLaunch(false);\n newList.update();\n\n //Set column data\n var newListWithColumns = newList.get_fields().addFieldAsXml(\"<Field Type='Note' DisplayName='Value' Required='FALSE' EnforceUniqueValues='FALSE' NumLines='6' RichText='TRUE' RichTextMode='FullHtml' StaticName='Value' Name='Value'/>\", true, SP.AddFieldOptions.defaultValue);\n\n //final load/execute\n context.load(newListWithColumns);\n context.executeQueryAsync(function () {\n //spConfig list created successfully!\n findInSideNav();\n },\n function (sender, args) {\n console.error(sender);\n console.error(args);\n alert('Failed to create the spConfig list. ' + args.get_message());\n });\n }", "function createConfigList() {\n var hostUrl = decodeURIComponent(getQueryStringParameter(\"SPHostUrl\"));\n var currentcontext = new SP.ClientContext.get_current();\n var hostcontext = new SP.AppContextSite(currentcontext, hostUrl);\n var hostweb = hostcontext.get_web();\n\n //Set ListCreationInfomation()\n var listCreationInfo = new SP.ListCreationInformation();\n listCreationInfo.set_title('spConfig');\n listCreationInfo.set_templateType(SP.ListTemplateType.genericList);\n var newList = hostweb.get_lists().add(listCreationInfo);\n newList.set_hidden(true);\n newList.set_onQuickLaunch(false);\n newList.update();\n\n //Set column data\n var newListWithColumns = newList.get_fields().addFieldAsXml(\"<Field Type='Note' DisplayName='Value' Required='FALSE' EnforceUniqueValues='FALSE' NumLines='6' RichText='TRUE' RichTextMode='FullHtml' StaticName='Value' Name='Value'/>\", true, SP.AddFieldOptions.defaultValue);\n\n //final load/execute\n context.load(newListWithColumns);\n context.executeQueryAsync(function () {\n console.log('spConfig list created successfully!');\n },\n function (sender, args) {\n console.error(sender);\n console.error(args);\n alert('Failed to create the spConfig list. ' + args.get_message());\n });\n }", "function generate_app_list() {\n\n // flattened config list\n let runtime_configs = [];\n\n // step through the device configurations\n for(d in device_configs) {\n let device = device_configs[d];\n\n // for each configured app, generate a flattened runtime config\n for(let a in device.app_configs) {\n let app = device.app_configs[a];\n let cmdline = app.loader.split(\".\")[0];\n if(app.args.length > 0) cmdline = `${cmdline} ${app.args.join(\" \")}`;\n runtime_configs.push({\n usb: device.usb,\n app: app,\n cmdline: cmdline,\n })\n }\n }\n\n // add a list entry for each config\n let list = document.getElementById(\"command-list\");\n for(let c of runtime_configs) {\n \n // build the list-entry anchor, which kicks \n // off the wasm loader when clicked \n let a = document.createElement(\"a\");\n a.setAttribute(\"href\", \"#\")\n a.setAttribute(\"class\", \"cmd-list-entry\");\n a.innerHTML = c.cmdline;\n a.onclick = function(e) {\n list.classList.add(\"disabled\");\n a.classList.add(\"selected\");\n run_wasm_loader(c);\n };\n\n // build the list-entry div\n let entry = document.createElement(\"div\");\n entry.setAttribute(\"class\", \"app-config\");\n entry.appendChild(a);\n\n // add the config to the command list\n list.appendChild(entry);\n }\n\n // update the output div such that it's offset below the floating command list\n document.getElementById(\"terminal-history\").style.marginTop = `calc(${list.offsetHeight}px + 0.75em)`;\n}", "function createLevelLists() {\n return {\n listsMetadata: {},\n currentUniqueListId: -1,\n };\n}", "function setupLists() {\n extensionList = {}\n mimetypeList = {}\n\n _.each(fileGroups, function (group, groupName) {\n _.each(group, function (typeDef) {\n const extensionListTypeDef = {\n type: typeDef.type,\n preview: typeDef.preview,\n group: groupName,\n }\n addToList(extensionList, extensionListTypeDef, typeDef.ext)\n\n const typeListTypeDef = {\n ext: typeDef.ext,\n preview: typeDef.preview,\n group: groupName,\n }\n addToList(mimetypeList, typeListTypeDef, typeDef.type)\n })\n })\n}", "function InitModuleList() {\n ProcessScenariosCtrl.ePage.Masters.Module = {};\n ProcessScenariosCtrl.ePage.Masters.Module.OnModuleChange = OnModuleChange;\n\n GetModuleList();\n }", "static wrap(listImpl) {\n let l = new List()\n l.head = listImpl\n return l\n }", "visitInitializerList(ctx) {\n\t return this.visitChildren(ctx);\n\t}", "function getLists(user) {\n\tvar oneUserData = getUserData(user);\n if (!(LISTS in oneUserData)) {\n \toneUserData[LISTS] = {};\n }\n return oneUserData[LISTS];\n}//getLists", "createList() {\n const list = document.createElement('ul');\n list.classList.toggle('app-list');\n document.querySelector('.app-main__list').appendChild(list);\n document.querySelector('.app-list').addEventListener('click', this.clickListItemHandler.bind(this));\n }", "function initTokenList(chainName) {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var tokenList = require(\"elf-tokenlist/dist/\" + chainName + \".tokenlist.json\");\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n var addressesJson = require(\"elf-tokenlist/dist/\" + chainName + \".addresses.json\");\n var tokenInfos = tokenList.tokens;\n var tokenInfoByAddress = (0, lodash_keyby_1.default)(tokenInfos, \"address\");\n return { tokenList: tokenList, addressesJson: addressesJson, tokenInfoByAddress: tokenInfoByAddress };\n}", "function initializeLists() {\n var k;\n // first make a list of reserved names\n // we assume full integrity of the x3D source file\n // therefore we assume, that all given DEFs are unique\n\n // materials ++\n for ( k = 0; k < matFields.length; k++ )\n getDEFines( matFields[k] );\n // geometries ++\n for ( k = 0; k < geoFields.length; k++ )\n getDEFines( geoFields[k] );\n // mesh\n getDEFines( 'Shape' );\n // groups ++\n for ( k = 0; k < grpFields.length; k++ )\n getDEFines( grpFields[k] );\n\n // now give a name to every unnamed field node\n\n // materials ++\n for ( k = 0; k< matFields.length; k++ )\n setDefines( matFields[k] );\n // geometries ++\n for ( k = 0; k < geoFields.length; k++ )\n setDefines( geoFields[k] );\n // mesh\n setDefines( 'Shape' );\n // groups ++\n setDefinesTransform();\n setDefines( \"Group\" );\n setDefines( \"Scene\" );\n\n setDefaultMaterial() ; // set the standard for void material\n\n if( options.verbose ) console.log( \"defines listing:\" + DEFines );\n }", "function defineReplBindings(application, Repl) {\n /**\n * Load the encryption module\n */\n Repl.addMethod('loadEncryption', (repl) => {\n setupReplState(repl, 'Encryption', application.container.resolveBinding('Adonis/Core/Encryption'));\n }, {\n description: 'Load encryption provider and save reference to the \"Encryption\" variable',\n });\n /**\n * Load the hash module\n */\n Repl.addMethod('loadHash', (repl) => {\n setupReplState(repl, 'Hash', application.container.resolveBinding('Adonis/Core/Hash'));\n }, {\n description: 'Load hash provider and save reference to the \"Hash\" variable',\n });\n /**\n * Load the Env module\n */\n Repl.addMethod('loadEnv', (repl) => {\n setupReplState(repl, 'Env', application.container.resolveBinding('Adonis/Core/Env'));\n }, {\n description: 'Load env provider and save reference to the \"Env\" variable',\n });\n /**\n * Load the HTTP router\n */\n Repl.addMethod('loadRouter', (repl) => {\n setupReplState(repl, 'Route', application.container.resolveBinding('Adonis/Core/Route'));\n }, {\n description: 'Load router and save reference to the \"Route\" variable',\n });\n /**\n * Load config\n */\n Repl.addMethod('loadConfig', (repl) => {\n setupReplState(repl, 'Config', application.container.resolveBinding('Adonis/Core/Config'));\n }, {\n description: 'Load config and save reference to the \"Config\" variable',\n });\n /**\n * Load validator\n */\n Repl.addMethod('loadValidator', (repl) => {\n setupReplState(repl, 'Validator', application.container.resolveBinding('Adonis/Core/Validator'));\n }, {\n description: 'Load validator and save reference to the \"Validator\" variable',\n });\n /**\n * Create context for a dummy route\n */\n Repl.addMethod('getContext', (_, route, params) => {\n return application.container.use('Adonis/Core/HttpContext').create(route, params || {});\n }, {\n description: 'Get HTTP context for a given route',\n usage: `${Repl.colors.yellow('getContext')}${Repl.colors.gray('(route, params?)')}`,\n });\n}", "enterInitDeclaratorList(ctx) {\n\t}", "function modules(inst)\n{\n const dependencyModule = [];\n\n // Pull in static dependency modules\n dependencyModule.push({\n name: \"multiStack\",\n displayName: \"Multi-Stack Validation\",\n moduleName: \"/ti/common/multi_stack_validate\",\n hidden: true\n });\n\n dependencyModule.push({\n name: \"rfDesign\",\n displayName: \"RF Design\",\n moduleName: \"/ti/devices/radioconfig/rfdesign\",\n hidden: true\n });\n\n dependencyModule.push({\n name: \"rfModule\",\n displayName: \"RF\",\n moduleName: \"/ti/drivers/RF\",\n hidden: true\n\n });\n\n dependencyModule.push({\n name: \"powerModule\",\n displayName: \"Power\",\n moduleName: \"/ti/drivers/Power\",\n hidden: true\n\n });\n\n return(dependencyModule);\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds data labels to each of the cells in the table. This is so they can be used to create the responsive table.
function addDataLabelAttributes(tableHeadingsArray){ "use strict"; let tableBody = document.querySelector("#bodyRows"); let numberOfRows = tableBody.rows.length; for(let i=0; i<numberOfRows; i++){ let row = tableBody.rows[i]; let numberOfCells = row.cells.length; for(let j=0; j<numberOfCells; j++){ let cell = row.cells[j]; cell.setAttribute("data-label", tableHeadingsArray[j]); } } }
[ "function populateTableLabels() {\n Object.entries(currentLabeledIDs).forEach(entry => {\n populateCountTableLabels(entry[0], entry[1]);\n populateMessageTableLabels(entry[0], entry[1]);\n });\n}", "function ApexDataLabels() { }", "addColumnLabels() {\n for (let i = 0; i < this.n_days; i++) {\n let label = document.createElementNS(this.svg_spec, \"text\");\n let cur_date = this.dates[i];\n let text = document.createTextNode(this.convertDateToString(cur_date, this.output_date_format));\n label.appendChild(text);\n label.setAttribute(\n \"x\",\n `${this.HEADER_COLUMN_WIDTH +\n this.CELL_WIDTH * 0.5 +\n this.CELL_WIDTH * i}`\n );\n label.setAttribute(\"y\", `${this.HEADER_ROW_HEIGHT * 0.6}`);\n label.setAttribute(\"text-anchor\", \"middle\");\n label.classList.add(\"c-gantt__dates\");\n this.main.appendChild(label);\n }\n }", "_drawCellLabel(cells) {\n\n\t\t\tconst self = this;\n\n\t\t\tcells.each(function(d) {\n\t\t\t\tconst labelValue = self._configuration.cellLabelValue(d);\n\t\t\t\td3.select(this)\n\t\t\t\t\t.append('text')\n\t\t\t\t\t.attr('class', 'cell-label')\n\t\t\t\t\t.text(labelValue)\n\t\t\t\t\t.style('pointer-events', 'none')\n\t\t\t\t\t.attr('transform', function() {\n\t\t\t\t\t\tconst translation = `translate(${ this.getBBox().width / -2 }, ${ this.getBBox().height / 2 - 4 })`;\n\t\t\t\t\t\treturn translation;\n\t\t\t\t\t});\n\t\t\t});\n\n\t\t}", "function createLabelGrid(labelName) {\n for (var i = 0; i < 8; i++) {\n var row = $('<tr class=\"label-row\"></tr>');\n for (var j = 0; j < 8; j++) {\n var rowData = $('<td class=\"label-data\" id=\"' + labelName + 'cell' + i + j + '\"></td>').append('0');\n row.append(rowData);\n }\n $('#' + labelName + '-labels-8-by-8').append(row);\n }\n }", "rowAndColumnLabels() {\n let fontSize = this.columnWidth * 2\n for (let i = 0; i < 8; i++) {\n let { cX, cY } = this.elementCentre(4.65, i)\n this.label(`${i + 1}`, cX, cY, fontSize)\n }\n let { cX, cY } = this.elementCentre(4.25, -1)\n this.label(LightTypes.A, cX, cY - 0.4 * this.rowHeight, fontSize)\n this.label(LightTypes.B, cX, cY + 0.5 * this.rowHeight, fontSize)\n }", "function cssLabelFirstAndLastCellsInDataRow() {\n $(\"table.helm_data tr.data_R0w td:first-child\").toggleClass(\"firstCell\", true);\n $(\"table.helm_data tr.data_R0w td:last-child\").toggleClass(\"lastCell\", true);\n }", "function drawDataLabels() {\n\t var width = _chart.width() + 2 * _chart.borderWidth();\n\t var margin = _chart.borderWidth() + _chart.pixelGap();\n\t var color = _chart.labelColor();\n\t var generator = LabelGenerator().width(width).labelHeight(20).gap(2);\n\t\n\t var data = generator(_chart.expression().root());\n\t var count = data.length;\n\t var labelG = _innerG.select('g.pl-labels');\n\t var labels = labelG.selectAll('g.label').data(data);\n\t\n\t // ENTER\n\t var newLabels = labels.enter().append('svg:g').classed('label', true).on('mousedown', function (d) {\n\t _label = d;\n\t });\n\t newLabels.append('svg:rect').classed('label', true);\n\t newLabels.append('svg:text').classed('label', true);\n\t newLabels.append('svg:text').classed('count', true);\n\t newLabels.append('svg:title').text(function (d) {\n\t return (_expression.not() ? \"NOT \" : \"\") + d.label;\n\t });\n\t\n\t // ENTER + UPDATE\n\t labels.attr('transform', function (d) {\n\t return \"translate(\" + d.x + \",\" + d.y + \")\";\n\t });\n\t labels.select('rect').attr('width', function (d) {\n\t return d.dx;\n\t }).attr('height', function (d) {\n\t return d.dy;\n\t }).attr('fill', function (d, i) {\n\t return color.call(_chart, d, i);\n\t });\n\t labels.select('text.label').attr('text-anchor', function (d) {\n\t //Can use 'this.getComputedTextLength()' to check if size of label is less than surrounding box.\n\t if (count == 1) {\n\t return \"start\";\n\t } else {\n\t return \"middle\";\n\t }\n\t }).attr('x', function (d) {\n\t if (count == 1) {\n\t return margin;\n\t } else {\n\t return d.dx / 2;\n\t }\n\t }).attr('y', 15).attr('width', function (d) {\n\t return d.dx * 0.8;\n\t }).text(function (d) {\n\t return d.label;\n\t });\n\t labels.select('text.count').attr('text-anchor', \"end\").attr('x', width - margin).attr('y', 15).text(function (d) {\n\t return d.count;\n\t }).classed('hidden', function (d) {\n\t return count > 1;\n\t });\n\t labels.select('title').text(function (d) {\n\t return (_expression.not() ? \"NOT \" : \"\") + d.label;\n\t });\n\t\n\t // EXIT\n\t labels.exit().remove();\n\t }", "function drawDataLabels() {\n var width = _chart.width() + (2 * _chart.borderWidth());\n var margin = _chart.borderWidth() + _chart.pixelGap();\n var color = _chart.labelColor();\n var generator = LabelGenerator()\n .width(width)\n .labelHeight(20)\n .gap(2);\n\n var data = generator(_chart.expression().root());\n var count = data.length;\n var labelG = _innerG.select('g.pl-labels');\n var labels = labelG.selectAll('g.label')\n .data(data);\n\n // ENTER\n var newLabels = labels.enter()\n .append('svg:g')\n .classed('label', true)\n .on('mousedown', function (d) {\n _label = d;\n });\n newLabels.append('svg:rect')\n .classed('label', true);\n newLabels.append('svg:text')\n .classed('label', true);\n newLabels.append('svg:text')\n .classed('count', true);\n newLabels.append('svg:title')\n .text(function (d) {\n return (_expression.not() ? \"NOT \" : \"\") + d.label;\n });\n\n // ENTER + UPDATE\n labels\n .attr('transform', function (d) {\n return \"translate(\" + d.x + \",\" + d.y + \")\";\n });\n labels.select('rect')\n .attr('width', function (d) {\n return d.dx;\n })\n .attr('height', function (d) {\n return d.dy;\n })\n .attr('fill', function (d, i) {\n return color.call(_chart, d, i);\n });\n labels.select('text.label')\n .attr('text-anchor', function (d) {\n //Can use 'this.getComputedTextLength()' to check if size of label is less than surrounding box.\n if (count == 1) {\n return \"start\";\n } else {\n return \"middle\";\n }\n })\n .attr('x', function (d) {\n if (count == 1) {\n return margin;\n } else {\n return d.dx / 2;\n }\n })\n .attr('y', 15)\n .attr('width', function (d) {\n return d.dx * 0.8;\n })\n .text(function (d) {\n return d.label;\n });\n labels.select('text.count')\n .attr('text-anchor', \"end\")\n .attr('x', width - margin)\n .attr('y', 15)\n .text(function (d) {\n return d.count;\n })\n .classed('hidden', function (d) {\n return count > 1;\n });\n labels.select('title')\n .text(function (d) {\n return (_expression.not() ? \"NOT \" : \"\") + d.label;\n });\n\n // EXIT\n labels.exit().remove();\n }", "setLabels () {\n for (const labelID of this.data.labelIDs) {\n this.createLabel(labelID);\n }\n }", "function _listLabels(labels, labelimport = false) {\n // save the quantity of labels, in case imports are appended.\n lastlabelcount += labels.length;\n\n // Change the column heading depending on the quantity\n // of labels in the table\n if(lastlabelcount > 1) $('#table-label-col').text(lastlabelcount + ' Labels');\n else if(lastlabelcount > 0) $('#table-label-col').text(lastlabelcount + ' Label');\n else $('#table-label-col').text('Label');\n\n for(var ix = 0;ix < labels.length;ix += 1) {\n // copy the label data, break any references\n const lbldata = JSON.parse(JSON.stringify(labels[ix]));\n // needed for correct determination if a label has been edited\n if(lbldata.description === '') lbldata.description = null;\n // remove any emoji (:???:) and then replace spaces in \n // the name with an underscore\n var name = lbldata.name.replace(/\\:(.*?)\\:/g, '');\n name = name.trim().replace(/ /g, '_');\n // append the current index to the name\n var nameix = name+'-'+ix;\n\n // build the table's row element from the label data\n var row = $('<tr>');\n $(row).attr('id', nameix);\n // save the import state -\n // true = label is imported, false = label is from a repo\n $(row).attr('data-import', labelimport);\n var label_now = {\n label:lbldata,\n chksum:checksum(JSON.stringify(lbldata))\n };\n // save a read-only and an editable copy of the label \n // data within the row element\n $(row).attr('data-label_ro', JSON.stringify(label_now));\n $(row).attr('data-label_rw', JSON.stringify(label_now));\n // set the state of the action icons for this label\n $(row).attr('data-enact', '{\"edit\":true,\"del\":true,\"undo\":false}');\n // states: 1 = unmodified 2 = modified 4 = del\n // multi states: \n // 1 + 4 = unmodified and marked for deletion\n // 2 + 4 = modified and marked for deletion\n // \n // unmarking a deleted label will subtract 4 from the state\n //$(row).attr('data-state', '{\"state\":1}');\n var source = (labelimport === true ? 'import' : 'repo');\n $(row).attr('data-state', `{\"state\":1,\"source\":\"${source}\"}`);\n // build the label button cell\n var cell = $('<td>').addClass('table-cell-center');\n var label = $('<span>').attr('id', nameix+'-color').addClass('label label-default');\n// RENDER LABEL\n // create the label's text from its name and add emojis if present in \n // the label name\n var imgtag = undefined;\n if((imgtag = emojitag(lbldata.name)) === undefined) {\n $(label).text(lbldata.name);\n } else {\n // remove emoji text from the name\n var lblname = lbldata.name.replace(/\\:(.*?)\\:/g, '');\n $(label).text(lblname);\n // append each <img> tag with an emoji to the label\n while((img = imgtag.shift()) !== undefined) {\n $(label).append(img);\n }\n }\n // set the label's background color\n $(label).attr('style', 'background-color:#'+lbldata.color+';color:#'+adaptColor(lbldata.color)+';');\n $(cell).append($('<h3>').addClass('label-header').append(label));\n $(row).append(cell);\n// ^RENDER LABEL\n\n // build the label description cell\n cell = $('<td>').attr('id', nameix+'-desc').text((lbldata.description === null ? '' : lbldata.description));\n $(row).append(cell);\n // build the action icon cell\n cell = $('<td>').addClass('table-cell-center');\n var actions = $('<div>');\n var edit = $('<span>').addClass('fas fa-edit fa-lg label-edit-icon');\n var del = $('<span>').addClass('fas fa-trash fa-lg label-delete-icon');\n var undo = $('<span>').addClass('fas fa-undo fa-lg label-undo-icon icon-disabled');\n $(edit).attr('data-action','edit'); \n $(del).attr('data-action','delete');\n $(undo).attr('data-action','undo');\n $(edit).attr('id', nameix+'-'+'edit');\n $(del).attr('id', nameix+'-'+'del');\n $(undo).attr('id', nameix+'-'+'undo');\n $(edit).attr('onclick','labelAction(this.id)'); \n $(del).attr('onclick','labelAction(this.id)');\n $(undo).attr('onclick','labelAction(this.id)');\n $(actions).append(edit);\n $(actions).append(del);\n $(actions).append(undo);\n $(cell).append(actions);\n $(row).append(cell);\n // build the label state cell\n cell = $('<td>').addClass('table-cell-center');\n var states = $('<div>');\n var notmod = $('<span>');\n if(labelimport === true) {\n $(notmod).addClass('fas fa-info-circle fa-lg label-notmod-icon');\n } else {\n $(notmod).addClass('fab fa-github fa-lg label-notmod-icon');\n }\n var tomod = $('<span>').addClass('fas fa-exclamation-triangle fa-lg label-ismod-icon hidden');\n var todel = $('<span>').addClass('hidden');\n if(labelimport === true) {\n $(todel).addClass('fa-stack');\n var i1 = $('<i>').addClass('fas fa-trash fa-lg fa-stack-1x label-to-delete-icon');\n var i2 = $('<i>').addClass('fas fa-info fa-xs fa-stack-1x');\n $(todel).append(i1);\n $(todel).append(i2);\n } else {\n $(todel).addClass('fas fa-trash-alt fa-lg label-to-delete-icon');\n }\n $(notmod).attr('data-state','notmod'); \n $(tomod).attr('data-state','tomod');\n $(todel).attr('data-state','todel');\n $(notmod).attr('id', nameix+'-'+'notmod');\n $(tomod).attr('id', nameix+'-'+'tomod');\n $(todel).attr('id', nameix+'-'+'todel');\n $(states).append(notmod);\n $(states).append(tomod);\n $(states).append(todel);\n $(cell).append(states);\n $(row).append(cell);\n // all cells complete, append this row to the table\n $('#repo-labels-list-body').append(row);\n }\n// TODO : make this action selectable\n sortTable('repo-labels-list-body');\n}", "function rename_labels() {\n\t\t $('.price_rule').each(function() {\n\t\t\tvar rule_id = $(this).attr('data-id');\n\t\t\tif (rule_id < (price_rule_num - 1)) {\n\t\t\t\t$(this).find('.additional_adult').html($('#translations .t_for_adult_n').html().replace(/%d/, parseInt(rule_id)+1) + ' ('+quitenicebooking.currency_unit+')');\n\t\t\t\t$(this).find('.additional_child').html($('#translations .t_for_child_n').html().replace(/%d/, parseInt(rule_id)+1) + ' ('+quitenicebooking.currency_unit+')');\n\t\t\t} else {\n\t\t\t\t$(this).find('.additional_adult').html($('#translations .t_additional_adult').html() + ' ('+quitenicebooking.currency_unit+')');\n\t\t\t\t$(this).find('.additional_child').html($('#translations .t_additional_child').html() + ' ('+quitenicebooking.currency_unit+')');\n\t\t\t}\n\t\t });\n\t }", "function CharbaJsDataLabelsHelper() {}", "function initDrawDataLabels() {\n var numOfSamplesWithAge = $.grep(fullData, function (d) {\n return d.Age !== null;\n }).length;\n d3.selectAll(\".rows-of-dataset\").html(fullData.length);\n d3.selectAll(\".rows-of-age-data\").html(numOfSamplesWithAge);\n }", "function insertLabels(sheet) {\r\n sheet.getRange('A2').setValue('QS - Pondere Impresii');\r\n for(var i=1; i<=10; i++) {\r\n var row = i+2;\r\n sheet.getRange('A' + row).setValue(i);\r\n }\r\n sheet.getRange('A13').setValue('% 7 or more');\r\n sheet.getRange('A2:A12').setBackground('#fce5cd');\r\n sheet.getRange('A13:13').setBackground('#b7b7b7');\r\n \r\n sheet.getRange('A18').setValue('QS - Total Impresii');\r\n for(var i=1; i<=10; i++) {\r\n var row = i+18;\r\n sheet.getRange('A' + row).setValue(i);\r\n }\r\n sheet.getRange('A29').setValue('Total Impresii:');\r\n sheet.getRange('A18:A29').setBackground('#fce5cd');\r\n}", "function table_maker(datasets) {\n reset_table();\n for (var i = 0; i < datasets.length; i++) {\n $('#summary').append('<tr style=\"text-align: center\">' + data(datasets[i]) + '</tr>');\n }\n totals_row_maker(datasets);\n $('#table-div').slideDown();\n }", "function drawLabels() {\n drawDataLabels();\n updateCompositeLabels();\n }", "function updateLabels() {\n\n // time indicator\n $('#days-view').text(formatDays(gameResources.time.points));\n\n Object.keys(gameResources).forEach(resource => {\n\n // table of values\n //$('#label-'+resource+'-pts').text(gameResources[resource].points.toFixed(2));\n //$('#label-'+resource+'-inc').text(gameResources[resource].increment.toFixed(2));\n\n // costs in buttons\n if(gameResources[resource].cost != undefined){\n\n var costText = '';\n\n for (var costIndex in gameResources[resource].cost) {\n var cost = gameResources[resource].cost[costIndex];\n costText = costText + ' -' + cost.amount + ' ' + cost.resource;\n }\n\n $('#'+resource+'-cost').text(costText);\n }\n\n });\n}", "function addLabels() {\n var labelsArray = {};\n function eachLabel(title,content) {\n labelsArray[title] = content;\n };\n\n eachLabel('supporterTypes',supporterTypes);\n eachLabel('channelTypes',channelTypes);\n eachLabel('allDates',allDates);\n\n return labelsArray;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse the card and assign to to sum or aces
function parseCard(slicedCard) { if (slicedCard === "A") { person.aces++; } else if (slicedCard === "J" || slicedCard === "Q" || slicedCard === "K") { person.sum += 10; } else { person.sum += parseInt((slicedCard), 10); } }
[ "function parseCard(card) {\r\n\tvar suiteVal = {}\r\n\tvar cardId = card.id;\r\n\tvar color;\r\n\tvar cardInfo = cardId.split(\"_\");\r\n\tif (cardInfo[0] == \"diamonds\" || cardInfo[0] == \"hearts\") {\r\n\t\tcolor = 0;\r\n\t} else {\r\n\t\tcolor = 1;\r\n\t}\r\n\tvar val = parseInt(cardInfo[1]);\r\n\tsuiteVal[\"color\"] = color;\r\n\tsuiteVal[\"val\"] = val;\r\n\tsuiteVal[\"suite\"] = cardInfo[0];\r\n\treturn suiteVal;\r\n}", "function parseCard(player, number) {\n\t//checks if middle player === 0\n\tif (player === 0) {\n\t\tvar element = PID(\"middlecard\");\n\t} else {\n\t\t// gets the element\n\t\tvar element = PID(\"player\" + player + number);\n\t}\n\t// parses the elements source to get the name\n\tif (element === null) {\n\t\treturn;\n\t} else {\n\t\tvar elementname = element.src.replace('.svg', '').split(\"/Cards\")[1].replace(\"/\", '');\n\t}\n\t// checks all cases. sets the primary/secondary\n\tif (elementname.includes(\"+2\")) {\n\t\tvar elementsecondary = \"+2\";\n\t\tvar elementprimary = elementname.replace(\"+2\", \"\")\n\t} else if (elementname.includes(\"Reverse\")) {\n\t\tvar elementsecondary = \"Reverse\";\n\t\tvar elementprimary = elementname.replace(\"Reverse\", \"\")\n\t} else if (elementname.includes(\"Skip\")) {\n\t\tvar elementsecondary = \"Skip\";\n\t\tvar elementprimary = elementname.replace(\"Skip\", \"\")\n\t} else if (elementname.includes(\"Wild\")) {\n\t\tvar elementsecondary = \"None\";\n\t\tvar elementprimary = \"Wild\";\n\t} else if (elementname.includes(\"0-9\")) {\n\t\tvar elementsecondary = \"0-9\"\n\t\tvar elementprimary = elementname.replace(\"0-9\", '');\n\t} else {\n\t\tvar elementsecondary = elementname.match(/\\d+/)[0] || 0;\n\t\tvar elementprimary = elementname.replace(elementsecondary, '');\n\t}\n\t//returns the array\n\treturn [elementname, elementprimary, elementsecondary, player, number];\n}", "acceptACard(card) {\r\n this.list.unshift(card);\r\n this.announcedSuit=card.getSuit();\r\n }", "function addCard(card, person) {\n // Add the card to the person's play area if this fuction is being called in hitMe \n if (person.cards > 1) {\n $('#' + person.name).find('.card' + (person.cards)).after(\"<div class='extraCard card\" + (person.cards + 1) + \"'>X</div>\");\n $('#' + person.name).find('.card' + (person.cards +1)).html(deck[index].slice(1)).addClass(\"suit\" + (deck[index])[0]);\n }\n\n \n // Parse the card and assign to to sum or aces\n function parseCard(slicedCard) {\n\n if (slicedCard === \"A\") {\n person.aces++;\n } else if (slicedCard === \"J\" || slicedCard === \"Q\" || slicedCard === \"K\") {\n person.sum += 10;\n } else { person.sum += parseInt((slicedCard), 10); }\n }\n\n // Parse the value of the card to a number or an Ace.\n parseCard(card.slice(1));\n\n // Increase the card count of that person\n person.cards++;\n\n // Once the card has been added, the index is increased\n index++;\n}", "function card2Points(card) {\n //if a number card, return the number value\n if (!isNaN(Number(card))) {\n return Number(card);\n }\n //if ace return ACE, this will be handled in the calculate score\n else if (card === \"ACE\") {\n return \"ACE\";\n }\n //if a face card, return 10\n else {\n return 10;\n }\n }", "function parseCard(player,number){\n\t//checks if middle player === 0\n\tif(player === 0){\n\t\tvar element= document.getElementById(\"middlecard\");\n\t}else{\n\t\t// gets the element\n\tvar element=document.getElementById(\"player\"+player+number);}\n\t\t// parses the elements source to get the name\n\tif(element===null){return;}else{\n\tvar elementname = element.src.replace('.svg','').split(\"/Cards\")[1].replace(\"/\",'');}\n\t// checks all cases. sets the primary/secondary\n\tif(elementname.includes(\"+2\")){\n\t\tvar elementsecondary = \"+2\";\n\t\tvar elementprimary = elementname.replace(\"+2\",\"\")\n\t}else if(elementname.includes(\"Reverse\")){\n\t\tvar elementsecondary = \"Reverse\";\n\t\tvar elementprimary = elementname.replace(\"Reverse\",\"\")\n\t}else if(elementname.includes(\"Skip\")){\n\t\tvar elementsecondary = \"Skip\";\n\t\tvar elementprimary = elementname.replace(\"Skip\",\"\")\n\t}else if(elementname.includes(\"Wild\")){\n\t\tvar elementsecondary = \"None\";\n\t\tvar elementprimary = \"Wild\";\n\t}else if(elementname.includes(\"0-9\")){\n\t\tvar elementsecondary = \"0-9\"\n\t\tvar elementprimary = elementname.replace(\"0-9\",'');\n\t}\n\telse{\n\t\tvar elementsecondary = elementname.match(/\\d+/)[0] || 0;\n\t\tvar elementprimary = elementname.replace(elementsecondary,'');\n\t}\n\t//returns the array\n\treturn [elementname,elementprimary,elementsecondary,player,number];\n}", "getCreditcardData(cd) {\n const cardType = cd.type;\n return {\n exp_date: cd.expiryDate,\n cardType: cardType.charAt(0).toUpperCase() + cardType.slice(1),\n lastFourCCDigit: this.getLastFourCCDDigits(cd.token),\n token: cd.token,\n cardHolderFirstName: cd.cardholderFirstName,\n cardHolderLastName: cd.cardholderLastName\n };\n }", "function addDealerCards() {\n //get the dealer's first card\n var firstCard = document.getElementById('dealer-card1').innerHTML;\n //if the card is a royal card or an Ace, convert to corresponding integer\n if (firstCard === 'J' || firstCard === 'Q' || firstCard === 'K') {\n firstCard = 10;\n } else if (firstCard === 'A') {\n firstCard = 11;\n }\n //get dealer's second card\n var secondCard = document.getElementById('dealer-card2').innerHTML;\n //if the card is a royal or an ace, convert to corresponding integer\n if (secondCard === 'J' || secondCard === 'Q' || secondCard === 'K') {\n secondCard = 10;\n } else if (secondCard === 'A') {\n secondCard = 11;\n }\n //convert cards from string to int, then add together to get dealer's score\n var cardOneInt = parseInt(firstCard);\n var cardTwoInt = parseInt(secondCard);\n var cardSum = (cardOneInt + cardTwoInt)\n return cardSum;\n }", "function calculate(card) {\nvar value; // numerical value of card\n\tif (card <= 4) { // ace\n\t\tvalue = 11;\n\t\treturn value; \n\t}\n\tif (card <= 20) { // face card or 10\n\t\tvalue = 10;\n\t\treturn value;\n\t}\n\tif (card <= 24) { // 9, and so forth\n\t\tvalue = 9;\n\t\treturn value;\n\t} \n\tif (card <= 28) {\n\t\tvalue = 8;\n\t\treturn value;\n\t} \n\tif (card <= 32) {\n\t\tvalue = 7;\n\t\treturn value;\n\t} \n\tif (card <= 36) {\n\t\tvalue = 6;\n\t\treturn value;\n\t} \n\tif (card <= 40) {\n\t\tvalue = 5;\n\t\treturn value;\n\t} \n\tif (card <= 44) {\n\t\tvalue = 4;\n\t\treturn value;\n\t} \n\tif (card <= 48) {\n\t\tvalue = 3;\n\t\treturn value;\n\t} \n\tvalue = 2; // only 2 left\n\treturn value; \n}", "function parseBillingCard(elem) {\n // var below is commented out because internal change and how have to update the addUICardsToCardStore function\n //var billingCardTitle = $(elem).find('h2').text().trim();\n var billingCardTitle = 'Monthly Staff Plan';\n\n\n if (billingCardTitle === 'Monthly Staff Plan') {\n var yesMonthlyStaffPlan = $(\"<div class='ui-stack-item'><h6>Monthly Staff Plan</h6><p>Yes</p></div>\")\n decisionTreeList.push(yesMonthlyStaffPlan);\n var monthlyStaffCard = $(\"<div class='ui-card__section'>You have a staff account!</div>\")\n createCardInInternal(monthlyStaffCard)\n } else {\n var noMonthlyStaffPlan = $(\"<div class='ui-stack-item'><h6>Monthly Staff Plan</h6><p>No</p></div>\")\n // do next function\n }\n }", "function setAceValue(aCard, cardsSum) {\n let cardValue;\n if (aCard == 'ace' && cardsSum > 21) {\n cardValue = 1;\n }\n else if (aCard == 'ace' && cardsSum <= 10) {\n cardValue = 11;\n }\n else {\n cardValue = aCard;\n }\n return cardValue;\n}", "credit(){\n \n let name = this.data.shift();\n let creditAmount = this.data.shift();\n let account = this.store[name];\n\n // making sure account and the account cardNumber is valid\n if(account && account.cardNumber){\n account.balance = account.balance - remove$(creditAmount);\n }\n }", "function calculateValue(card) {\n if (card[1] == 'A') {\n var value = 11;\n if (dealersTurn === false) {\n playerAces += 1;\n }\n if (dealersTurn === true) {\n dealerAces += 1;\n }\n } else if (card[1] == 'K') {\n var value = 10;\n } else if (card[1] == 'Q') {\n var value = 10;\n } else if (card[1] == 'J') {\n var value = 10;\n } else {\n var value = card[1];\n }\n if (dealersTurn === false) {\n countTotal += value;\n } else if (dealersTurn) {\n dealerCountTotal += value;\n }\n\n //REMOVE 10 FROM COUNT FOR EACH ACE IF OVER 21\n if (dealersTurn === false) {\n for (var i = 0; i < playerAces; i += 1) {\n if (countTotal > 21) {\n countTotal -= 10;\n playerAces -= 1;\n }\n }\n } else if (dealersTurn) {\n for (var i = 0; i < dealerAces; i += 1) {\n if (dealerCountTotal > 21) {\n dealerCountTotal -= 10;\n dealerAces -= 1;\n }\n }\n\n }\n\n bust();\n\n }", "function parseCard(form) {\n let card = {};\n card.notes = form.notes;\n delete form.notes;\n card.deactivate = form.deactivate == \"on\";\n delete form.deactivate;\n card.contacts = {};\n let contacts = card.contacts;\n Object.keys(form).forEach(function(key) {\n let parts = key.split('-');\n let truekey = parts[0];\n let subkey = parts[1];\n let value = form[key];\n if (!contacts[truekey]) {\n contacts[truekey] = {};\n }\n contacts[truekey][subkey] = value;\n });\n return card;\n}", "function addPlayersCards() {\n //get player's first card\n var firstCard = document.getElementById('card1').innerHTML;\n //check to see if it's a royal or an Ace and assign it its corresponding number\n if (firstCard === 'J' || firstCard === 'Q' || firstCard === 'K') {\n firstCard = 10;\n } else if (firstCard === 'A') {\n firstCard = 11;\n }\n //get player's second card\n var secondCard = document.getElementById('card2').innerHTML;\n //if it's a royal or an Ace assign it to its corresponding number\n if (secondCard === 'J' || secondCard === 'Q' || secondCard === 'K') {\n secondCard = 10;\n } else if (secondCard === 'A') {\n secondCard = 11;\n }\n //get player's third card\n var thirdCard = document.getElementById('card3').innerHTML;\n //if it's a royal or an Ace, assign it to its corresponding number\n if (thirdCard === 'J' || thirdCard === 'Q' || thirdCard === 'K') {\n thirdCard = 10;\n } else if (thirdCard === 'A') {\n thirdCard = 11;\n }\n //get player's fourth card\n var fourthCard = document.getElementById('card4').innerHTML;\n //if it's a royal or an Ace, assign it to its corresponding number\n if (fourthCard === 'J' || fourthCard === 'Q' || fourthCard === 'K') {\n fourthCard = 10;\n } else if (fourthCard === 'A') {\n fourthCard = 11;\n }\n //get player's fifth card\n var fifthCard = document.getElementById('card5').innerHTML;\n //if it's a royal or an Ace, assign it to its corresponding number\n if (fifthCard === 'J' || fifthCard === 'Q' || fifthCard === 'K') {\n fifthCard = 10;\n } else if (fifthCard === 'A') {\n fifthCard = 11;\n }\n //convert player cards from string to int and add together\n var cardOneInt = parseInt(firstCard);\n var cardTwoInt = parseInt(secondCard);\n var cardThreeInt = parseInt(thirdCard);\n var cardFourInt = parseInt(fourthCard);\n var cardFiveInt = parseInt(fifthCard)\n var cardSum = (cardOneInt + cardTwoInt)\n //if player hit and thirdCard has a value, add all three values together, otherwise add first and second card\n if (thirdCard !== \"\") {\n cardSum = (cardOneInt + cardTwoInt + cardThreeInt)\n }\n // If player hits again, add fourth card\n if (fourthCard !== \"\") {\n cardSum = (cardOneInt + cardTwoInt + cardThreeInt + cardFourInt)\n }\n // If player hits again, add fifth card\n if (fifthCard !== \"\") {\n cardSum = (cardOneInt + cardTwoInt + cardThreeInt + cardFourInt + cardFiveInt)\n }\n return cardSum;\n }", "function parse_cm_add_payment_card(responseJsonObj) {\n\tif (responseJsonObj) {\n\t\tif(responseJsonObj.paymentCard){\n\t\t\tthis.paymentCard = responseJsonObj.paymentCard;\n\t\t}\n\t\tthis.errorCode = responseJsonObj.errorCode;\n\t\tthis.errorMessage = responseJsonObj.errorMessage;\n\t}\n}", "function card(){\n\tthis.suit = null;\n\tthis.number = null;\n\tthis.setSuit = function(newSuit){\n\t\tthis.suit = newSuit;\n\t};\n\tthis.setNumber = function(newNumber){\n\t\tthis.number = newNumber;\n\t};\n}", "function scrapeCard(element, $) {\n element = $(element);\n var card = {};\n\n //Get the card images\n var $images = element.find(\".scan.left\");\n card.smallImg = $images.find(\"img\").attr(\"src\");\n card.largeImg = $images.find(\"a\").attr(\"href\");\n\n var $card = element.find(\".card\");\n\n //Get the title and set name from the title bar\n var titleArray = $card.find(\"h2.entry-title\").text().match(/(.+) \\((.+)\\)/);\n card.name = titleArray[1];\n card.set = titleArray[2];\n\n //Get the type\n var $p = $card.find(\".tabs-wrap [id^=text-]>p\");\n readCardParagraphs($p, card, $);\n\n return card;\n}", "function sumOfCards() {\n let hand = this.hand;\n let sum = 0;\n for (let i = 0; i < hand.length; i++) {\n if (hand[i].value == \"J\" || hand[i].value == \"K\" || hand[i].value == \"Q\") {\n hand[i].value = 10;\n }\n if (hand[i].value == \"A\") {\n hand[i].value = 11;\n }\n sum = sum + parseInt(hand[i].value);\n }\n\n //Set Aces to 1 if sum > 21\n if (sum > 21) {\n sum = 0;\n for (let j = 0; j < hand.length; j++) {\n if (hand[j].value == \"A\" || hand[j].value == 11) {\n hand[j].value = 1;\n }\n sum = sum + parseInt(hand[j].value);\n }\n }\n return sum;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function revisePlan It will be called when clicking 'Revised Plan' process in event tab on techspec screen.
function revisePlan() { var url = "revised"; var htmlAreaObj = _getWorkAreaDefaultObj(); var objAjax = htmlAreaObj.getHTMLAjax(); var objHTMLData = htmlAreaObj.getHTMLDataObj(); sectionName = objAjax.getDivSectionId(); //alert("sectionName " + sectionName); if(objAjax && objHTMLData) { if(!isValidRecord(true)) { return; } bShowMsg = true; Main.loadWorkArea("techspecevents.do", url); } }
[ "function remove_plan(date, index){\n\t\tself.editplan = null;\n\t\tself.cyear.remove_plan(date, index);\n\t}", "function editPlan(planId, e) {\n\te.preventDefault();\n\tvar plan = getTravelPlanById(planId);\n\tvar listActivities = plan.activities;\n\tvar listGuests = plan.guests;\n\t$(\"#myNotes\").val(plan.notes);\n\t$(\"#from_date\").val(plan.date.from);\n\t$(\"#to_date\").val(plan.date.to);\n\tlistActivities.forEach((act) => {\n\t\t$(\"#activity-list\").append(\n\t\t\t`<li data-text=\"${act}\">${act}<button class=\"material-icons cyan pulse\" onclick=\"removeActivity(this, '${act}')\">clear</button></li>`\n\t\t);\n\t});\n\n\tlistGuests.forEach((guest) => {\n\t\t$(\"#guest-list\").append(`<div class=\"chip\" data-info=\"${guest}\">\n <div class=\"guest-info\">${guest}<span><i class=\"close material-icons\">close</i></span>\n </div>\n </div>`);\n\t});\n\n\t// remove as this is a new plan\n\t$(\"#save-trip\").attr(\"data-plan-id\", planId);\n\tloadPageSection(\"#plan-vacation-page\");\n}", "approvePlanUpdate() {\n $('#modal-confirm-plan-update').modal('hide');\n\n this.updateSubscription(this.confirmingPlan);\n }", "swapPlans() {\n\t\tlog.debug('Swapping plans..');\n\t\tconst now = new Date();\n\t\tconst tomorrow = this.main.plans.tomorrow;\n\n\t\tthis.main.plans.today = null;\n\n\t\tif (tomorrow && now.getDay() === tomorrow.date.toDate().getDay()) {\n\t\t\tthis.main.plans.today = tomorrow;\n\t\t\tthis.backupPlan(this.main.plans.today.raw, 'today');\n\t\t\tthis.main.plans.tomorrow = null;\n\t\t}\n\t}", "function delPlan(plan){\n Ext.Ajax.request({\n url: '/config/scheduling/delSchedule',\n params: {\n session: session,\n line: plan\n },\n success: function(response){\n infos('Plan deleted');\n loadConfPlans();\n },\n failure: function(response){\n loadConfPlans();\n }\n });\n}", "function actualPlan()\r\n{\r\n var url = \"actual\";\r\n \tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n sectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n if(objAjax && objHTMLData)\r\n {\r\n\t if(!isValidRecord(true))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t bShowMsg = true;\r\n \tloadWorkArea(\"seasonalcaloverview.do\", url);\r\n if(objAjax.isProcessComplete())\r\n {\r\n objHTMLData.resetChangeFields();\r\n }\r\n }\r\n}", "function deletePlan(req, res) {\n async function deletePlan() {\n try {\n if (req.body && req.body.planid) {\n stripe.plans.del(req.body.planid, async function(err, confirmation) {\n // asynchronously called\n if (err) {\n console.log(err);\n res.json(\n Response(constant.ERROR_CODE, constant.FAILED_TO_PROCESS, null)\n );\n } else {\n let condition = { _id: req.body._id };\n let updateCondition = { isActive: false };\n\n let updateSubscription = await commonQuery.updateOneDocument(\n subscriptionplans,\n condition,\n updateCondition\n );\n if (updateSubscription) {\n }\n\n res.json(\n Response(\n constant.SUCCESS_CODE,\n constant.SUBSCRIPTION_CREATED,\n confirmation\n )\n );\n }\n });\n } else {\n return res.json(\n Response(constant.ERROR_CODE, constant.REQURIED_FIELDS_NOT, error)\n );\n }\n } catch (error) {\n return res.json(\n Response(constant.ERROR_CODE, constant.REQURIED_FIELDS_NOT, error)\n );\n }\n }\n\n deletePlan().then(function() {});\n}", "function handleRevertClick( ev ) {\n\t\tif ( ! confirm( \"Discard changes and revert to last saved configuration?\" ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar myid = api.getCpanelDeviceId();\n\t\tgetConfiguration( myid, true );\n\t\tconfigModified = false;\n\t\tupdateSaveControls();\n\n\t\t/* Be careful about which tab we're on here. */\n\t\t/* ??? when all tabs are modules, module.redraw() is a one-step solution */\n\t\tvar ctx = $( ev.currentTarget ).closest('div.reactortab').attr('id');\n\t\tif ( ctx === \"tab-vars\" ) {\n\t\t\tredrawVariables();\n\t\t} else if ( ctx === \"tab-conds\" ) {\n\t\t\tCondBuilder.redraw( myid );\n\t\t} else if ( ctx === \"tab-actions\" ) {\n\t\t\tredrawActivities();\n\t\t} else {\n\t\t\talert(\"OK, I did the revert, but now I'm lost. Go to the Status tab, and then come back to this tab.\");\n\t\t}\n\t}", "revert(){\n\n // load the data inside \n this.historyJmarcOriginal.fields=[]\n this.historyJmarcOriginal.parse(this.historyJmarcHistory.compile())\n // save the record to keep changes\n this.saveRecord(this.historyJmarcOriginal)\n \n // change the mode\n this.historyMode=false\n\n // clean\n let recup=this.historyJmarcHistory\n this.historyJmarcHistory=\"\"\n this.historyJmarcOriginal=\"\"\n this.removeRecordFromEditor(recup)\n\n this.callChangeStyling(\"Record reverted!!!\", \"d-flex w-100 alert-success\")\n \n }", "function updatePlan(obj) {\n // console.log(obj);\n // return false;\n if (obj != \"\") {\n settingService.updatePlan(obj).then(function(resp) {\n if (resp.data.status == \"success\") {\n\n vm.getPlans(null);\n toastr.success(resp.data.message);\n $timeout(function() {\n vm.editPlan = false;\n vm.showExistingPlans = true;\n }, 500);\n \n \n } else {\n toastr.error(resp.data.message);\n }\n });\n }\n\n\n }", "function deletePlan(planId,uid) {\n planRef = myDataRef.child(\"plans\").child(planId);\n planRef.remove(reportError());\n //remove index reference in users::plans\n userRef = myDataRef.child(\"users\").child(uid);\n userPlanRef = userRef.child(\"plans\").child(planId);\n userPlanRef.remove(reportError());\n \n // get the latest plan for the user and set current plan to this plan\n myDataRef.child(\"plans\").orderByChild(\"user\").equalTo(uid).once(\"value\", function(snap) {\n for (var random in snap.val()) break;\n if (random === undefined) {\n random = \"\";\n }\n setUserPlan(random,uid); \n }); \n}", "async clearPlan() {\n this.originAirfield = undefined;\n this.destinationAirfield = undefined;\n this.cruiseAltitude = 0;\n this.activeWaypointIndex = 0;\n this.procedureDetails = new ProcedureDetails();\n this.directTo = new DirectTo();\n await GPS.clearPlan();\n this._segments = [new FlightPlanSegment(SegmentType.Enroute, 0, [])];\n }", "function closePlan(){\n document.getElementById('planPage').style.display = \"none\";\n}", "deactivateApproach() {}", "desactivate(){\n /* DEBUG */\n this.debug && this.log(\"[ZIPAC] > Method desactivate\", this.debugContext);\n\n this.timePolling = 0;\n this.isActivated = false;\n }", "function planFormCaller() {\n plan.planForm();\n}", "function navigateUpgradePlan(){\n $state.go('app.planupgrade.main');\n }", "function revert() {\n calEventHandler.isChanging = true;\n scope.event.start = new Date(originStartTime);\n scope.event.end = new Date(originEndTime);\n\n calEventHandler.dateChange(scope.event, elem, null, null);\n calEventHandler.isChanging = false;\n }", "changeSubscriptionPlan(newSubscriptionPlan, currentSubscription) {\n\t\t//console.log('plan chosen', newSubscriptionPlan, currentSubscription);\n\n\t\tthis._clearMessage();\n\t\tthis._startLoading('subscription.loading.UPDATING_SUBSCRIPTION_PLANS');\n\t\t// Set the selectedMerchantAccount\n\t\tthis.braintreeDataService.setSelectedMerchantAccountByCurrency(newSubscriptionPlan.currencyIsoCode);\n\n\t\t// Cancel the current subscription\n\t\tthis.braintreeDataService.cancelSubscription(currentSubscription.id).then(\n\t\t\t(response) => {\n\t\t\t\tif (this.customer.id) {\n\t\t\t\t\tlet subLessFrequent = (newSubscriptionPlan.billingFrequency > currentSubscription.plan.billingFrequency);\n\t\t\t\t\tlet discount = 0;\n\n\t\t\t\t\t// New subscription data\n\t\t\t\t\tlet newSubscriptionData = {\n\t\t\t\t\t\tsubscription: {\n\t\t\t\t\t\t\tpaymentMethodToken: currentSubscription.defaultPaymentMethod.token,\n\t\t\t\t\t\t\tplanId: newSubscriptionPlan.id,\n\t\t\t\t\t\t\tmerchantAccountId: this.braintreeDataService.selectedMerchantAccount.id\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\t// Calculate discount if we are going to a less frequent billing cycle.\n\t\t\t\t\tif (subLessFrequent) {\n\t\t\t\t\t\t// Get remaining days of current subscription\n\t\t\t\t\t\tlet nextBillingDate = this.moment(currentSubscription.nextBillingDate).startOf('days');\n\t\t\t\t\t\tlet today = this.moment(this.moment().startOf('days'));\n\t\t\t\t\t\tlet duration = this.moment.duration(nextBillingDate.diff(today));\n\t\t\t\t\t\tlet remainingDays = duration.asDays();\n\t\t\t\t\t\tlet billingCycleDays = currentSubscription.plan.billingFrequency * 31;\n\n\t\t\t\t\t\t// Calculate discount\n\t\t\t\t\t\t// Discount = (RemaningDays / TotalBillingCycleDays) * CurrentPlanPrice\n\t\t\t\t\t\tdiscount = ((remainingDays / billingCycleDays) * currentSubscription.plan.price).toFixed(2);\n\n\t\t\t\t\t\t// Add discount to new subscription data\n\t\t\t\t\t\tnewSubscriptionData.subscription.discounts = {\n\t\t\t\t\t\t\tadd: [{\n\t\t\t\t\t\t\t\tamount: discount,\n\t\t\t\t\t\t\t\tnumberOfBillingCycles: 1,\n\t\t\t\t\t\t\t\tinheritedFromId: 'upgradeDiscount'\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Set the StartDate on the new subscription to be the end of the current one.\n\t\t\t\t\t\tnewSubscriptionData.subscription.firstBillingDate = currentSubscription.paidThroughDate\n\t\t\t\t\t}\n\n\t\t\t\t\t// Create a new subscription\n\t\t\t\t\tthis.braintreeDataService.createSubscription(newSubscriptionData).then(\n\t\t\t\t\t\t(response) => {\n\t\t\t\t\t\t\t//console.log('response', response);\n\t\t\t\t\t\t\tif (response.data.success) {\n\t\t\t\t\t\t\t\tthis.getCustomerDetails(this.customer.id).then(\n\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\tlet descriptionHtml = '';\n\n\t\t\t\t\t\t\t\t\t\tif (response.data.subscription.transactions.length) {\n\t\t\t\t\t\t\t\t\t\t\tlet transactionAmount = response.data.subscription.transactions[0].amount;\n\t\t\t\t\t\t\t\t\t\t\tlet currencySymbol = this.getCurrencySymbol(response.data.subscription.transactions[0].currencyIsoCode);\n\n\t\t\t\t\t\t\t\t\t\t\tif (discount > 0) {\n\t\t\t\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t\t\t\tthis.$translate('subscription.message.UPDATED_SUBSCRIPTION_WITH_DISCOUNT', {\n\t\t\t\t\t\t\t\t\t\t\t\t\tamount: currencySymbol + transactionAmount,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdiscount: currencySymbol + discount\n\t\t\t\t\t\t\t\t\t\t\t\t}).then((value) => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescriptionHtml = '<p>';\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescriptionHtml += value;\n\t\t\t\t\t\t\t\t\t\t\t\t\tdescriptionHtml += '</p>';\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tthis._displayMessage('success', 'subscription.message.SUBSCRIPTION_CHANGED_TO_NEW_PLAN', null, descriptionHtml);\n\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tthis._displayMessage('success', 'subscription.message.SUBSCRIPTION_CHANGED_TO_NEW_PLAN', null);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// TODO: Handle different failures maybe?\n\t\t\t\t\t\t\t\tthis._displayMessage('warning', 'subscription.message.ERROR_CREATING_SUBSCRIPTION', null, response.data.message);\n\t\t\t\t\t\t\t\tthis._stopLoading();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(error) => {\n\t\t\t\t\t\t\t//console.log('Error creating a subcription', error);\n\t\t\t\t\t\t\tthis._displayMessage('warning', 'subscription.message.ERROR_CREATING_SUBSCRIPTION', null, error);\n\t\t\t\t\t\t\tthis._stopLoading();\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\t(error) => {\n\t\t\t\tthis._stopLoading();\n\t\t\t\tthis._displayMessage('warning', 'subscription.message.ERROR_CANCELLING_SUBSCRIPTION', null, error.data.message);\n\t\t\t}\n\t\t);\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Returns the last name of the user.
get lastName(){ return this._user.last_name; }
[ "function getLastName() {\n\t\t\treturn JSON.parse(atob(getToken().split('.')[1])).lastName;\n\t\t}", "get lastName(){\n\t\treturn this.user.last_name;\n\t}", "function getLastNames() {\n return users.map(function (user) {\n return user.name.split(' ')[1];\n })\n}", "function getLastName() {\n if ($.last_name) {\n return $.last_name.getValue().trim();\n }\n\n }", "function getUserFullName(){\n if( this.firstname && this.lastname )\n return this.firstname + ' ' + this.lastname;\n else if( this.firstname )\n return this.firstname;\n else if( this.lastname )\n return this.lastname;\n else\n return this.email;\n }", "getLastname() {\n return this.fullname.split(\" \")[1];\n }", "function getUserName() {\n // TODO 5: Return the user's display name.\n return firebase.auth().currentUser.displayName;\n }", "function getFullName() {\n\treturn user.firstName.concat(\" \", user.lastName);\t\t\n }", "function getUserName() {\n return firebase.auth().currentUser.displayName;\n }", "function getUserName() {\n\treturn firebase.auth().currentUser.displayName;\n}", "function getLastName() {\n checkToken(window.localStorage.getItem(\"TokenExpiration\"));\n\n var name = window.localStorage.getItem(\"LastName\");\n if (name == null) {\n corruptData();\n return window.localStorage.getItem(\"LastName\");\n }\n return name;\n}", "getLastName(project) {\n const user = this.props.users[this.props.displaySupervisorName? project.data.supervisor_id: project.data.student_id];\n if (!user) {return project.data.id}\n const name = user.data.name;\n return name.substr(name.indexOf(' ')+1)\n }", "function getUserName() {\n // TODO 5: Return the user's display name.\n return firebase.auth().currentUser.displayName;\n}", "function getLastName() {\n if (typeof document.registration.lastname === \"undefined\") {\n return \"\";\n }\n return document.registration.lastname.value;\n}", "getUserName() {\r\n var currentUser = this.getCurrentUser();\r\n return currentUser.displayName;\r\n }", "function userName(user){\n\n var name = '';\n\n if(user) { name = user.first; }\n\n return name;\n}", "function getUserName() {\r\n if(isUserSignedIn()){\r\n return auth.currentUser.displayName;\r\n }\r\n}", "function getFirstName(user) {\n \treturn user.name.split(\" \")[0]\n}", "function getLastName(node) {\n lastName = node.querySelector('.blockquote-footer').textContent.split(' ').slice(-1)[0].toUpperCase()\n return lastName\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
function _hiLightTopOfSebTree(eTR) this function hilights the first node on a sub tree, internal use only
function _hiLightTopOfSebTree(eTR) { var eTBody=eTR.cells(1).firstChild.firstChild; eTBody.rows(0).cells(1).fireEvent("onclick"); }
[ "function _hiLightBottomOfSebTree(eTR)\n\t{\n\t\tvar eTBody=eTR.cells(1).firstChild.firstChild;\n\t\tvar eTRBottom=eTBody.rows(eTBody.rows.length-1);\n\t\tif(eTRBottom.style.display !='none')\n\t\t\t_hiLightBottomOfSebTree(eTRBottom);\n\t\telse\t\n\t\t\teTBody.rows(eTBody.rows.length-2).cells(1).fireEvent(\"onclick\");\n\t}", "function firstTree() {\n hideAllWindows();\n if (currentTreeIndex != 0) {\n moveToTreeHelper(0);\n }\n}", "function hiLightDown(currentElement)\n\t{\n\t\tvar eTR=currentElement.parentNode;\n\t\t\n\t\tif(eTR.tagName != \"TR\")\n\t\t\treturn;\n\t\n\t\tvar nRowIndex=eTR.rowIndex;\n\t\tvar nTotalRows=eTR.parentNode.rows.length;\n\t\tvar bJumpOutOfSubTree=false;\n\t\t\n\t\tif(nRowIndex%2!=0)\n\t\t{\n\t\t\tif(nRowIndex+1 <= nTotalRows-1)\n\t\t\t\teTR.parentNode.rows(nRowIndex+1).cells(1).fireEvent(\"onclick\");\n\t\t\telse\n\t\t\t\tbJumpOutOfSubTree=true;\t\n\t\t}\t\t\n\t\telse\n\t\t{\n\t\t\tif( (nRowIndex < nTotalRows-1) && (eTR.parentNode.rows(nRowIndex+1).style.display !='none'))\n\t\t\t\t_hiLightTopOfSebTree(eTR.parentNode.rows(nRowIndex+1));\n\t\t\telse if (nRowIndex < nTotalRows-2)\n\t\t\t\t\teTR.parentNode.rows(nRowIndex+2).cells(1).fireEvent(\"onclick\");\n\t\t\telse\n\t\t\t\tbJumpOutOfSubTree=true;\t\t\t\n\t\t}\t\n\t\n\t\tif(bJumpOutOfSubTree)\n\t\t{\n\t\t\tvar eTD=eTR.parentNode.parentNode.parentNode;\n\t\t\thiLightDown(eTD);\n\t\t}\n\t}", "treeTop (r) {\n if (r < P.tree) return T.tree_top_middle\n return T.air\n }", "get topNode() {\n return new TreeNode$2(this, 0, 0, null);\n }", "function firstLeaf(node) {\r\n while (node.type === 0 /* Branch */) {\r\n node = node.children[0];\r\n }\r\n return node;\r\n }", "visit_topdown(tree) {\r\n this._call_userfunc(tree);\r\n for (const child of tree.children) {\r\n if (child instanceof Tree) {\r\n this.visit_topdown(child);\r\n }\r\n }\r\n\r\n return tree;\r\n }", "get topNode() {\n return new TreeNode(this, 0, 0, null);\n }", "function hiLightUp(currentElement)\n\t{\n\t\tvar eTR=currentElement.parentNode;\n\t\tif(eTR.TMB=='top')\n\t\t\treturn;\n\t\t\n\t\tvar nRowIndex=eTR.rowIndex;\n\t\n\t\tif(nRowIndex>=1)\n\t\t{\t\n\t\t\tif(nRowIndex%2!=0)\n\t\t\t\teTR.parentNode.rows(nRowIndex-1).cells(1).fireEvent(\"onclick\");\n\t\t\telse\n\t\t\t{\n\t\t\t\tif(eTR.parentNode.rows(nRowIndex-1).style.display !='none')\n\t\t\t\t\t_hiLightBottomOfSebTree(eTR.parentNode.rows(nRowIndex-1));\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\teTR.parentNode.rows(nRowIndex-2).cells(1).fireEvent(\"onclick\");\n\t\t\t}\n\t\t}\t\n\t\telse\n\t\t{\n\t\t\tvar eTD=eTR.parentNode.parentNode.parentNode;\n\t\t\thiLightUp(eTD);\n\t\t}\n\t}", "function topLevelNodeAt(node, top) {\n while (node && node.parentNode != top) {\n node = node.parentNode;\n }\n return node;\n }", "function topLevelNodeAt(node, top) {\n while (node && node.parentNode != top)\n node = node.parentNode;\n return node;\n }", "get topNode() {\n return new TreeNode(this, 0, 0, null);\n }", "function topLevelNodeBefore(node, top) {\n while (!node.previousSibling && node.parentNode != top) {\n node = node.parentNode;\n }\n return topLevelNodeAt(node.previousSibling, top);\n }", "get topNode() { return this.nodeSet.types[this.top[1]]; }", "function topLevelNodeBefore(node, top) {\n while (!node.previousSibling && node.parentNode != top)\n node = node.parentNode;\n return topLevelNodeAt(node.previousSibling, top);\n }", "function resetTreeFirstLevel(original_Data) {\n document.getElementById(\"search_input\").value = \"\";\n $('.js-select2').val(null).trigger(\"change\");\n last_selected = null;\n filtering_active = false;\n tree_clicked_bool = false;\n tree_root = tree(hierarchy(original_Data)); //passed by function\n current_Data = JSON.parse(JSON.stringify(original_Data));\n tree_root.each(function (d) {\n d.name_to_print = d.id; //transferring name to a name variable\n d.id = tree_i; //Assigning numerical Ids\n tree_i++;\n });\n tree_root.x0 = tree_root.x;\n tree_root.y0 = tree_root.y;\n tree_root.children.forEach(tree_collapseLevel);\n tree_update(tree_root);\n window.scrollTo(0,0);\n}", "function setToplevel(node) {\n if (topLevelId >= 0) {\n // Remove class for old toplevel element\n cy.getElementById(topLevelId).removeClass('toplevel');\n }\n node.addClass('toplevel');\n // Set new toplevel element\n setToplevelId(node);\n topNodeSet = true;\n}", "function boustrophedon(biTree){\n //plan\n // traverse tree in bousrophedon order\n\n}", "get isTop() { return (this.flags & 1 /* NodeFlag.Top */) > 0; }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send raw binary data to the given peer. There must be a direct connection to the peer.
sendRaw(peerId, binaryData) { let connection = this.getConnection(peerId); if (connection && connection.channel) { if (connection.channel.readyState === 'open') { connection.channel.send(binaryData); } else { console.log('cannot send: ' + connection.channel.readyState + ' ' + peerId); } } else { console.log('no connection to send to: ' + peerId); } }
[ "async sendRaw (peerAddr, amount, rawBuf) {\n let plugin = peerAccounts.getAccount(peerAddr);\n return plugin.sendData(formatDataPacket(amount, rawBuf));\n }", "send(data, peer) {\n if (data instanceof Object) {\n data = JSON.stringify(data);\n }\n if (!(typeof data == 'string' || data instanceof String)) {\n data = data.toString();\n }\n\n var target = peer;\n if (typeof peer === 'string' || peer instanceof String) {\n target = this.findPeerByChannelName(peer)\n }\n target.send(data);\n }", "sendRaw(msg) {\n if(this.state !== ST_WORKING) {\n return;\n }\n\n this.socket.send(msg, {binary: true}, function(err) {\n if(!!err) {\n logger.info('websocket send binary data failed: %j', err.stack);\n return;\n }\n });\n }", "sendRaw(msg) {\n if (this.state !== ST_WORKING) {\n return;\n }\n var self = this;\n this.socket.send(msg, { binary: true }, function (err) {\n if (!!err) {\n logger.error('websocket send binary data failed: %j', err.stack);\n return;\n }\n });\n }", "send(data) {\n if (this._readyState !== 'open')\n throw new errors_1.InvalidStateError('not open');\n if (typeof data === 'string') {\n this._channel.notify('datachannel.send', this._internal, data);\n }\n else if (data instanceof ArrayBuffer) {\n const buffer = Buffer.from(data);\n this._channel.notify('datachannel.sendBinary', this._internal, buffer.toString('base64'));\n }\n else if (data instanceof Buffer) {\n this._channel.notify('datachannel.sendBinary', this._internal, data.toString('base64'));\n }\n else {\n throw new TypeError('invalid data type');\n }\n }", "function onBytesMessage(peer,data)\n {\n var arr = bufferToArray(scope._servConn.byteType,data);\n\n if(arr)\n {\n if(scope._servConn.rtcFallback == true)\n {\n arr = arr.slice(0,arr.length-2);\n }\n scope.dispatchEvent(\"peerMessage\",{message:arr,id:peer.id,rtc:peer.rtcId,array:true,fallback:false});\n }\n }", "function send (blob) {\n socket.emit('video', blob)\n }", "function sendData(message, connection) {\n type = getConnectionDataType(connection);\n\n if(type == 'binary') {\n let buf = new Buffer(message);\n connection.sendBytes(buf);\n } else {\n connection.sendUTF(message);\n }\n}", "function sendPacket() {\n var simulatedPacket = new Buffer('f001ed4a11aaaa7800008000000000000000000000000000000000503300aaaa0401b00b1e500000aaaa7801008100000000000000000000000000000000503300aaaa2001421e55daba50e1fe0201050c097265656c7941637469766507fffee150bada550100', 'hex');\n socket.send(simulatedPacket, 0, simulatedPacket.length, PORT, HOST);\n}", "function sendData(data) {\n socket.emit('send figure', data);\n}", "emit(data) {\n for (let peer of this.peers) {\n if (peer.connected) {\n this.send(data, peer);\n }\n }\n }", "function sendData(data) {\n var i, l, str, pos, len, tmp;\n\n if (typeof data === \"string\") {\n // string to aray buffer\n str = data;\n l = str.length;\n data = new Uint8Array(l);\n for (i = 0; i < l; i++) data[i] = str.charCodeAt(i);\n } else if (typeof data === \"number\") {\n // byte/character to aray buffer\n str = String.fromCharCode(data);\n data = new Uint8Array([data]);\n }\n\n if (!(data instanceof Uint8Array)) throw \"Invalid data in sendData().\";\n\n if (vtxdata.telnet) {\n // escape 0xFF's\n\n if (Uint8indexOf(data, 0xff) >= 0) {\n // if (data.indexOf(0xFF) >= 0) {\n // spilt up / recombine\n tmp = [];\n len = 0;\n while ((pos = Uint8indexOf(data, 0xff)) >= 0) {\n tmp.push(data.slice(0, pos));\n len += pos;\n tmp.push(new Uint8Array([0xff, 0xff]));\n len += 2;\n data = data.slice(pos + 1);\n }\n len += data.length;\n tmp.push(data);\n\n // join tmp into new data\n data = new Uint8Array(len);\n for (pos = 0, i = 0; i < tmp.length; i++) {\n data.set(tmp[i], pos);\n pos += tmp[i].length;\n }\n }\n }\n\n // check code page conversions.\n if (ws && ws.readyState == 1 && termState != TS_OFFLINE) {\n ws.send(data.buffer);\n } else {\n conBufferOut(str);\n crsrDraw();\n }\n }", "async sendMessage (peer, msg) {\n if (!this._running) throw new Error('network isn\\'t running')\n\n const stringId = peer.toB58String() ? peer.toB58String() : peer.id.toB58String()\n this._log('sendMessage to %s', stringId, msg)\n\n const { conn, protocol } = await this._dialPeer(peer)\n\n let serialized\n switch (protocol) {\n case BITSWAP100:\n serialized = msg.serializeToBitswap100()\n break\n case BITSWAP110:\n serialized = msg.serializeToBitswap110()\n break\n default:\n throw new Error('Unknown protocol: ' + protocol)\n }\n\n // Note: Don't wait for writeMessage() to complete\n writeMessage(conn, serialized, this._log)\n\n this._updateSentStats(peer, msg.blocks)\n }", "_send() {\n this._conn.flush();\n }", "send (data) {\n assert(typeof data === 'string' || Buffer.isBuffer(data));\n\n if (Buffer.isBuffer(data)) {\n this._ws_writeBinary(data);\n } else {\n this._ws_writeText(data);\n }\n }", "function sendPacket() {\n var simulatedPacket = new Buffer('f001ed4a11aaaa7800008000000000000000000000000000000000503300aaaa0401b00b1e500000aaaa7801008100000000000000000000000000000000503300aaaa1801421655daba50e1fe0201050c097265656c794163746976650100', 'hex');\n socket.send(simulatedPacket, 0, simulatedPacket.length, UDP_PORT, HOST);\n}", "async _p2pSend (peerAddress, obj) {\n // log.t(this.me() + ' >>> ' + this.nick(peerAddress) + ' - ' + obj.type)\n return this._p2p.publishReliable(\n [peerAddress],\n msgpack.encode(obj).toString('base64')\n )\n }", "function send_data(socket_id, circuit_id, stream_id, data) {\n let stream_identifier = hash_stream(socket_id, circuit_id, stream_id);\n\n if (!OPENED.has(stream_identifier))\n return;\n\n for (let i = 0; i < data.length;) {\n let lo = i;\n i = Math.min(i + consts.CELL_SIZE.RelayBody, data.length);\n let body = data.slice(lo, i);\n\n cell.data(socket_id, circuit_id, stream_id, body);\n }\n }", "sendData(message, data){\n this.socket.emit(message, data);\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Find Style object based on title
function findPreferredStyle(styleName, styles) { var styleLen = styles.length; for(var i = 0; i<=styleLen; i++) { console.log(styles[i]); var name = styles[i].title; if(name === styleName) { return styles[i]; } } return null; }
[ "function getStyleSheetByTitle(title) {\n for (var i = 0; i < document.styleSheets.length; i++) {\n var sheet = document.styleSheets[i];\n if (sheet.title && sheet.title == title) return sheet;\n }\n return null;\n }", "function lookup_style(styles, stylename) {\n\t\tvar stylebase = stylename.split(/[ _-]/)[0];\n\t\treturn (styles.itemByName(stylebase));\n\t}", "function getStyle(element, styleName){\n\t \t//returning the text content\n\t var styleText = d3.select(element)\n\t .select(\"desc\")\n\t .text();\n\t //create a JSON object and return the correct style property's value\n\t var styleObject = JSON.parse(styleText);\n\t return styleObject[styleName];\n\t }", "function di_getChartTitleStyle(chartObj)\n{\n\tvar chartInput = chartObj.options;\n\tvar styleObj = chartInput.title.style;\n\treturn styleObj;\n}", "function match_style(style) {\n rs = db.execute('SELECT style_id FROM style WHERE name = ?', [ $('NAME', style).text() ]);\n try {\n if (rs.isValidRow()) {\n return rs.field(0); \n }\n } finally {\n rs.close();\n }\n}", "function getStyleItem( divName )\n\t{\n\tvar\tobj;\n\tobj = document.all[divName].style;\n\treturn obj;\n\t}", "function getStyle ( styleName ) {\n\n return styleMap[ styleName ];\n\n }", "function get_title_ParagraphStyle() {\n\n var allParaStyles = app.activeDocument.allParagraphStyles;\n var biggestFontSize = 0;\n var biggestFontSizeStyle;\n\n\n for (var i = 0; i < allParaStyles.length; i++) {\n //$.writeln(\"O PS \" + allParaStyles[i].name + \" e composto a \" + allParaStyles[i].pointSize);\n\n //guardar o PS com tamanho de fonte maior\n if (allParaStyles[i].pointSize >= biggestFontSize) {\n biggestFontSize = allParaStyles[i].pointSize;\n biggestFontSizeStyle = allParaStyles[i].name;\n }\n }\n\n return biggestFontSizeStyle;\n}", "function get_style_id(style_name) {\n for (let i = 0; i < object_styles.length; i++) {\n if (object_styles[i].name == style_name) {\n return i;\n }\n }\n return -1;\n }", "function getStyleObject(objectId) {\n if(document.getElementById && document.getElementById(objectId)) {\n\treturn document.getElementById(objectId).style;\n } else if (document.all && document.all(objectId)) {\n\treturn document.all(objectId).style;\n } else if (document.layers && document.layers[objectId]) {\n\t\treturn getObjNN4(document,objectId);\n } else {\n\treturn false;\n } \n}", "function di_getChartSubTitleStyle(chartObj)\n{\n\tvar chartInput = chartObj.options;\n\tvar styleObj = chartInput.subtitle.style;\n\treturn styleObj;\n}", "function S(ID) {\r\n return O(ID).style\r\n}", "function getStyleObjectByID(objectId){\n\tif (document.getElementById && document.getElementById(objectId)){ \n\t\treturn document.getElementById(objectId).style;\n\t}else if (document.all && document.all(objectId)){\n\t\treturn document.all(objectId).style;\n\t}else if (document.layers && document.layers[objectId]){\n\t\treturn document.layers[objectId];\n\t}else{\n\t\treturn false;\n\t}\n\t}", "function getActiveStyleSheet() {\n\tvar elts = document.getElementsByTagName('link');\n\tfor (var i = 0; i < elts.length; ++i) {\n\t\tvar elt = elts[i];\n\t\tif (elt.getAttribute('rel').indexOf('style') >= 0 \n\t\t\t\t&& elt.getAttribute('title')\n\t\t\t\t&& !elt.disabled) {\n\t\t\treturn elt.getAttribute('title');\n\t\t}\n\t}\t\n\treturn null;\n}", "function findStyleFromID(ttmlStyling, cueStyleID) {\n // For every styles available, search the corresponding style in ttmlStyling.\n for (var j = 0; j < ttmlStyling.length; j++) {\n var currStyle = ttmlStyling[j];\n if (currStyle['xml:id'] === cueStyleID || currStyle.id === cueStyleID) {\n // Return the style corresponding to the ID in parameter.\n return currStyle;\n }\n }\n return null;\n }", "function findStyleFromID(ttmlStyling, cueStyleID) {\n // For every styles available, search the corresponding style in ttmlStyling.\n for (var j = 0; j < ttmlStyling.length; j++) {\n var currStyle = ttmlStyling[j];\n if (currStyle[\"xml:id\"] === cueStyleID || currStyle.id === cueStyleID) // Return the style corresponding to the ID in parameter.\n return currStyle;\n }\n return null;\n }", "static find(key) {\n return styleLookup.get(key) || null;\n }", "function returnMatchingStyle(name, type) {\n //console.log('looking for matching style');\n //make an array of all of the unique theme names, make sure they are all lower case\n let uniqueThemes = [...new Set(allThemes.map(item => item.theme.toLowerCase()))];\n //normalize style name for matching\n let normalizedCurrentStyleName = processStyleNameWithThemeNameIncluded(name.toLowerCase(), uniqueThemes);\n //match will default to null unless we find one\n let match = null;\n //console.log('selected theme styles: ', selectedThemeStyles)\n //iterate through all styles in all themes to find a match\n selectedThemeStyles.forEach(style => {\n let normalizedNewStyleName = processStyleNameWithThemeNameIncluded(style.name.toLowerCase(), uniqueThemes);\n //console.log('current style name:', normalizedCurrentStyleName)\n //console.log('new style name:', normalizedNewStyleName)\n if (normalizedNewStyleName === normalizedCurrentStyleName && style.type === type) {\n console.log('found a match!');\n match = style;\n return match;\n }\n });\n return match;\n}", "getStyleById() {\n const sql = 'select * from public.\"Style\" WHERE id = $1 ORDER BY id ASC';\n return queryDB(sql, [this.id])\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parse a vega schema url into library and version.
function default_1(url) { var regex = /\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g; var _a = regex.exec(url).slice(1, 3), library = _a[0], version = _a[1]; return { library: library, version: version }; }
[ "function default_1(url) {\n var regex = /\\/schema\\/([\\w-]+)\\/([\\w\\.\\-]+)\\.json$/g;\n var _a = regex.exec(url).slice(1, 3), library = _a[0], version = _a[1];\n return { library: library, version: version };\n }", "function getVersion(a) {\n return a.url.substring(1, 3) || \"v1\";\n}", "function getVersion(a) {\n var secondBracket = a.url.indexOf('/', 1);\n return a.url.substring(1, secondBracket) || \"v1\";\n}", "function parseURL(url) {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\"The url string provided does not contain a scheme. \" + \"Supported schemes are: \" + (\"\" + ModelStoreManagerRegistry.getSchemes().join(',')));\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1]\n };\n}", "function parseURL(url) {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(\"The url string provided does not contain a scheme. \" +\n \"Supported schemes are: \" +\n (\"\" + ModelStoreManagerRegistry.getSchemes().join(',')));\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}", "function parseURL(url) {\n if (url.indexOf(URL_SCHEME_SUFFIX) === -1) {\n throw new Error(`The url string provided does not contain a scheme. ` +\n `Supported schemes are: ` +\n `${ModelStoreManagerRegistry.getSchemes().join(',')}`);\n }\n return {\n scheme: url.split(URL_SCHEME_SUFFIX)[0],\n path: url.split(URL_SCHEME_SUFFIX)[1],\n };\n}", "static urlWithVersion(url) {\n const urlWithVersion = new URL(url);\n urlWithVersion.searchParams.append(Versioning.X_AMZN_VERSION, Versioning.sdkVersion);\n urlWithVersion.searchParams.append(Versioning.X_AMZN_USER_AGENT, Versioning.sdkUserAgentLowResolution);\n return urlWithVersion.toString();\n }", "function extractVersionFromString (source) {\n let version = source.match(SEMVER_REGEX)\n\n return !version || version.length === 0 ? null : version[0]\n}", "function parseVersion() {\n const versionRegex = /^version\\s*=\\s*[',\"]([^',\"]*)[',\"]/gm; // Match and group the version number\n const buildGradle = fs.readFileSync('build.gradle', 'utf8');\n return versionRegex.exec(buildGradle)[1];\n}", "function getWithVersion(url) {\n var versions = getVersions(url);\n\n //Has main service version\n if (versions[0]) {\n var versionSign = versions[0] ? '?x_version=' + versions[0] : '';\n\n //Has foreign service version\n if (versions[1] && versions[0] !== versions[1]) {\n versionSign += '&x_remote=' + versions[1];\n }\n\n //Inject version signature to the URL if it don't have it yet and can be attracted to\n if (\n versionSign && url.indexOf(versionSign) === -1 &&\n WITH_VERSION_MATCH.test(url)\n ) {\n var parts = url.split('?', 2);\n url = parts[0] + versionSign + (parts[1] ? '&' + parts[1] : '');\n }\n }\n\n return url;\n }", "function getVersion(path) {\n const url = new URL(path, 'https://foo.bar');\n const segments = url.pathname.split('/');\n return segments.find((segment) => segment.match(/v[0-9]+(.[0-9]+)?/));\n}", "static async parseSemanticVersion() {\n const description = await this.getVersionDescription();\n\n try {\n const [match, tag, commits, hash] = this.descriptionRegex.exec(description);\n\n return {\n match,\n tag,\n commits,\n hash,\n };\n } catch (error) {\n throw new Error(`Failed to parse git describe output: \"${description}\".`);\n }\n }", "function parse(versionString, requireFull) {\n if (!versionString) {\n throw new Error('A version parameter is required.');\n }\n\n // Check if the version string includes an alias, and resolve it.\n let versionParts = versionString.split('/');\n if (versionParts.length < 3) {\n let resolvedVersion = settings.aliases[versionParts[0]];\n if (resolvedVersion) {\n versionString = resolvedVersion;\n if (versionParts.length === 2) {\n versionString += '/' + versionParts[1];\n }\n }\n }\n\n let match = versionRegex.exec(versionString);\n if (!match) {\n throw new Error('Invalid version string: ' + versionString);\n }\n\n let remoteName = match[2] || null;\n let semanticVersion = match[5] || null;\n let label = match[7] || null;\n let arch = match[9];\n let os = process.platform;\n\n if (requireFull) {\n if (!remoteName) {\n throw new Error('A remote name is required.');\n }\n if (!arch) {\n throw new Error('A processor architecture is required.');\n }\n }\n\n if (label === 'current' && !remoteName && !arch) {\n let currentVersion = require('./use').getCurrentVersion();\n if (!currentVersion) {\n throw new Error('There is no current version. Use `nvs use` to set one.');\n }\n\n label = null;\n semanticVersion = currentVersion.semanticVersion;\n arch = currentVersion.arch;\n }\n\n if (!remoteName || remoteName === 'default') {\n remoteName = settings.remotes['default'] || 'node';\n }\n\n if (!settings.remotes[remoteName]) {\n throw new Error('remote name not found in settings.json: ' + remoteName);\n }\n\n if (label && label !== 'latest' && label !== 'lts' && !label.startsWith('lts-')) {\n throw new Error('Invalid version label: ' + label);\n }\n\n if (!arch) {\n arch = process.arch;\n }\n\n switch (arch) {\n case '32':\n case 'x86':\n case 'ia32':\n arch = 'x86';\n break;\n case '64':\n case 'x64':\n case 'amd64':\n arch = 'x64';\n break;\n default:\n throw new Error('Invalid architecture: ' + arch);\n }\n\n if (os === 'win32') {\n os = 'win';\n }\n\n let version = {\n remoteName,\n semanticVersion,\n label,\n arch,\n os,\n };\n return version;\n}", "parse() {\n const matches = this._dependancyString.match(/^(.+) \\((.+)\\)$/);\n if(matches && matches.length > 0) {\n this.packageName = matches[1];\n this.version = matches[2];\n } else {\n this.packageName = this._dependancyString;\n }\n }", "function parseVersion() {\n const appPathFile = 'build/resources/main/META-INF/build-info.properties';\n const versionRegex = /^build.version=\\s*(.*$)/gm;\n const appFile = fs.readFileSync(appPathFile, 'utf8');\n return versionRegex.exec(appFile)[1];\n}", "function parseVersion(version) {\n const versionStr = version.version;\n const firstDot = versionStr.indexOf('.');\n if (firstDot < 1) {\n throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`);\n }\n const secondDot = versionStr.indexOf('.', firstDot + 1);\n try {\n if (secondDot == -1) {\n return parseFloat(versionStr);\n }\n else {\n return parseFloat(versionStr.substring(0, secondDot));\n }\n }\n catch (error) {\n throw new Error(`Invalid Elasticsearch version: ${versionStr}. Version string needs to start with major and minor version (x.y).`);\n }\n}", "function localhostVersionParse(str) {\n // Check if valid versin string\n if(!/^[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+$/.test(str)) {\n return false;\n }\n\n var versionTuple = str.split('.');\n var versionObj = {\n _rawVersion: str,\n major: versionTuple[0],\n minor: versionTuple[1],\n patch: versionTuple[2],\n build: versionTuple[3],\n toString: function() {\n return this.major + '.' + this.minor + '.' + this.patch + '.' + this.build;\n },\n toJSON: function() {\n return this.toString();\n }\n };\n\n // Can upgrade silently\n\tif((versionObj.major >= 1 && versionObj.minor >= 0 && versionObj.patch >= 0 && versionObj.build >= 78) // cater for 1.0.0.78 on wards\n || (versionObj.major >= 1 && versionObj.minor >= 1)) {// cater for 1.1.x onwards\n versionObj.canSilentUpgrade = true;\n } else {\n versionObj.canSilentUpgrade = false;\n }\n\n // Has new API FileVersionDetails\n if((versionObj.major >= 1 && versionObj.minor >= 0 && versionObj.patch >= 0 && versionObj.build >= 78) // cater for 1.0.0.78 on wards\n || (versionObj.major >= 1 && versionObj.minor >= 1)) {// cater for 1.1.x onwards\n versionObj.hasAdditionalVersionDetail = true;\n } else {\n versionObj.hasAdditionalVersionDetail = false;\n }\n return versionObj;\n}", "function parseVersionString (str) {\n if (typeof(str) != 'string') { return false; }\n var x = str.split('.');\n // parse from string or default to 0 if can't parse\n var maj = parseInt(x[0]) || 0;\n var min = parseInt(x[1]) || 0;\n var pat = parseInt(x[2]) || 0;\n return {\n major: maj,\n minor: min,\n patch: pat\n }\n}", "function parseVersionString(str) {\r\n if (typeof(str) != 'string') { return false; }\r\n var x = str.split('.');\r\n // parse from string or default to 0 if can't parse\r\n var maj = parseInt(x[0]) || 0;\r\n var min = parseInt(x[1]) || 0;\r\n var pat = parseInt(x[2]) || 0;\r\n return {\r\n major: maj,\r\n minor: min,\r\n patch: pat\r\n }\r\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
empty if no ast (equivalently, the formula is '').
isEmpty() { return !this.ast; }
[ "get formula() { return this.ast ? this.ast.toString(this.id) : ''; }", "function test_nondet_empty() {\n parse_and_eval(\"amb();\");\n\n assert_equal(null, final_result);\n}", "jsx_parseEmptyExpression() {\n \t\t let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);\n \t\t return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);\n \t\t }", "duiParseEmptyExpression(): N.JSXEmptyExpression {\n const node = this.startNodeAt(\n this.state.lastTokEnd,\n this.state.lastTokEndLoc,\n );\n return this.finishNodeAt(\n node,\n \"JSXEmptyExpression\",\n this.state.start,\n this.state.startLoc,\n );\n }", "jsx_parseEmptyExpression() {\n var node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);\n return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);\n }", "jsx_parseEmptyExpression() {\n let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);\n return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);\n }", "function clearFormula() {\n formula = '';\n lastOperator = '';\n }", "function expressionIsComplete() {\n return !(left === \"\" || right === \"\" || operator === \"\"); \n}", "function AST(){}", "function parseXJSEmptyExpression() {\n if (tokType !== _braceR) {\n unexpected();\n }\n\n var tmp;\n\n tmp = tokStart;\n tokStart = lastEnd;\n lastEnd = tmp;\n\n tmp = tokStartLoc;\n tokStartLoc = lastEndLoc;\n lastEndLoc = tmp;\n\n return finishNode(startNode(), \"XJSEmptyExpression\");\n }", "function parseXJSEmptyExpression() {\r\n if (tokType !== _braceR) {\r\n unexpected();\r\n }\r\n\r\n var tmp;\r\n\r\n tmp = tokStart;\r\n tokStart = lastEnd;\r\n lastEnd = tmp;\r\n\r\n tmp = tokStartLoc;\r\n tokStartLoc = lastEndLoc;\r\n lastEndLoc = tmp;\r\n\r\n return finishNode(startNode(), \"XJSEmptyExpression\");\r\n }", "function NullExpression() {\n}", "function parseJSXEmptyExpression() {\n if (tokType !== _braceR) {\n unexpected();\n }\n\n var tmp;\n\n tmp = tokStart;\n tokStart = lastEnd;\n lastEnd = tmp;\n\n tmp = tokStartLoc;\n tokStartLoc = lastEndLoc;\n lastEndLoc = tmp;\n\n return finishNode(startNode(), \"JSXEmptyExpression\");\n }", "function YourMommaparseStringExpr()\n {\n\n\t//If a StringExpr follows an operator then it is an error\n\tif(inIntExpr == true)\n\t{\n\t\terrorCount++;\n\t\tputMessage(\"\\n ERROR: YOUR MOMMA IS SO DUMB, SHE CAN'T WRITE A VALID INTEGER EXPRESSION\\n.\");\n\n\t}\n\n\t//Creates a stringExpr node in the AST\n\tast.makeNode( \"stringExpr\", \"null\" ,\"NonTerminal\", scope.depth);\n\n\n\tYourMommacheckToken(\"quote\");\n\n\n\t//Ensure that there are only characters between quotes\n\tif (currentToken.Type == \"char\" || currentToken.Type == \"space\" )\t\n\t{\t\n\n\t YourMommaparseCharList();\n\n\t} \n\n\tYourMommacheckToken(\"quote\");\n\n\tast.moveUpTree();\n\n }", "isEmpty() {\n return (!this.name_ && !this.expressions_.length);\n }", "montaString() {\n let st = this.state\n let r = \"\"\n for (let i in st.calc) {\n r += \" \" + st.calc[i]\n }\n if (r.trim() !== \"\")\n return r.trim()\n if (r.trim() === \"\")\n return st.num\n }", "function evalIF(ast, env0){\n var ifStr=\"\";\n var cond= ast; //an targ node\n var doThen=ast.next;\n var doElse=ast.next.next;\n\n //get the value in cond\n var condValue=evalIText(cond.itext,env0);\n //if empty--> do else... \n //if non-empty --> do then\n if(condValue==null || condValue==\"\"){\n var tempStr=evalIText(doElse.itext,env0);\n ifStr=ifStr+tempStr;\n }\n else{\n var tempStr=evalIText(doThen.itext,env0);\n ifStr=ifStr+tempStr;\n }\n\n return ifStr;\n\n}", "function String$empty() {\n return '';\n }", "static empty(expressionTree) {\n return !expressionTree || !expressionTree.filteringOperands || !expressionTree.filteringOperands.length;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Tries to connect with the database. If a connection not can be made, it waits for a set amount of time set in the config. This function cannot be called multiple times if one one the calls has not succeeded (because of the globals tate of the tries variable)
function connectionLoop() { const { host, username, password, database, maxAmountOfTries, timeout } = config.database; return new Promise((resolve, reject) => { try { console.log( `Testing connection with database (attempt: ${tries + 1}/${maxAmountOfTries})` ); const knex = Knex({ client: "pg", connection: { user: username, host, password, database } }); console.log("Got connection with database"); tries = 0; resolve(knex); } catch (e) { console.error("Could not get connection", e); tries += 1; if (tries === maxAmountOfTries) { reject(new Error("Could not get connection")); tries = 0; } timeout(connectionLoop, 1000); } }); }
[ "function tryToConnectToDatabase() {\n tryConnectOptions.currentRetryCount += 1;\n winston.debug('Database connection try number: ' + tryConnectOptions.currentRetryCount);\n connect(function() {\n tryConnectOptions.resolve();\n }, function() {\n if (tryConnectOptions.currentRetryCount < tryConnectOptions.maxRetries) {\n setTimeout(tryToConnectToDatabase, tryConnectOptions.retryInterval);\n } else {\n tryConnectOptions.reject();\n }\n });\n}", "function attemptConnection() {\n // how many milliseconds we will wait until trying to connect again\n\n /* TODO: Exponential backoff instead? */\n\n var retryInterval = 8000;\n\n // The max number of times a connection will be attempted\n var retryLimit = 5;\n var numAttempts = 0;\n\n /** TODO: We should look into running web workers **/\n\n // create a function that will attempt to open a connection, and will retry\n // every retryInterval milliseconds until a connection is established\n // this function is immediately invoked\n (function tryOpeningConnection() {\n // start the connection opening process\n if (!that.isConnected && numAttempts < retryLimit) {\n numAttempts++;\n\n // close old connection\n if(that.conn){\n that.conn.close();\n }\n\n // open a new connection\n that.conn = that.peer.connect(that.dstId);\n\n // attach event listeners to our new connection\n setConnectionCallbacks();\n\n // schedule it to try again in a bit. This will only run\n // if our latest connection doesn't open\n setTimeout(tryOpeningConnection, retryInterval);\n }\n })();\n }", "function attemptConnection() {\n // how many milliseconds we will wait until trying to connect again\n\n /* TODO: Exponential backoff instead? */\n\n var retryInterval = 8000;\n\n // The max number of times a connection will be attempted\n var retryLimit = 5;\n var numAttempts = 0;\n\n /** TODO: We should look into running web workers **/\n\n // create a function that will attempt to open a connection, and will retry\n // every retryInterval milliseconds until a connection is established\n // this function is immediately invoked\n (function tryOpeningConnection() {\n // start the connection opening process\n if (!that.isConnected && numAttempts < retryLimit) {\n numAttempts++;\n\n // close old connection\n if (that.conn) {\n that.conn.close();\n }\n\n // open a new connection\n that.conn = that.peer.connect(that.dstId);\n\n // attach event listeners to our new connection\n setConnectionCallbacks();\n\n // schedule it to try again in a bit. This will only run\n // if our latest connection doesn't open\n setTimeout(tryOpeningConnection, retryInterval);\n }\n })();\n }", "function doConnect() {\n attemptCount++;\n attemptTimestamp = new Date();\n attemptSingleConnect().then(\n registerHandlersAndDomains, // succeded\n function () { // failed this attempt, possibly try again\n if (attemptCount < CONNECTION_ATTEMPTS) { //try again\n // Calculate how long we should wait before trying again\n var now = new Date();\n var delay = Math.max(\n RETRY_DELAY - (now - attemptTimestamp),\n 1\n );\n setTimeout(doConnect, delay);\n } else { // too many attempts, give up\n deferred.reject(\"Max connection attempts reached\");\n }\n }\n );\n }", "ConnectAndRetry(){\n\t\t// eShrug?\n\t\tlet that = this;\n\t\tif (this.attempts < 60){\n\t\t\tlet redactedURL = 'mongodb://' + this.username + ':<REDACTED>@' + this.host + ':27017/admin';\n\t\t\tconsole.info(\"[LIDLBot]\\tAttempting to connect (\" + this.attempts + \") to MongoloidDB: \" + redactedURL );\n\t\t\t// setting time out to occur once it fails only if the number of unsuccessful attempt hasn't been reached\n\t\t\tmongoose.connect(this.url,this.options);\n\t\t\tthis.connection.once('error', function(error) {\n\t\t\t\t\tthat.attempts++; \n\t\t\t\t\tconsole.error('[LIDLBot]\\t' + error);\n\t\t\t\t\t//need to bind this else it will get assigned to another thing during timeout i guess\n\t\t\t\t\t// either that or do something like this:\n\t\t\t\t\tsetTimeout( () => {that.ConnectAndRetry()},1000);\n\t\t\t\t\t});\n\t\t} else{\n\t\t\tconsole.warn(\"[LIDLBot}\\tCouldn't connect to MongoloidDB\");\n\t\t}\n\n\t}", "async connectMongo(connectionString, retries, delay, force = false) {\n let mongoErr\n let retry = 0;\n let mongoHost = require('url').parse(connectionString).host;\n\n while(true) {\n console.log(`### Connection attempt ${retry+1} to MongoDB server ${mongoHost}`)\n\n if(!this.db || force) {\n\n // Use await and connect to Mongo\n await this.MongoClient.connect(connectionString)\n .then(db => {\n // Switch DB to smilr, which will create it, if it doesn't exist\n this.db = db.db(this.DBNAME);\n console.log(`### Yay! Connected to MongoDB server`)\n })\n .catch(err => {\n mongoErr = err\n });\n }\n\n // If we don't have a db object, we've not connected - retry\n if(!this.db) {\n retry++; \n if(retry < retries) {\n console.log(`### MongoDB connection attempt failed, retrying in ${delay} seconds`);\n await utils.sleep(delay * 1000);\n continue;\n }\n }\n \n // Return promise, if we have a db, resolve with it, otherwise reject with error\n return new Promise((resolve, reject) => {\n if(this.db) { resolve(this.db) }\n else { reject(mongoErr) }\n });\n }\n }", "async connectMongo(connectionString, retries) {\n let err\n let retry = 0;\n let mongoHost = URL.parse(connectionString).host;\n\n while(true) {\n console.log(`### Connection attempt ${retry+1} to MongoDB server ${mongoHost}`)\n\n if(!this.db) {\n await this.MongoClient.connect(connectionString)\n .then(db => {\n // Switch DB and create if it doesn't exist\n this.db = db.db(this.DBNAME);\n console.log(`### Yay! Connected to MongoDB server`)\n })\n .catch(e => {\n err = e\n });\n }\n\n if(!this.db) {\n retry++; \n if(retry < retries) {\n console.log(`### MongoDB connection attempt failed, retying in 2 seconds`);\n await utils.sleep(2000);\n continue;\n }\n }\n \n return new Promise((resolve, reject) => {\n if(this.db) { resolve(this.db) }\n else { reject(err) }\n });\n }\n }", "function retryConnection() {\n\t//Reset the dbError global variable to its default state. If an error is encountered, dbError will again become true\n\tdbError = false;\n\tcheckHideShowError($(\"#noDB\"), $(\"#noDBTxt\"), dbError);\n\t\n\tpopulateMenuLists();\n}", "async _retryConnect() {\n // eslint-disable-next-line\n while (true) {\n try {\n await wait(this._retryTimeoutMs);\n await this._attemptConnect();\n return;\n } catch (ex) {\n this.emit(\"error\", ex);\n }\n }\n }", "function retryConnection() {\r\n setTimeout(reconnect.bind(this), this.retryDelay);\r\n }", "function delayedConnect(delay) {\n setTimeout(function() {\n mongoose.connect(mongoUri);\n }, delay);\n}", "async _connectToMongo() {\n\t\tconst collectionCacheKey = this._buildMongoCollectionCacheKey();\n\t\tif (this.mongoClient) {\n\t\t\t// we're already connected\n\t\t\treturn;\n\t\t}\n\t\telse if (collectionCacheKey && mongoConnections[collectionCacheKey]) {\n\t\t\tthis.logger.log('using cached mongo connection');\n\t\t\tthis.mongoClient = mongoConnections[collectionCacheKey].mongoClient;\n\t\t\tthis.db = mongoConnections[collectionCacheKey].db;\n\t\t\treturn;\n\t\t}\n\t\tthis.logger.log(`connecting to ${this.options.mongoUrl}`);\n\t\ttry {\n\t\t\tthis.mongoClient = await MongoClient.connect(this.options.mongoUrl, {\n\t\t\t\treconnectTries: 0,\n\t\t\t\tuseNewUrlParser: true,\n\t\t\t\tuseUnifiedTopology: true\n\t\t\t});\n\t\t\tthis.db = this.mongoClient.db();\n\t\t\tmongoConnections[collectionCacheKey] = {\n\t\t\t\tmongoClient: this.mongoClient,\n\t\t\t\tdb: this.db\n\t\t\t};\n\t\t}\n\t\tcatch (error) {\n\t\t\tthis.logger.warn(`mongo connect error '${error}'. Will retry...`);\n\t\t\tawait waitABit();\n\t\t\tawait this._connectToMongo(this.options.mongoUrl);\n\t\t}\n\t}", "attemptConnection() {\n const _self = this;\n\n // Update the tracking information.\n _self.connectionEstablished = false;\n _self.connectionRetryAttempts += 1;\n\n // If we haven't reached the retry limit, then try again after waiting a few seconds.\n if (_self.connectionRetryAttempts < 10) {\n setTimeout(() => {\n _self.emitter.emit('bridgeRetry');\n }, 6000);\n } else {\n _self.emitter.emit('bridgeTimeout');\n }\n }", "_reconnect() {\n clearTimeout(this.reconnectTimeout)\n this.reconnectTimeout = setTimeout(() => {\n this.reconnectTries++\n this.connect(this.params)\n this._reconnect()\n }, this._reconnectInterval())\n }", "function initConnectTimeout() {\n\t\tvar self = this;\n\t\tsetTimeout(function() {\n\t\t\t// Leader role only\n\t\t\tif (self.config.initiate && self.isConnected === false) {\n\t\t\t\tif (self.retriesLeft > 0) {\n\t\t\t\t\tself.retriesLeft--;\n\t\t\t\t\tself.debugLog('CONNECTION TIMED OUT, RESTARTING. TRIES LEFT:', self.retriesLeft);\n\t\t\t\t\t// Reset\n\t\t\t\t\tself.resetPeerConn();\n\t\t\t\t\tself.sendOffer();\n\t\t\t\t} else {\n\t\t\t\t\t// Give up\n\t\t\t\t\tself.debugLog('CONNECTION TIMED OUT, GIVING UP');\n\t\t\t\t\tself.resetPeerConn();\n\t\t\t\t\t// ^ resets but doesn't terminate - can try again with sendOffer()\n\t\t\t\t}\n\t\t\t}\n\t\t}, this.config.retryTimeout);\n\t}", "function tryReconnect() {\n\n// Register the reconnect handler to be triggered after 5 seconds\n setTimeout(function () {\n log.debug(\"Trying to reestablish the connection to the AddLive Streaming \" +\n \"Server\");\n\n// 1. Define the result handler\n var succHandler = function () {\n log.debug(\"Connection successfully reestablished!\");\n postConnectHandler();\n };\n\n// 2. Define the failure handler\n var errHandler = function () {\n log.warn(\"Failed to reconnect. Will try again in 5 secs\");\n tryReconnect();\n };\n// 3. Try to connect\n var connDescriptor = genConnectionDescriptor(scopeId, userId);\n ADL.getService().connect(ADL.createResponder(succHandler, errHandler),\n connDescriptor);\n }, 5000);\n\n }", "function manageConnection() {\n db = mysql.createConnection(config[env].db);\n\n db.connect(function (err) {\n if (err) {\n console.log(\"Error in MySQL connection: \", err);\n setTimeout(manageConnection, 2000);\n }\n });\n\n db.on(\"error\", function (err) {\n if (\"PROTOCOL_CONNECTION_LOST\" === err.code) {\n manageConnection();\n }\n else {\n throw err;\n }\n });\n}", "function getDBConnection(resolve, attempt=1) {\n try {\n console.log(`Connecting to db, attempt ${attempt}`);\n let connection = new Sequelize(process.env.POSTGRES_URI);\n console.log(\"Connection succesful!\");\n resolve(connection);\n\n } catch(err) {\n console.log(\"Could not connect to db, retrying in 5 seconds\");\n setTimeout(() => {\n getDBConnection(resolve, ++attempt);\n }, 5000);\n }\n}", "_setupReconnect () {\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout)\n this.reconnectTimeout = null\n }\n\n if (this.currentRetries >= this.options.retriesAmount)\n return\n\n this.reconnectTimeout = setTimeout(this._reconnect.bind(this), 1000)\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Register a single REST endpoint with the RestAPI endpoint
function _registerRESTEndpoint(resource, endpoint, address) { if ( endpoint && typeof endpoint == 'object') { bus.publish('restapi.register', { "resource": resource, endpoint: endpoint.path, method: endpoint.method.toUpperCase(), expects: endpoint.expects, produces: endpoint.produces, address: address }) } else { throw "REST ENDPOINT REGISTRATION FAILED: Invalid parameter passed to register a REST endpoint!"; } }
[ "static registerEndpoint(module, endpoint, definition){\n this.modules || (this.modules = {});\n this.modules[module] || (this.modules[module] = { endpoints: {} });\n this.modules[module].endpoints[endpoint] = definition;\n\n // Create meteor method\n var methodDefinition = {};\n methodDefinition[module + '_' + endpoint] = function(params){\n\n // Make sure the method doesn't get any extra parameters\n var passedParams = {};\n\n // The user id to be passed to the api endpoint\n var userId;\n\n // Manage access token\n if (definition.accessTokenRequired) {\n if (params.accessToken) {\n var decodedToken = jwt.verify(params.accessToken, config.security.encryptionKey);\n if (!decodedToken){\n throw new Meteor.Error(\"Invalid access token!\");\n }\n userId = decodedToken.userId;\n if (! Meteor.findOne({_id: userId}, {fields: {_id: 1}})) {\n throw new Meteor.Error(\"This access token belongs to a deleted user!\");\n }\n delete(params.accessToken);\n } else {\n userId = Meteor.userId();\n if (!userId) {\n throw new Meteor.Error(\"You are not logged in and have not provided an access token!\");\n }\n }\n } else {\n userId = Meteor.userId();\n }\n\n // Validate params\n for (let key in definition.params) {\n if (definition.params[key].schema) {\n check(params[key], definition.params[key].schema);\n }\n passedParams[key] = params[key];\n }\n\n // Run the API endpoint\n return definition.callback.apply(this, [passedParams, userId]);\n };\n\n Meteor.methods(methodDefinition);\n }", "async function register() {\n const service = {\n name: \"restaurant\",\n host: \"localhost\",\n port: \"3002\",\n endpoints: [\n {\n method: 'GET',\n endpoint: '/order-list',\n parameters: []\n },\n {\n method: 'GET',\n endpoint: '/receive-order',\n parameters: ['idrest', 'idmenu', 'dir', 'phone']\n },\n {\n method: 'GET',\n endpoint: '/state-order',\n parameters: ['idpedido']\n },\n {\n method: 'GET',\n endpoint: '/report-delivery-man',\n parameters: ['idpedido']\n }\n ]\n }\n\n await fetch('http://localhost:3000/api/esb/add-service', {\n method: 'post',\n body: JSON.stringify(service),\n headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }\n })\n .then(res => {\n return res.json();\n })\n .then(json => {\n console.log(\"registered service\");\n });\n}", "registerEndpoint(request, fn : any, socket : SocketIO.Socket) {\n if (! request.endpoint_id) {\n debug('register endpoint: endpoint_id not specified');\n fn({ error: \"endpoint_id not specified\"});\n return;\n }\n\n debug(`endpoint ${request.endpoint_id} registered on socket ${socket.id}`);\n socket[\"endpoint_id\"] = request.endpoint_id;\n }", "async function register() {\n const service = {\n name: \"client\",\n host: \"localhost\",\n port: \"3001\",\n endpoints: [\n {\n method: 'GET',\n endpoint: '/order-list',\n parameters: []\n },\n {\n method: 'GET',\n endpoint: '/request-order',\n parameters: ['idrest', 'idmenu', 'dir', 'phone']\n },\n {\n method: 'GET',\n endpoint: '/state-restaurant',\n parameters: ['idpedido']\n },\n {\n method: 'GET',\n endpoint: '/state-delivery',\n parameters: ['idpedido']\n }\n ]\n }\n\n await fetch('http://localhost:3000/api/esb/add-service', {\n method: 'post',\n body: JSON.stringify(service),\n headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }\n })\n .then(res => {\n return res.json();\n })\n .then(json => {\n console.log(\"registered service\");\n });\n}", "_linkEndpoint(endpoint) {\n this.endpoints.push(endpoint);\n }", "registerEndpoint(fn, options)\n {\n if (!fn) throw new Error('Must include a function to register endpoint');\n\n options.modelName = this.modelName;\n const endpoint = buildEndpoint(this, options, fn);\n if (!options.private) this.publicEndpoints.push(endpoint);\n this[options.name] = fn;\n }", "addPingEndpoint() {}", "addEndpointRequestHandler(){\n console.log('add request')\n }", "function addEndpoint(endpoint, count, config, dependencies) {\n var $endpoint = endpoint,\n i = 0,\n data,\n deps = [];\n count = +count || 15;\n while (hasEndpoint($endpoint)) {\n $endpoint = endpoint + '_' + ++i;\n }\n dependencies.forEach(function(dependency) {\n if(!_endpoints[dependency]) {\n return;\n }\n deps.push(_endpoints[dependency]);\n });\n if (typeof(config) === 'string') {\n data = generator.fromKey(config, count, deps);\n } else {\n data = generator.fromConfig(config, count, deps);\n }\n _endpoints[$endpoint] = {\n data: data,\n config: config\n };\n\n return $endpoint;\n }", "function add(object) {\r\n var appContext = null;\r\n var uuid = null;\r\n if (object) {\r\n properties = Object.keys(object);\r\n appContext= object.appContext;\r\n uuid = object.id;\r\n if (registry.hasOwnProperty(appContext)) {\r\n var eps = Object.keys(registry[appContext]);\r\n if (eps.length === 1 && singleEndpoint) {\r\n return registry[appContext][eps[0]];\r\n } else {\r\n registry[appContext][uuid] = object;\r\n return registry[appContext][uuid];\r\n }\r\n } else {\r\n // Create context, add endpoint\r\n registry[appContext] = {};\r\n registry[appContext][uuid] = object;\r\n return registry[appContext][uuid];\r\n }\r\n } else {\r\n return null;\r\n }\r\n }", "function _api (endpoint, callback) {\r\n endpoint = endpoint.replace(/^\\/+/, '').replace(/\\/+$/, '');\r\n _get(_default_host + endpoint, callback);\r\n }", "function agregarendpoint(nuevoendpoint) {\n endpoints.push(nuevoendpoint);\n}", "setApiEndpoint(apiEndpoint) {\n this.apiEndpoint = apiEndpoint;\n }", "function add(object) {\n var appContext = null;\n var uuid = null;\n if (object) {\n properties = Object.keys(object);\n appContext= object.appContext;\n uuid = object.id;\n if (registry.hasOwnProperty(appContext)) {\n var eps = Object.keys(registry[appContext]);\n if (eps.length === 1 && singleEndpoint) {\n return registry[appContext][eps[0]];\n } else {\n registry[appContext][uuid] = object;\n return registry[appContext][uuid];\n }\n } else {\n // Create context, add endpoint\n registry[appContext] = {};\n registry[appContext][uuid] = object;\n return registry[appContext][uuid];\n }\n } else {\n return null;\n }\n }", "function RestEndpoint(method, path, provider){\n this.method = method;\n this.path = path;\n this.provider = provider;\n}", "function registerResource(resource, basePath) {\n // register a route for each resource method\n resource.methods.forEach(function mth(method) {\n var url = basePath + resource.relativeUri;\n url = url.replace(/{([^}]+)}/ig, \":$1\");\n\n console.log(\"Registering route \" + method.method.toUpperCase() + \" \" + url);\n app[method.method](url, handler(resource, method));\n });\n\n // register any child resources if present\n if (resource.resources) {\n resource.resources.forEach(function(child) {\n registerResource(child, basePath + resource.relativeUri);\n });\n }\n}", "addEndpointResponseHandler(){\n console.log('add response')\n }", "registerAPIRoutes() {\n this._router = require(\"./src/apis/index\");\n this._router.setRoutes(this.app); \n }", "if (baseConfig.endpoint !== null) {\n if (typeof baseConfig.endpoint === 'string') {\n const endpoint = clientConfig.getEndpoint(baseConfig.endpoint);\n\n if (!endpoint) {\n throw new Error(`There is no '${baseConfig.endpoint || 'default'}' endpoint registered.`);\n }\n client = endpoint;\n } else if (baseConfig.endpoint instanceof HttpClient) {\n client = new Rest(baseConfig.endpoint);\n }\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Flash image for a set amount of time, originally a fraction of a second, progressively longer as time proceeded, originally simple abstracts, becoming more elaborate
function flashImage(){ document.getElementById('flash').innerHTML="<img src='http://lorempixel.com/600/400/'>" // 5000 = 5 secs setTimeout(function() {document.getElementById('flash').innerHTML='';},3000); }
[ "function flashimage(){\n\t\tif (g3==0){\n\t\t\tsauronflash();\n\t\t\t$(\"#timeleft\").css(\"display\",\"none\");\n\t\t\t$(\"#timeleftsec\").css(\"display\",\"none\");\n\t\t\t// $(\"#questionarea\").css(\"display\",\"none\");\n\t\t\tsetTimeout(restore,flashduration);\n\t\t}\n\t\telse if (g3==1){\n\t\t\tbilboflash();\n\t\t\t$(\"#timeleft\").css(\"display\",\"none\");\n\t\t\t$(\"#timeleftsec\").css(\"display\",\"none\");\n\t\t\t// $(\"#questionarea\").css(\"display\",\"none\");\n\t\t\tsetTimeout(restore,flashduration);\n\t\t}\n\t}", "function timeFn() {\n //take screenshot\n handleScreenshot(function(img) {\n img = \"data:image/png;base64,\" + img;\n var image = new Image();\n image.src = img;\n image.onload = function() {\n var canv = document.getElementById('gifit');\n canv.width = tributary.sw;\n canv.height = tributary.sh;\n var ctx = canv.getContext('2d');\n ctx.drawImage(image, 0, 0);\n tributary.__frames__.unshift(img);\n renderFrames()\n };\n\n })\n timer = setTimeout(timeFn, duration);\n }", "function flash() {\n if (blackout.style.display === \"none\") {\n blackout.style.display = \"\";\n } else {\n blackout.style.display = \"none\";\n }\n if (imgSwap == 1) {\n img = document.querySelector(\"#gradient1\");\n } else if (imgSwap == 3) {\n img = document.querySelector(\"#gradient2\");\n }\n imgSwap = (imgSwap + 1) % 4;\n setTimeout(flash, 650);\n}", "function time()\n{\n\tmyvar = setTimeout(changeimgback, 300); //Calls to changeimgback() in 300 miliseconds.\n}", "function startLoop() {\n id = setTimeout(changeImage, 3500);\n}", "function flash () {\n\t\t\n\t\tif (flashDelay > 8) {\n\t\t\tflashDelay = 1;\n\t\t}\n\n\t\tif(OTColor === 'red') {\n\t\t\t$timer.css('color', 'white');\n\t\t\tOTColor = 'white';\n\t\t} else if (flashDelay < 5){\n\t\t\t$timer.css('color', 'red');\n\t\t\tOTColor = 'red';\n\t\t}\n\n\t\tflashDelay++;\n\t}", "function timeFlash(i){\n\t setTimeout(function(){\n // var speed = 2000;\t \n if (pattern[i] == yellow){\n function flash() {\n $('.yellow').fadeOut(500);\n $('.yellow').fadeIn(500);\n }\n setTimeout(flash, 1000);\n }\n \n \n if (pattern[i] == green){\n function flash() {\n $('.green').fadeOut(500);\n $('.green').fadeIn(500);\n }\n setTimeout(flash, 1000);\n }\n \n if (pattern[i]==blue){\n function flash() {\n $('.blue').fadeOut(500);\n $('.blue').fadeIn(500);\n }\n setTimeout(flash, 1000);\n }\n \n if (pattern[i]== red){\n function flash() {\n $('.red').fadeOut(500);\n $('.red').fadeIn(500);\n }\n setTimeout(flash, 1000);\n }\n // speed here is multipled by the number of iterations in order to time flashes\n\t }, speed * i);\n\t \n }", "function setDelay(i) {\r\n\r\n // random sequence of holes with an animate and sound of moles\r\n setTimeout(function() {\r\n var randomHole = Math.floor(Math.random() * 6);\r\n randomChosenHole = holeHumber[randomHole];\r\n animateMole(randomChosenHole);\r\n playSoundOfMole(randomChosenHole);\r\n click();\r\n }, i * 3000);\r\n\r\n // after the last appearance of moles for the restart of a game\r\n setTimeout(function() {\r\n startAgain();\r\n $(\"img\").remove();\r\n var lastAction = 55.458; // i(the bigger var i) + var coefficient(acceleration coefficient for the appearance of moles)\r\n }, 55.458 * 3000);\r\n\r\n}", "function fiveTime(t)\n{\n \n if(t<5){\n flash(1);\n flash(2);\n flash(3);\n flash(4);\n t++;\n \n window.setTimeout(function(){fiveTime(t);}, 1000);\n }\n}", "flashScreen(length)\n {\n if(this.flashTween != null) \n {\n this.flashTween.stop();\n }\n this.flashSprite.bringToTop();\n this.flashSprite.alpha = 0.5;\n game.time.events.add(Phaser.Timer.SECOND * length, function(){this.flashSprite.alpha = 0;}, this);\n }", "function setImage(){\n //using setTimeout method and recursively calling itself, to loop.\n setTimeout(function(){setImage()}, 4000);\n getImage();\n\n }//end setImage function", "async function delayFlash(array){\n for(let i=0; i<array.length; i++){\n await window.setTimeout(flashColor, interval *i, array[i])\n }\n}", "function GamePatternImg()\n{\n\tGameSound() //Calls to GameSound() so that the game pattern when display, will have sound.\n\tdocument.getElementById(Game[z]).src= 'images/clicked' + Game[z] + '.jpg'; //Changes the image to an clicked state.\n\tsetTimeout(GamePatternEndImg, 300); //Calls to GamePatternEndImg() after 300 miliseconds.\n}", "function flashField(element)\n{\n Animation.queue({ backgroundColor : new Color(140, 66, 69) }, element, 500);\n Animation.queueDelayed({ backgroundColor : new Color(100, 66, 69) }, element, 500, 500);\n}", "function GamePatternTimer()\n{\n\tsetTimeout(GamePatternImg, 300); //Calls to GamePatternImg() after 300 miliseconds.\n}", "function flash(sprite){\n\n\t//creates the fade out white\n\tgame.time.events.repeat(125,16,function(){\n\n\t\tif(sprite.alpha == 0){\n\t\t\tsprite.alpha = 1;\n\t\t}\n\t\telse if(sprite.alpha == 1){\n\t\t\tsprite.alpha = 0;\n\t\t}\n\t\t\n\t},this);\n}", "function sauronflash(){\n\t$(\"body\").css(\"background-image\",\"url(assets/images/eyeofsauron2.jpg\");\n\t$(\"body\").css(\"background-size\",\"100% 100%\");\n\t$(\"#screen\").css(\"display\",\"none\"); \n\teyesound.play();\n\tsetTimeout(saurongone,flashduration);\n}", "function displayInstruction() {\n\n\n // text instruction will be displayed for 10s;\n if (time < 600) {\n instruction(190, 140);\n time++;\n\n }\n\n // text fade out 1: after 10s fade the color of the text and the background\n // this stays on screen for about 3s.\n if (time >= 600 && time < 800) {\n instruction(180, 145);\n time++;\n\n }\n\n // text fade out 2: after 13s fade the color of the text and the background a bit more\n // this stays on screen for about another 3s. \n // Then the instruction disappears.\n if (time >= 800 && time < 1000) {\n instruction(170, 150);\n time++;\n\n }\n\n}", "function victoryFanfare(){\n\t\tplaySound(2);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(0);\n\t\t},400);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(1);\n\t\t},800);\n\t\tsetTimeout(function(){\n\t\t\tplaySound(3);\n\t\t},1200);\n\t}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
mock slot count response
async fetchSlotsResponse(/*page, dateString*/) { const slotCount = sequence.next().value; slotTotal += slotCount; return slotCount; }
[ "static async count(slot){\n const count = await this.findAll({\n attributes: [[sequelize.fn('COUNT', sequelize.col('slot')), 'slots']],\n where: {\n slot: {\n [Op.eq]: moment(slot)\n }\n }\n });\n\n return count[0].dataValues.slots;\n }", "count(req, res){\n const ProxyEngineService = this.app.services.ProxyEngineService\n ProxyEngineService.count('Fulfillment')\n .then(count => {\n const counts = {\n fulfillments: count\n }\n return res.json(counts)\n })\n .catch(err => {\n return res.serverError(err)\n })\n }", "incrementSlotAvailability() {\n this.slotsAvailability++;\n }", "count(req, res){\n const ProxyEngineService = this.app.services.ProxyEngineService\n ProxyEngineService.count('Shop')\n .then(count => {\n const counts = {\n shops: count\n }\n return res.json(counts)\n })\n .catch(err => {\n return res.serverError(err)\n })\n }", "async function countEnrolls(sessionslot, sessionID) {\n var result;\n var query = {};\n query[sessionslot] = sessionID;\n var result = await User.find(query).count()\n return {\n 'id' : sessionID,\n 'count': result\n }\n}", "function test_getRequestCount() {\n assert.isNumber(hfapi.getRequestCount(), 'Total request count should be a number.');\n}", "_mockResPartnerGetNeedactionCount() {\n return this._getRecords('mail.notification', [\n ['res_partner_id', '=', this.currentPartnerId],\n ['is_read', '=', false],\n ]).length;\n }", "@computed\n get slotCount() {\n return this.visibleSlots.length;\n }", "function license_count(agent) {\n return licenseFetchCall('license_count')\n .then( function( message ){\n agent.add(`Number of `+ message);\n return Promise.resolve();\n })\n .catch( function( err ){\n agent.add(`Uh oh, something happened.`);\n return Promise.resolve(); // Don't reject again, or it might not send the reply\n });\n }", "function buyStickerSlot(){\n playerState.base.totalSlots += 1;\n }", "function test_sui_test_snapshot_count() {}", "getSlotNumber(){return this.currentSlots;}", "countRequest(req, res) {\n const method = req.method\n const path = req.originalUrl\n const code = res.statusCode\n\n const keyMP = `${method}\\t${path}`\n const keyMPC = `${method}\\t${path}\\t${code}`\n\n this.total++\n this.codes.add(code)\n\n if (!this.countByMP.has(keyMP)) {\n this.countByMP.set(keyMP, 0)\n }\n this.countByMP.set(keyMP, this.countByMP.get(keyMP) + 1)\n\n if (!this.countByMPC.has(keyMPC)) {\n this.countByMPC.set(keyMPC, 0)\n }\n this.countByMPC.set(keyMPC, this.countByMPC.get(keyMPC) + 1)\n }", "getAuctionCount() {\n return this.contract.methods\n .getAuctionCount()\n .call()\n .catch(error => {\n console.log(\"getAuctionCount() - error - \", error.message);\n });\n }", "function deductSlotCount() {\r\n\tvar value = parseInt($(\"#slot-count\").html());\r\n\tif (!isNaN(value)) {\r\n\t\tupdateSlotCount(value - 1);\r\n\t}\r\n}", "getCountOfItems() {\n const { getMystoreDetails } = this.props;\n const inventoryStatus = this.getInventoryStatus(getMystoreDetails);\n const { avl = [], unAvl = [] } = inventoryStatus;\n return { avl: avl.length || '0', unAvl: unAvl.length || '0' };\n }", "static async count() {\n const resp = await client.count({index: LISTINGS_INDEX, type: LISTINGS_TYPE})\n console.log(`Counted ${resp.count} listings in the search index.`)\n return resp.count\n }", "function countListRespondentInterpretResponse(djangoResponse) {\n\t\tnumListRespondentInTotal = djangoResponse['number_respondents'];\n\t}", "function test_count (s, e) {\n\ttest (s+' count is '+e, dsl(function () {\n\t\texpect (elt (s).count ()).toBe (e);\n\t}));\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Renders the AWS CloudFormation properties of an `AWS::WAFv2::RuleGroup.Count` resource
function cfnRuleGroupCountPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnRuleGroup_CountPropertyValidator(properties).assertSuccess(); return { CustomRequestHandling: cfnRuleGroupCustomRequestHandlingPropertyToCloudFormation(properties.customRequestHandling), }; }
[ "function getPropertyGroupCount()\n\t{\n\t\treturn propertyGroups.length;\n\t}", "function CfnRuleGroup_CountPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('customRequestHandling', CfnRuleGroup_CustomRequestHandlingPropertyValidator)(properties.customRequestHandling));\n return errors.wrap('supplied properties not correct for \"CountProperty\"');\n}", "function renderResourceCount(count) {\n var text = document.getElementById('resource_list_count');\n\n text.innerHTML = count.toString() + ' records found';\n}", "resourceCountLabel() {\n const first = this.perPage * (this.currentPage - 1)\n\n return (\n this.resources.length &&\n `${Nova.formatNumber(first + 1)}-${Nova.formatNumber(\n first + this.resources.length\n )} ${this.__('of')} ${Nova.formatNumber(this.allMatchingResourceCount)}`\n )\n }", "function cfnWebACLCountActionPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnWebACL_CountActionPropertyValidator(properties).assertSuccess();\n return {\n CustomRequestHandling: cfnWebACLCustomRequestHandlingPropertyToCloudFormation(properties.customRequestHandling),\n };\n}", "$count(propertyKey, options) {\n return this['count' + string_1.capitalize(propertyKey)](options);\n }", "function setPropertyGroupStats()\n\t{\n\t\tvar args = arguments;\n\t\tfor (var i = 0; i < args.length; i+=2) // Increment by 2!\n\t\t{\n\t\t\tvar propertyGroup = args[i];\n\t\t\tvar count = args[i+1];\n\t\t\tvar index = getPropertyGroupIndex(propertyGroup);\n\t\t\tif (index != null) // Lenience towards unknown propertyGroups.\n\t\t\t{\n\t\t\t\tpropertyGroupStatValues[index] = count;\n\t\t\t}\n\t\t}\n\t}", "function renderGroupCount1() {\n if(document.querySelector('#renderGroupCount1')) {\n document.querySelector('#renderGroupCount1')\n .innerHTML = countGroups(listUsers(), 'Manager');\n }\n}", "templateResultTotal() {\n return `<span>${this.countTotal}</span> streams found`\n }", "function ResultCount(props) {\r\n const { settings } = F$1(DataviewContext);\r\n return settings.showResultCount ? v$1(\"span\", { class: \"dataview small-text\" }, props.length) : v$1(d$1, null);\r\n}", "count() {\n let n = 0;\n for (const list of this.lists) {\n n += list.group.elements.length;\n }\n return n;\n }", "function getTotalRulesCount() {\n\n\t\t$.ajax({\n\t\t\ttype: \"GET\",\n\t\t\turl: \"/api/rules/count\",\n\t\t\tcontentType: \"application/json\",\n\t\t\tdataType: \"json\"\n\t\t})\n\n\t\t.done(function(d) {\n\t\t\ttot = d.total\n\t\t\t$(\"#rulesCounter\").html(\"Rules: \" + tot)\n\t\t})\n\n\t\t.fail(function(d) {\n\t\t\tconsole.log(\"getTotalRulesCount fail!\")\n\t\t});\n\t}", "function emitPropertyGroupStat(wnd)\n\t{\n\t\temitStatIOStatusMessage(wnd);\n\t\tvar sum = getObjectStatValueSum();\n\t\tif (sum > 0)\n\t\t{\n\t\t\tvar count = getPropertyGroupCount();\n\t\t\tvar indexes = new Array();\n\t\t\tvar values = new Array();\n\t\t\tvar descriptions = new Array();\n\t\t\n\t\t\tfor (var i = 0; i < count; i++)\n\t\t\t{\n\t\t\t\tvar value = getPropertyGroupStatValue(i);\n\t\t\t\tindexes[i] = i;\n\t\t\t\tvalues[i] = value;\n\t\t\t}\n\t\t\tsort(values, indexes, true);\n\t\t\t\tvar markup = \"<p>What topics have been given extra importance by the users of VoteMatch. The topics are listed below in declining order of importance.\";\n\t\t\t\t\t\t\t\n\t\t\tmarkup += \"<table>\" +\n\t\t\t\t\"<tr>\" +\n\t\t\t\t\t\"<th class='HistoHeader'>Topic</th>\" +\n\t\t\t\t\t\"<th nowrap class='HistoHeader' align='right'>Number</th>\" +\n\t\t\t\t\"</tr>\";\n\t\t\t\tfor (var i = 0; i < count; i++)\n\t\t\t{\n\t\t\t\tvar index = indexes[i];\n\t\t\t\tmarkup += \"<tr>\" +\n\t\t\t\t\t\"<td class='HistoLine'>\" + getPropertyGroupDesc(index) + \"</td>\" +\n\t\t\t\t\t\"<td class='HistoLineValue' align='right'>\" + values[i] + \"</td>\" +\n\t\t\t\t\"</tr>\";\n\t\t\t}\n\t\t\tmarkup += \"</table>\";\n\t\t\twnd.document.write(markup);\n\t\t}\n\t}", "count() {\n let n = 0;\n for (const group of this.groups) {\n n += group[1].elements.length;\n }\n return n;\n }", "function ResultCount$1(props) {\r\n const { settings } = F$1(DataviewContext);\r\n return settings.showResultCount ? (v$1(\"span\", { class: \"dataview small-text\" }, Groupings.count(props.item.rows))) : (v$1(d$1, null));\r\n}", "styleCount(){\n const{count} = this.state;\n return count === 0 ? 'No Items':count;\n }", "function wpcfFieldsFormCountOptions(obj) {\n var count = wpcfGetParameterByName('count', obj.attr('href'));\n count++;\n obj.attr('href', obj.attr('href').replace(/count=.*/, 'count='+count));\n}", "[setCountString]() {\n\t\tconst self = this;\n\t\tlet displayString = '';\n\n\t\tself.groupSuffixes().forEach((suffix, index) => {\n\t\t\tdisplayString += ' ' + (self.groupCounts()[index] || 0) + ' ' + suffix;\n\t\t});\n\n\t\tif (displayString !== '') {\n\t\t\tdisplayString += SPACER;\n\t\t}\n\n\t\tif (self.filterCount() !== self.count()) {\n\t\t\tdisplayString += self.filterCount() + ' of ';\n\t\t}\n\n\t\tdisplayString += self.count() + ' ' + self.countSuffix();\n\n\t\tself[FOOTER_RIGHT].content(displayString);\n\t}", "function CfnWebACL_CountActionPropertyValidator(properties) {\n if (!cdk.canInspect(properties)) {\n return cdk.VALIDATION_SUCCESS;\n }\n const errors = new cdk.ValidationResults();\n if (typeof properties !== 'object') {\n errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties)));\n }\n errors.collect(cdk.propertyValidator('customRequestHandling', CfnWebACL_CustomRequestHandlingPropertyValidator)(properties.customRequestHandling));\n return errors.wrap('supplied properties not correct for \"CountActionProperty\"');\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flushAppendBuffer() content is buffered because it must be written all at once see append(content)
function flushAppendBuffer(){ $('#fp_wrapper').append(appendBuffer); appendBuffer = ""; }
[ "function append(content){\n\tappendBuffer += content;\t\n}", "_flush() {\n this.push(this.contents);\n this.emit('end')\n }", "function flushBuffer() {\n refresh(buffer);\n buffer = [];\n }", "_flush(done) {\n let buf;\n if (this.lastByte === 0x0a) {\n buf = Buffer.from('.\\r\\n');\n } else if (this.lastByte === 0x0d) {\n buf = Buffer.from('\\n.\\r\\n');\n } else {\n buf = Buffer.from('\\r\\n.\\r\\n');\n }\n this.outByteCount += buf.length;\n this.push(buf);\n done();\n }", "flush() {\n this.emit('data', this.buffer.slice(0, this.offset));\n this.buffer = Buffer.alloc(BUFFER_SIZE);\n this.offset = 0;\n }", "flushBuffer() {\n if (this.buffer.length === 0) {\n return;\n }\n // Privatize and clear the buffer.\n const buffer = this.buffer;\n this.buffer = [];\n this.logger.debug('TraceWriter#flushBuffer: Flushing traces', buffer);\n this.publish(`{\"traces\":[${buffer.join()}]}`);\n }", "function\nMessagingWidgetsRenderer_flushBuffer (amount)\n{\n if (messagesBuffer.length > 0) {\n if (amount < 0)\n amount = messagesBuffer.length;\n var fragment = document.createDocumentFragment();\n for (var i = 0; i < amount; i++) {\n if (messagesBuffer.length <= 0)\n break;\n\n var item = messagesBuffer.shift();\n new_message =\n MessagingWidgetsRenderer_messageNode (item, true);\n\n if (fragment.childNodes.length > 0)\n fragment.insertBefore(new_message, fragment.firstChild);\n else\n fragment.appendChild(new_message);\n }\n\n /* Restore scroll position */\n var savedScrollPos =\n document.body.scrollHeight - window.pageYOffset;\n document.body.insertBefore(fragment, document.body.firstChild);\n window.sizeToContent();\n window.scrollTo(0, (document.body.scrollHeight - savedScrollPos));\n }\n}", "flushBuffers() {\n this._xBuffer.flush();\n }", "pushBuffer() {\n if (this.html !== '') {\n this.serializedList.push(new Buffer(this.html));\n this.html = '';\n }\n }", "function append() {\n\t\t\tif (buffer.length) {\n\t\t\t\t// Write out text lines\n\t\t\t\tvar part = buffer.join('');\n\t\t\t\t// Filter out white space before real content if the <%-%> tag told us to do so:\n\t\t\t\tif (part && skipWhiteSpace) {\n\t\t\t\t\tpart = part.match(/\\s*([\\u0000-\\uffff]*)/);\n\t\t\t\t\tif (part)\n\t\t\t\t\t\tpart = part[1];\n\t\t\t\t\tskipWhiteSpace = false;\n\t\t\t\t}\n\t\t\t\tif (part) {\n\t\t\t\t\tif (templateTag)\n\t\t\t\t\t\ttemplateTag.buffer.push(part);\n\t\t\t\t\telse // Encodes by escaping \",',\\n,\\r\n//#ifdef RHINO\n\t\t\t\t\t\tcode.push('out.write(' + uneval(part) + ');');\n//#else // !RHINO\n\t\t\t\t\t\t// Do not rely on uneval on the client side, although it's\n\t\t\t\t\t\t// there on some browsers...\n\t\t\t\t\t\t// Unfortunatelly, part.replace(/[\"'\\n\\r]/mg, \"\\\\$&\") does\n\t\t\t\t\t\t// not work on Safari. TODO: Report bug:\n\t\t\t\t\t\tcode.push('out.write(\"' + part.replace(/([\"'\\n\\r])/mg, '\\\\$1') + '\");');\n//#endif // !RHINO\n\t\t\t\t}\n\t\t\t\tbuffer.length = 0;\n\t\t\t}\n\t\t}", "flushBuffer(startOffset, endOffset, typeIn) {\n let sb,\n i,\n bufStart,\n bufEnd,\n flushStart,\n flushEnd,\n sourceBuffer = this.sourceBuffer;\n if (Object.keys(sourceBuffer).length) {\n logger.log(`flushBuffer,pos/start/end: ${this.media.currentTime.toFixed(3)}/${startOffset}/${endOffset}`);\n // safeguard to avoid infinite looping : don't try to flush more than the nb of appended segments\n if (this.flushBufferCounter < this.appended) {\n for (let type in sourceBuffer) {\n // check if sourcebuffer type is defined (typeIn): if yes, let's only flush this one\n // if no, let's flush all sourcebuffers\n if (typeIn && type !== typeIn) {\n continue;\n }\n\n sb = sourceBuffer[type];\n // we are going to flush buffer, mark source buffer as 'not ended'\n sb.ended = false;\n if (!sb.updating) {\n try {\n for (i = 0; i < sb.buffered.length; i++) {\n bufStart = sb.buffered.start(i);\n bufEnd = sb.buffered.end(i);\n // workaround firefox not able to properly flush multiple buffered range.\n if (\n navigator.userAgent.toLowerCase().indexOf('firefox') !== -1 &&\n endOffset === Number.POSITIVE_INFINITY\n ) {\n flushStart = startOffset;\n flushEnd = endOffset;\n } else {\n flushStart = Math.max(bufStart, startOffset);\n flushEnd = Math.min(bufEnd, endOffset);\n }\n /* sometimes sourcebuffer.remove() does not flush\n the exact expected time range.\n to avoid rounding issues/infinite loop,\n only flush buffer range of length greater than 500ms.\n */\n if (Math.min(flushEnd, bufEnd) - flushStart > 0.5) {\n this.flushBufferCounter++;\n logger.log(\n `flush ${type} [${flushStart},${flushEnd}], of [${bufStart},${bufEnd}], pos:${this.media.currentTime}`\n );\n sb.remove(flushStart, flushEnd);\n return false;\n }\n }\n } catch (e) {\n logger.warn('exception while accessing sourcebuffer, it might have been removed from MediaSource');\n }\n } else {\n // logger.log('abort ' + type + ' append in progress');\n // this will abort any appending in progress\n // sb.abort();\n logger.warn('cannot flush, sb updating in progress');\n return false;\n }\n }\n } else {\n logger.warn('abort flushing too many retries');\n }\n logger.log('buffer flushed');\n }\n // everything flushed !\n return true;\n }", "function done(){ cb( buf.join( \"\\n\")) }", "_scheduleWriteBehindBufferFlush(){if(this._writeBehindBufferFlushTimeoutId){// Cancel any existing flush if there is one.\n window.clearTimeout(this._writeBehindBufferFlushTimeoutId);}this._writeBehindBufferFlushTimeoutId=window.setTimeout(this.flush.bind(this),this._writeBehindBufferFlushDelayMs);}", "flush() {\n if (!this.writeBuffer.length) return\n if (this.closed) return\n chrome.sockets.tcp.send(this.socketId, this.writeBuffer.shift(), (code)=>{\n if (code < 0) {\n console.error(\"tcp.send error:\", code)\n this.close()\n return\n }\n this.flush()\n })\n }", "flush() {\n if (\n \"closed\" !== this.readyState &&\n this.transport.writable &&\n this.writeBuffer.length\n ) {\n debug(\"flushing buffer to transport\");\n this.emit(\"flush\", this.writeBuffer);\n this.server.emit(\"flush\", this, this.writeBuffer);\n const wbuf = this.writeBuffer;\n this.writeBuffer = [];\n if (!this.transport.supportsFraming) {\n this.sentCallbackFn.push(this.packetsFn);\n } else {\n this.sentCallbackFn.push.apply(this.sentCallbackFn, this.packetsFn);\n }\n this.packetsFn = [];\n this.transport.send(wbuf);\n this.emit(\"drain\");\n this.server.emit(\"drain\", this);\n }\n }", "flushBuffer() {\n this._logMap.clear();\n }", "flush() {\n if (this.err !== null)\n throw this.err;\n if (this.usedBufferBytes === 0)\n return;\n try {\n Deno.writeAllSync(this.writer, this.buf.subarray(0, this.usedBufferBytes));\n }\n catch (e) {\n this.err = e;\n throw e;\n }\n this.buf = new Uint8Array(this.buf.length);\n this.usedBufferBytes = 0;\n }", "refreshBuffer(){\n\t\tconst data = this.buffer.cachedDiskContents;\n\t\tnull === data\n\t\t\t? this.setData(this.buffer.lines.join(\"\\n\"))\n\t\t\t: this.setData(data, true);\n\t}", "flush() {\n if (this.err !== null) throw this.err;\n if (this.usedBufferBytes === 0) return;\n try {\n Deno.writeAllSync(this.writer, this.buf.subarray(0, this.usedBufferBytes));\n } catch (e) {\n this.err = e;\n throw e;\n }\n this.buf = new Uint8Array(this.buf.length);\n this.usedBufferBytes = 0;\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Sync timeout how often to sync local reviews with server
get SYNC_TIMEOUT() { // once a minute return 1000 * 60; }
[ "syncReviews() {\n let self = this;\n if (navigator.onLine) {\n self._syncReviews();\n }\n window.setTimeout(self.syncReviews, self.SYNC_TIMEOUT);\n }", "function sync(){\n if ( pause )\n return;\n\n $http({\n method : 'GET',\n url : thread_sync_path\n })\n .success(function(response){\n var newTimestamp = response.lastTimestamp;\n\n // Check if the server returned a different timestamp\n if ( !lastTimestamp || lastTimestamp === -1 || newTimestamp > lastTimestamp ) {\n \n fetch();\n lastTimestamp = newTimestamp;\n } else {\n $timeout(sync, TIMER_DELAY);\n }\n\n }).error(function(error){\n console.log(\"Error occur while synching with server\");\n });\n }", "_syncTimeout() {\n const expires = jsCookie.get(this.name + '-expires')\n if (expires) {\n this._startTimeout(expires)\n }\n }", "static async syncReviews () {\r\n try {\r\n // Ping server to check for connection\r\n const ping = fetch(DBHelper.DATABASE_URL_REVIEWS)\r\n const pong = await (await ping)\r\n if (pong.ok === true) {\r\n // Fetch data from server\r\n const serverReviews = await (await ping).json()\r\n // Fetch data from IndexedDB\r\n const db = await idb.open('udacity-google-mws-idb', 1)\r\n const tx = db.transaction('reviews', 'readonly')\r\n const store = tx.objectStore('reviews')\r\n const reviews = await store.getAll()\r\n const post = review => {\r\n const params = {\r\n body: JSON.stringify(review),\r\n method: 'POST'\r\n }\r\n fetch(DBHelper.DATABASE_URL_REVIEWS, params)\r\n console.log(`Sync review for restaurant ID ${review.restaurant_id} by ${review.name}.`)\r\n }\r\n // Compare each review between IndexedDB and server. POST if not on server or updated in IndexedDB.\r\n reviews.forEach((review, i) => {\r\n const serverReview = serverReviews[i]\r\n if (!serverReview) { post(review) } else if (review.updatedAt !== serverReview.updatedAt) { post(review) }\r\n })\r\n }\r\n } catch (e) {\r\n throw Error(e)\r\n }\r\n }", "function syncData() {\n console.log(\"Syncing.....\");\n setTimeout(hwcSyncfunc.func.syncallhwcdetails, 1000 * 1);\n setTimeout(dcSyncfunc.func.syncformdailyusers, 1000 * 60 * 10);\n setTimeout(comSyncfunc.func.syncallcompensationdetails, 1000 * 60 * 20);\n setTimeout(pubSyncfunc.func.syncallformpublicitydata, 1000 * 60 * 30);\n}", "function syncUpdate() {\r\n fetch(\"http://www.fotoni.it/cgi-bin/timer?endMinutes=\"+endTime);\r\n}", "function syncMetadata() {\r\n\t\tvar syncProgress = retriever.getSyncProgress();\r\n\t\t// Checking for network state and sync progress, when sync progress is false and N/W is active then continue\r\n\t\t// to perform sync logic\r\n\t\tif (canvas.env.network.getState() == 'ACTIVE' && !syncProgress) {\r\n\t\t\tretriever.setSyncProgress(true);\r\n\t\t\t// Method to get the latest synctime from local client storage\r\n\t\t\tcanvas.metadata.getSyncTime(function(syncTime) {\r\n\t\t\t\tif (!cbx.isEmpty(syncTime)) {\r\n\t\t\t\t\tvar resultInMinutes = -1\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tvar localTime = new Date().getTime();\r\n\t\t\t\t\t\tvar minDiff = localTime - formatStringToDate(syncTime);\r\n\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t * This will get time difference in milliseconds\r\n\t\t\t\t\t\t */\r\n\t\t\t\t\t\t resultInMinutes = Math.round(minDiff / 60000);\r\n\t\t\t\t\t\t LOGGER.info('local sync time diff with synctime', resultInMinutes);\r\n\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\tLOGGER.error('Error While making the time difference ', err)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (resultInMinutes < 0 || resultInMinutes > canvas.metadata.syncMetadataTimeDiff) {\r\n\r\n\t\t\t\t\t\tLOGGER.log('synctime available-', cbx.encode(syncTime));\r\n\t\t\t\t\t\tif (canvas.env.network.getState() == 'ACTIVE') {\r\n\t\t\t\t\t\t\t// Getting the Synclist from local storage if time difference\r\n\t\t\t\t\t\t\t// elapses for more than a day right now for syncMetadataTimeDiff\r\n\t\t\t\t\t\t\t// configuration\r\n\t\t\t\t\t\t\tcanvas.metadata.getSyncList(function(containerList) {\r\n\t\t\t\t\t\t\t\tif (!cbx.isEmpty(containerList) && cbx.isArray(containerList)) {\r\n\r\n\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t// Success for validating the\r\n\t\t\t\t\t\t\t\t\t\t// metadata sync list\r\n\t\t\t\t\t\t\t\t\t\tvar successFnForMetadataList = function(result) {\r\n\t\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\tLOGGER.info('successFnForMetadataList ----------- ', result);\r\n\t\t\t\t\t\t\t\t\t\t\t\tif (!cbx.isEmpty(result.SEVER_SYNCTIME)) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tresultInMinutes = -1\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar minDiff = formatStringToDate(result.SEVER_SYNCTIME) - formatStringToDate(syncTime);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * This will get\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * time\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * difference in\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * milliseconds\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tresultInMinutes = Math.round(minDiff / 60000);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLOGGER.info('server sync time diff with synctime ', resultInMinutes);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLOGGER.error('Error While making the time difference ', err)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (resultInMinutes < 0 || resultInMinutes > canvas.metadata.syncMetadataTimeDiff) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcontainerList = result.SYNC_METADATA || [];\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tLOGGER.log('containerList ', containerList)\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (cbx.isArray(containerList) && containerList.length > 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * No\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * synctime\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * is\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * available\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * getting\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * the some\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * old time\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * to carry\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * the\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * metadata\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * update\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar d = new Date,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdformat = [d.getDate().padLeft(), (d.getMonth() + 1).padLeft(),'1970'].join('/') + ' ' + [\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t d.getHours().padLeft(),d.getMinutes().padLeft(),d.getSeconds().padLeft()\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ].join(':');\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdformat+ \"\";\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar valueArray = [];\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor (var i = 0; i < containerList.length; i++) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (cbx.isArray(containerList[i].data) && containerList[i].data.length > 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar tempObj = {};\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar metadatagrp = containerList[i].data;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttempObj.type = containerList[i].type;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttempObj.synctime = containerList[i].synctime || dformat;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar keys = [];\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfor (var metadata = 0; metadata < metadatagrp.length; metadata++) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tkeys\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.push(metadatagrp[metadata].KEY);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttempObj.keys = keys;\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvalueArray\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.push(tempObj);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (valueArray.length > 0) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tshowMessageMask();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tvar params = {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'PAGE_CODE_TYPE': 'SYNC_METADATA_CODE',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_ACTION': 'SYNC_METADATA_CONFIRM',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_FUNCTION_CODE': 'VSBLTY',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_SUB_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'PRODUCT_NAME': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'JSON_TO_HASH_MAP_SUPPORT_FLAG': 'METADATA',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'__LISTVIEW_REQUEST': 'Y',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'METADATA': cbx\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.encode({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSYNCMETADATA: valueArray\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t})\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tretriever.getSyncMetaDataInfo(params, this, successFnForMetadata, failureFnForMetadata, false);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcanvas.metadata.updateSyncTime(result.SEVER_SYNCTIME);\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * hide\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * progress\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * and\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * tigger\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * hide\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * progress\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * and\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * tigger\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * hide progress\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * and tigger\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t * hide progress and\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t * tigger\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tclearMetaDataCacheForInvalidResponse(result);\r\n\t\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t\t * hide progress and\r\n\t\t\t\t\t\t\t\t\t\t\t\t * tigger\r\n\t\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t * Failure function while\r\n\t\t\t\t\t\t\t\t\t\t * getting the metadata synced\r\n\t\t\t\t\t\t\t\t\t\t * list\r\n\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\tvar failureFnForMetadataList = function(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tresult) {\r\n\t\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t\t * hide progress and tigger\r\n\t\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tvar params = {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'PAGE_CODE_TYPE': 'SYNC_METADATA_CODE',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_ACTION': 'SYNC_METADATA',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_FUNCTION_CODE': 'VSBLTY',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'INPUT_SUB_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'PRODUCT_NAME': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'__LISTVIEW_REQUEST': 'Y',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'JSON_TO_HASH_MAP_SUPPORT_FLAG': 'METADATA',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'METADATA': cbx\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.encode({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSYNCMETADATA: containerList\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\t\t\tretriever.getSyncMetaDataInfo(params, this, successFnForMetadataList, failureFnForMetadataList);\r\n\r\n\t\t\t\t\t\t\t\t\t} catch (err) {\r\n\t\t\t\t\t\t\t\t\t\tLOGGER.error('Error While setting MetadatCache', err);\r\n\t\t\t\t\t\t\t\t\t\t/*\r\n\t\t\t\t\t\t\t\t\t\t * hide progress and tigger\r\n\t\t\t\t\t\t\t\t\t\t * canvas.validateSyncReady\r\n\t\t\t\t\t\t\t\t\t\t */\r\n\t\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\t\tLOGGER.log('synclist ', cbx.encode(syncTime));\r\n\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\tLOGGER.log('synclist not avilable');\r\n\t\t\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t}, this);\r\n\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// tigger canvas.validateSyncReady\r\n\t\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// tigger canvas.validateSyncReady\r\n\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (iportal.systempreferences.isHybrid() === \"true\"/*iportal.systempreferences.getFramework() == \"jqm\"*/) {\r\n\t\t\t\t\t\tvar params = {\r\n\t\t\t\t\t\t\t\t\t'PAGE_CODE_TYPE': 'SYNC_METADATA_CODE',\r\n\t\t\t\t\t\t\t\t\t'INPUT_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t'INPUT_ACTION': 'INITIAL_METADATA',\r\n\t\t\t\t\t\t\t\t\t'INPUT_FUNCTION_CODE': 'VSBLTY',\r\n\t\t\t\t\t\t\t\t\t'INPUT_SUB_PRODUCT': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t'PRODUCT_NAME': 'CANVAS',\r\n\t\t\t\t\t\t\t\t\t'__LISTVIEW_REQUEST': 'Y'\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t\tshowMessageMask();\r\n\t\t\t\t\t\tretriever.getSyncMetaDataInfo(params, this, successFnForMetadata, failureFnForMetadata, false);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t// tigger canvas.validateSyncReady\r\n\t\t\t\t\t\tcompletedMetadataUpdate();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}, this);\r\n\r\n\t\t} else {\r\n\t\t\t// tigger canvas.validateSyncReady\r\n\t\t\tcompletedMetadataUpdate();\r\n\t\t}\r\n\t}", "timeSync() {\n this.timeSyncInterval = setInterval(() => { \n nem.com.requests.chain.time(this._Wallet.node).then((res) => {\n this._$timeout(() => {\n this._DataStore.chain.time = res.receiveTimeStamp / 1000;\n });\n },(err) => {\n this._$timeout(() => {\n this._Alert.errorGetTimeSync();\n });\n });\n }, 60 * 1000);\n }", "function checkAndSync() {\n\tvar googleFrequencyString = getSetting(\"google.frequency\"),\n\t dropboxFrequencyString = getSetting(\"dropbox.frequency\"),\n\t thetvdbFrequencyString = getSetting(\"thetvdb.frequency\"),\n\t now = new Date(),\n\t lastGoogleSyncEpoch,\n\t googleFrequency,\n\t difference,\n\t lastDropboxSyncEpoch,\n\t dropboxFrequency,\n\t lastTheTvDbSyncEpoch,\n\t thetvdbFrequency;\n\n if(googleFrequencyString !== undefined && googleFrequencyString !== null && googleFrequencyString !== \"0\") {\n\t lastGoogleSyncEpoch = localStorage.getItem(\"lastGoogleSync\");\n\t\tif(!googleAuth && lastGoogleSyncEpoch) {\n\t\t\t$(\"#googlemodal\").modal({minWidth:\"300\",maxWidth:\"300\"});\n\t\t}\t \n\t if(lastGoogleSyncEpoch == null) {\n\t lastGoogleSyncEpoch = 0;\n\t }\n googleFrequency = parseInt(googleFrequencyString);\n\t lastGoogleSync = new Date(parseInt(lastGoogleSyncEpoch));\n\t\tdifference = now - lastGoogleSync; \n\t\tdifference = difference / 60 / 1000; \n if(difference > googleFrequency) {\n\t syncGoogle();\n }\n }\n\t\t\n if(dropboxFrequencyString !== undefined && dropboxFrequencyString !== null && dropboxFrequencyString !== \"0\") {\n\t lastDropboxSyncEpoch = localStorage.getItem(\"lastDropboxSync\");\n\t if(lastDropboxSyncEpoch == null) {\n\t lastDropboxSyncEpoch = 0;\n\t }\n dropboxFrequency = parseInt(dropboxFrequencyString);\n\t lastDropboxSync = new Date(parseInt(lastDropboxSyncEpoch));\n\t\tdifference = now - lastDropboxSync; \n\t\tdifference = difference / 60 / 1000; \n if(difference > dropboxFrequency) {\n\t syncDropbox();\n }\n\n }\n\n if(thetvdbFrequencyString !== undefined && thetvdbFrequencyString !== null && thetvdbFrequencyString !== \"0\") {\n\t lastTheTvDbSyncEpoch = localStorage.getItem(\"lastTvDbSync\");\n\t if(lastTheTvDbSyncEpoch == null) {\n\t lastTheTvDbSyncEpoch = 0\n\t }\n thetvdbFrequency = parseInt(thetvdbFrequencyString);\n\t lastTheTvDbSync = new Date(parseInt(lastTheTvDbSyncEpoch));\n\t\tdifference = now - lastTheTvDbSync; \n\t\tdifference = difference / 60 / 1000;\n \n if(difference > thetvdbFrequency) {\n\t recache();\n }\n }\t\n\n}", "function setupTimeoutInterval() {\n if (intervalId) {\n clearInterval(intervalId);\n }\n\n intervalId = setInterval(() => {\n if (Date.now() - lastUpdateTime > minAspectTimeout * 2) {\n window.location.reload();\n }\n }, minAspectTimeout);\n}", "function continueInterventionTimeout(){\n timewaited = timewaited+tmoutwait;\n servletGet(\"InterventionTimeout\", {probElapsedTime: globals.probElapsedTime, destination: globals.destinationInterventionSelector, timeWaiting: timewaited+tmoutwait}, processInterventionTimeoutResult);\n}", "static get GitHubApiCachingTimeout () { return 5 * 60 * 1000; }", "requestTimeout() { return 3 * 60000; }", "_onReviewDone() {\n if (this.get('timerOn')) {\n this._stop({skipSave: true});\n }\n }", "function updateTimeout() {\n var d = new Date();\n var diff = timestampTimeout - d.getTime();\n timeout = Math.floor(diff / 1000);\n }", "function check(i){\n if(new Date().getTime()-last429<=1000 || new Date().getTime()-lastReq<=1000){\n setTimeout(check,1000+Math.random()*10000,i);\n return;\n }\n\n lastReq = new Date().getTime();\n https.get('https://euw.api.pvp.net/observer-mode/rest/consumer/getSpectatorGameInfo/EUW1/'+playerList.entries[i].playerOrTeamId+'?api_key='+api_key, function(res) { \n //console.log(res.statusCode);\n var body=\"\";\n res.on('data', function (chunk) {\n body+=chunk;\n });\n res.on('end', function (){ \n if(res.statusCode==200){\n var obj = JSON.parse(body);\n obj.gameStartTime = new Date(obj.gameStartTime);\n\n MongoClient.connect('mongodb://localhost:27017/ss', function(err, db) {\n var collection = db.collection(\"games\");\n collection.updateOne({'gameId':obj.gameId},obj, {upsert:true},function(err, result) {\n assert.equal(null, err);\n db.close();\n });\n });\n }\n }); \n switch(res.statusCode){\n case 404:\n responses++;\n //console.log(\"404 Not Found\"); \n console.log(responses+ \".\\tNo\\t\" + playerList.entries[i].playerOrTeamName);\n break\n case 429:\n rateErrorCount++;\n last429 = new Date().getTime();\n setTimeout(check,1000+Math.random()*10000,i);\n break;\n case 403: \n //setTimeout(check,Math.random()*20000,i);\n break;\n case 200:\n responses++;\n //console.log(\"200 Success\"); \n console.log(responses + \".\\tYes\\t\" + playerList.entries[i].playerOrTeamName);\n //console.log(playerList.entries[i].playerOrTeamName + \"\\t \" + playerList.entries[i].leaguePoints);\n break;\n default:\n console.log(res.statusCode);\n }\n\n\n }).on('error', function(e) {\n console.error(e);\n });\n}", "function bcbsri_timeout_update() {\n var url = \"/shop/application/auth/timeout-update\";\n var timeUpdate = $.ajax({type: 'POST', url: url, data: \"\", dataType: \"json\"});\n timeUpdate.done(function (data) {\n if(data.success) return true;\n else return false\n });\n}", "static updateServerReview(time, type, data, id){\r\n\r\n let fetchData;\r\n let URL;\r\n let postTime = time || Date.now();\r\n\r\n if (type == \"Post\"){\r\n URL = 'http://localhost:1337/reviews/';\r\n fetchData = {method: \"POST\", body: JSON.stringify(data)};\r\n }\r\n else if(type == \"Put\"){\r\n URL = 'http://localhost:1337/restaurants/'+ id +'/?is_favorite='+ data\r\n fetchData = {method: \"PUT\"}\r\n }\r\n\r\n fetch(URL, fetchData)\r\n .then(response => {\r\n if (response.status >= 200 && response.status < 300){\r\n document.getElementById(\"updatebar-text\").innerHTML = \"Updated!\"\r\n return;\r\n }\r\n else{\r\n document.getElementById(\"updatebar-text\").innerHTML = \"Update saved till online\"\r\n DBHelper.offlineCache(postTime, type, data, id)\r\n }\r\n })\r\n .catch(error => {\r\n console.error(error)\r\n document.getElementById(\"updatebar-text\").innerHTML = \"Update saved till online\"\r\n DBHelper.offlineCache(postTime, type, data, id)\r\n });\r\n }", "static syncReviews() {\r\n openDatabase().then(db => {\r\n let store = db.transaction('restaurants', 'readwrite').objectStore('restaurants');\r\n store.getAll().then(restaurants => {\r\n if (restaurants.length === 0) return;\r\n \r\n restaurants.forEach(restaurant => {\r\n if (!restaurant.reviews) return;\r\n \r\n for (let i = 0; i < restaurant.reviews.length; i++) {\r\n let review = restaurant.reviews[i]; \r\n if (review.synced == false) {\r\n DBHelper.syncReview(restaurant.id, review).then(response => {\r\n restaurant.reviews[i].synced = true;\r\n db.transaction('restaurants', 'readwrite').objectStore('restaurants').put(restaurant, restaurant.id);\r\n });\r\n }\r\n }\r\n });\r\n });\r\n });\r\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
curry5 :: ((a, b, c, d, e) > f) > a > b > c > d > e > f . . Curries the given quinary function. . . ```javascript . > const toUrl = S.curry5 ((protocol, creds, hostname, port, pathname) => . . protocol + '//' +
function curry5(f) { return function(v) { return function(w) { return function(x) { return function(y) { return function(z) { return f (v, w, x, y, z); }; }; }; }; }; }
[ "function curry4 (f) {\n function curried (a, b, c, d) { // eslint-disable-line complexity\n switch (arguments.length) {\n case 0: return curried\n case 1: return curry3(function (b, c, d) { return f(a, b, c, d); })\n case 2: return curry2(function (c, d) { return f(a, b, c, d); })\n case 3: return function (d) { return f(a, b, c, d); }\n default:return f(a, b, c, d)\n }\n }\n return curried\n }", "function curry4(f) {\n function curried(a, b, c, d) {\n // eslint-disable-line complexity\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return curry3(function (b, c, d) {\n return f(a, b, c, d);\n });\n case 2:\n return curry2(function (c, d) {\n return f(a, b, c, d);\n });\n case 3:\n return function (d) {\n return f(a, b, c, d);\n };\n default:\n return f(a, b, c, d);\n }\n }\n return curried;\n }", "function curry4(f) {\n function curried(a, b, c, d) {\n // eslint-disable-line complexity\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return curry3(function (b, c, d) {\n return f(a, b, c, d);\n });\n case 2:\n return curry2(function (c, d) {\n return f(a, b, c, d);\n });\n case 3:\n return function (d) {\n return f(a, b, c, d);\n };\n default:\n return f(a, b, c, d);\n }\n }\n return curried;\n}", "function curried(x) {\n return internal_1.curry(tuple)(x);\n}", "function curry2$3(f) {\n function curried(a, b) {\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return function (b) {\n return f(a, b);\n };\n default:\n return f(a, b);\n }\n }\n return curried;\n }", "function curry3(f) {\n function curried(a, b, c) {\n // eslint-disable-line complexity\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return curry2(function (b, c) {\n return f(a, b, c);\n });\n case 2:\n return function (c) {\n return f(a, b, c);\n };\n default:\n return f(a, b, c);\n }\n }\n return curried;\n }", "function curry3 (f) {\n function curried (a, b, c) { // eslint-disable-line complexity\n switch (arguments.length) {\n case 0: return curried\n case 1: return curry2((b, c) => f(a, b, c))\n case 2: return c => f(a, b, c)\n default:return f(a, b, c)\n }\n }\n return curried\n}", "function curry3$3(f) {\n function curried(a, b, c) {\n // eslint-disable-line complexity\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return curry2$3(function (b, c) {\n return f(a, b, c);\n });\n case 2:\n return function (c) {\n return f(a, b, c);\n };\n default:\n return f(a, b, c);\n }\n }\n return curried;\n }", "function curry3(f) {\n function curried(a, b, c) {\n // eslint-disable-line complexity\n switch (arguments.length) {\n case 0:\n return curried;\n case 1:\n return curry2(function (b, c) {\n return f(a, b, c);\n });\n case 2:\n return function (c) {\n return f(a, b, c);\n };\n default:\n return f(a, b, c);\n }\n }\n return curried;\n}", "function curry3 (f) {\n\t function curried (a, b, c) { // eslint-disable-line complexity\n\t switch (arguments.length) {\n\t case 0: return curried\n\t case 1: return curry2(function (b, c) { return f(a, b, c); })\n\t case 2: return function (c) { return f(a, b, c); }\n\t default:return f(a, b, c)\n\t }\n\t }\n\t return curried\n\t}", "function curry3 (f) {\n function curried (a, b, c) { // eslint-disable-line complexity\n switch (arguments.length) {\n case 0: return curried\n case 1: return curry2(function (b, c) { return f(a, b, c); })\n case 2: return function (c) { return f(a, b, c); }\n default:return f(a, b, c)\n }\n }\n return curried\n }", "function uncurry(f){\r\n return function(p){\r\n return f(p[0], p[1]);\r\n }\r\n}", "function higherOrder5(fn) {\n\treturn function(...args) {\n\t\tconsole.log('args', args);\n\t\treturn fn(...args);\n\t};\n}", "function curry(binary, first){ \n// takes a binary function and a first argument,\n// and returns a function that takes a second argument.\n// returns the result of calling the binary function with the first and second argument\n return function(second){\n return binary(first, second);\n }; \n}", "function curry(func){//ai function ta carry function er kase pathabo\n return function curried(...args){//variable number of args receive korbe ...args // ...args er modda (1, 2, 3) ai 3 ta agrs chole ashle ami ekta args array pabo\n if( args.length >= func.length){//arg .length = (curriedSum(1, 2, 3), func.length = sum(a, b, c)\n return func.apply(this, args);//ai func call korsi ai khane so args or ...args ai vabe pathate parbo na karon tahole sum er kase ekta array choly jabey\n //apply a 1st argument pathate hoi amr context ta ki mane kake diya function ta call korabo //this diya bojaci curent contex //apply normally function k call e kore but args gulo k variable akare pathasi so sum er variavle gula k koma seperate akare pabey\n }else{//akhon steping korbo ((1) (2) (3)) ai vabe pathanor jonno\n return function(...args2){//multiple steping //...args2 aita mane ami curried sum er modda koita pathasi\n return curried.apply(this, args.concat(args2));\n };\n }\n };\n}", "function curry2(binary, first) {\n return liftf(binary)(first);\n}", "function createCurryCalc() {\n var calcArgArray = [];\n\n return function curryCalc(...args){\n for (var i=0; i<args.length; i++){\n calcArgArray.push(args[i]);\n if (calcArgArray.length === 5) {\n return calcArgArray.reduce(function(sum, val) { return sum + val });\n }\n }\n return curryCalc;\n }\n}", "function curry(binary, first) {\n return function(second) {\n return binary(first, second);\n };\n}", "function curry2(f) {\n return function(x) {\n return function(y) {\n return f (x, y);\n };\n };\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
sync client assert ignore list
function __FIXME_SBean_assert_ignore_list() { this._pname_ = "assert_ignore_list"; //this.keywords: set[string] }
[ "async set_ignore_list(stub, list) {\n await this.config.set(stub + ':ignored', list);\n }", "async test_send_object_again(){\n let arrayList = new ArrayList();\n await this.socket1.root.setData(arrayList);\n Assert.equals(arrayList, await this.socket1.root.getData());\n }", "function checkOnList (){\n\n chrome.storage.sync.get(['list'], function(result){\n blacklist = result.list;\n\n // first init if empty\n if(blacklist === undefined){\n blacklist = [[],[]];\n chrome.storage.sync.set({'list': blacklist}, function(){});\n }\n\n if( blacklist[0].indexOf(trackID) > -1 ){\n console.log(\"skipped song \" + trackID);\n skipSong();\n }\n\n });\n\n }", "async set_ignore(params) {\n var schema = {\n stub: { required: 'string', format: 'lowercase' },\n symbol: { required: 'string', format: 'uppercase' },\n ignored: { required: 'boolean' }\n }\n\n if (!(params = this.utils.validator(params, schema))) return false; \n\n var [stub, symbol, ignored] = this.utils.extract_props(params, ['stub', 'symbol', 'ignored']); \n\n var list = await this.config.get(stub + ':ignored');\n if (this.utils.is_array(list)) {\n if (!list.includes(symbol)) {\n list.push(symbol);\n this.set_ignore_list(stub, list);\n }\n }\n \n\n\n }", "clearIgnoredUsers() {\n this._syncService.set({ ignoredUsers: [] });\n }", "async test_send_object(){\n let arrayList = new ArrayList();\n await this.socket1.root.setData(arrayList);\n Assert.equals(arrayList, await this.socket1.root.getData());\n }", "function reviewClients() {\r\n var removeList = [];\r\n for (var n in clients)\r\n if (clients[n].socket.disconnected)\r\n removeList.push(clients[n]);\r\n\r\n for (var i = removeList.length - 1; i >= 0; i--) {\r\n console.log(\"Removendo \" + removeList[i].cid);\r\n var idx = clients.indexOf(removeList[i]);\r\n if (idx != -1)\r\n clients.splice(idx, 1);\r\n sendtoall(\"playerdisconnected\", {\r\n cid: removeList[i].cid\r\n });\r\n }\r\n\r\n}", "function FalseSpecificationSync() {}", "async get_ignore_list(stub) {\n var markets = await this.trade.markets({stub: stub});\n var ignored = await this.config.get(stub + ':ignored');\n ignored = [null, false, ''].includes(ignored) ? [] : ignored.split(\",\");\n if (!this.utils.is_array(ignored)) ignored = [];\n var results = [];\n if (this.utils.is_array(markets)) {\n for(var i=0; i< markets.length; i++) {\n var market = markets[i];\n var symbol = market.symbol;\n var ignore = ignored.includes(symbol);\n results.push({ symbol: symbol, ignored: ignore});\n }\n }\n return results;\n }", "pollClients(force){\n\n // waiting for time delay for check to pass or if the force check\n // flag is true\n if(force || Date.now() - this.pollLastCheck >= this.polldelay){\n\n // updating last time since poll check\n this.pollLastCheck = Date.now();\n\n // iterating checking connections status by mapping over client\n // collection\n this._clients.map((client) => {\n // checking if client is connected\n if(!client.isConnected()){\n console.logDD('LOBBY',`Client ${client.id} has disconnected!`)\n // if disconnected splice out client from list of clients\n this._clients.remove(client.ip)\n }\n })\n\n // // iterating over clients\n // for(let ci = this.clients.length-1 ; ci >= 0 ; ci--){\n // let client = this.clients[ci];\n //\n // // checking if client has disconnected and isnt in a lobby\n // // as the lobby is no longer administrating this object\n // if(!client.isConnected()){\n //\n // console.logDD('LOBBY',`Client ${this.clients[ci].id} has disconnected!`)\n //\n // // if disconnected splice out client from list of clients\n // this.clients.splice(ci,1);\n // }\n // }\n\n }\n\n }", "onHandShacked(client) {\n super.onHandShacked(client);\n this.sharedObjects.forEach(sharedObject => {\n sharedObject.sendSyncCommand(client);\n });\n }", "function testNetworkListFilter() {\n // next call to gohan_http will return 'foo'\n gohan_http.Expect(\"GET\", \"/unwanted/network\", {}, null).Return(network2.id);\n // trigger post_list event on prepared context\n GohanTrigger('post_list', context);\n\n if (context.response.networks.length != 1) {\n Fail('Expected 1 network but %d networks found.',\n context.response.networks.length);\n }\n\n if (context.response.networks[0].id != network1.id) {\n Fail('Expected network with id \"%s\" but \"%s\" found.', network1.id,\n context.response.networks[0].id);\n }\n}", "function cleanupClusterClient(assert, callback) {\n var peers = cluster.client.peers.values();\n peers.forEach(function eachPeer(peer, i) {\n peer.connections.forEach(function eachConn(conn, j) {\n var pending = conn.ops.getPending();\n\n assert.equal(pending.in, 0, format(\n 'client peer[%s] conn[%s] should have no inReqs', i, j));\n assert.equal(pending.out, 0, format(\n 'client peer[%s] conn[%s] should have no outReqs', i, j));\n });\n });\n callback(null);\n }", "async function checkInData() {\n console.log(\"begin checkInData(). clientSchemaSubList.length=\" + clientSchemaSubList.length);\n\n let cmd = {};\n cmd.name = \"CHECK_IN_DATA\";\n cmd.value = null;\n await transport.writeCommand(cmd);\n\n // for each schema\n for (let clientSchemaSub of clientSchemaSubList) {\n let syncSchema =\n clientSchemaMap[clientSchemaSub.syncSchemaId];\n console.log(\"syncSchema.name=\" + syncSchema.name);\n\n // determine if schema is on sync list\n let isOnSyncList = false;\n for (let name of syncSummary.syncSchemaNames) {\n //console.log(\"name=\" + name);\n if (name.toUpperCase() == syncSchema.name.toUpperCase()) {\n isOnSyncList = true;\n break;\n }\n }\n if (!isOnSyncList) {\n console.log(\"Will skip schema \" + syncSchema.name +\n \" since it's not on sync list.\");\n continue;\n }\n\n let realm = realmMap[syncSchema.id];\n if (!realm) {\n throw new Error(\"Faild to find realm for schema \" + syncSchema.name);\n }\n\n console.log(\"Doing pre check in transaction id assignment for pervasync schema \" +\n syncSchema.name);\n\n if (!syncSchema.tableList) {\n syncSchema.tableList = [];\n }\n\n // update mTable transactionId\n for (let k = 0; k < syncSchema.tableList.length; k++) {\n let syncTable = syncSchema.tableList[k];\n let isSuperUser = false;\n if (syncTable.checkInSuperUsers) {\n for (let l = 0; l < syncTable.checkInSuperUsers.length; l++) {\n if (syncTable.checkInSuperUsers[l].toUpperCase() == context.settings.syncUserName.toUpperCase()) {\n isSuperUser = true;\n break;\n }\n }\n }\n if (!syncTable.allowCheckIn && !isSuperUser) {\n console.log(\"Skipping check in for table \" + syncTable.name +\n \" since not allowed\");\n continue;\n }\n\n realm.write(() => {\n // Calculate deletes\n console.log(\"Calculating deletes, syncTable.name: \" + syncTable.name);\n let mTableRows = realm.objects(syncTable.name + \"__m\");\n mTableRows.forEach((mTableRow) => {\n let tableRow = realm.objectForPrimaryKey(syncTable.name, mTableRow[syncTable.pks]);\n if (!tableRow) {\n mTableRow[\"DML__\"] = \"D\";\n console.log(\"Marking mTableRow 'D', pks=\" + mTableRow[syncTable.pks]);\n }\n });\n\n // Calculate inserts\n console.log(\"Calculating inserts, syncTable.name: \" + syncTable.name);\n let syncTableRows = realm.objects(syncTable.name);\n syncTableRows.forEach((syncTableRow) => {\n let mTableRow = realm.objectForPrimaryKey(syncTable.name + \"__m\", syncTableRow[syncTable.pks]);\n if (!mTableRow) {\n let mTableRowNew = {};\n mTableRowNew[syncTable.pks] = syncTableRow[syncTable.pks];\n mTableRowNew[\"VERSION__\"] = -1;\n mTableRowNew[\"DML__\"] = \"I\";\n console.log(\"Adding mTableRowNew, 'I', pks=\" + syncTableRow[syncTable.pks]);\n realm.create(syncTable.name + \"__m\", mTableRowNew, 'modified');\n }\n });\n\n // SET TXN__=?, DML__=(CASE WHEN VERSION__=-1 AND DML__='U' THEN 'I' \"\n // \"WHEN VERSION__>-1 AND DML__='I' THEN 'U' ELSE DML__ END), \n // WHERE DML__ IS NOT NULL\"; \n\n mTableRows = realm.objects(syncTable.name + \"__m\").filtered(\"DML__!=null\");\n console.log(\"update m table: \" + syncTable.name);\n mTableRows.forEach((mTableRow) => {\n\n if (mTableRow[\"VERSION__\"] > -1 && mTableRow[\"DML__\"] == \"I\") {\n mTableRow[\"DML__\"] = \"U\";\n }\n if (mTableRow[\"VERSION__\"] == -1 && mTableRow[\"DML__\"] == \"U\") {\n mTableRow[\"DML__\"] = \"I\";\n }\n\n mTableRow[\"TXN__\"] = transactionId;\n })\n })\n }\n\n let cmd = {};\n cmd.name = \"SCHEMA\";\n cmd.value = clientSchemaSub;\n await transport.writeCommand(cmd);\n\n // Table iterator\n let tableList = syncSchema.tableList;\n let dmlType = null;//[] = { \"U\", \"I\", \"D\"};\n for (let dml1 = 1; dml1 >= 0; dml1--) {\n if (dml1 == 0) {\n tableList.reverse();\n }\n\n for (let k = 0; k < tableList.length; k++) {\n let syncTable = tableList[k];\n\n for (let dml2 = 0; dml2 < dml1 + 1; dml2++) {\n\n if (dml1 == 0) {\n dmlType = \"D\";\n } else if (dml2 == 0) {\n dmlType = \"U\";\n } else if (dml2 == 1) {\n dmlType = \"I\";\n }\n\n console.log(\"dmlType=\" + dmlType + \", syncTable.name=\" + syncTable.name);\n\n\n let mTableRows = realm.objects(syncTable.name + \"__m\");\n // SELECT VERSION__,pks WHERE DML__='D' AND TXN__=?\"; \n mTableRows = mTableRows.filtered(\"DML__='\" + dmlType + \"' AND TXN__=\" + transactionId);\n\n if (mTableRows.length > 0) {\n let count = 0;\n let dmlCmd = null;\n switch (dmlType) {\n case \"D\":\n dmlCmd = \"DELETE\";\n break;\n case \"I\":\n dmlCmd = \"INSERT\";\n break;\n case \"U\":\n dmlCmd = \"UPDATE\";\n break;\n }\n let cmd = {};\n cmd.name = dmlCmd;\n cmd.value = syncTable.id;\n await transport.writeCommand(cmd);\n\n for (let mTableRow of mTableRows) {\n let tableRow = null;\n let pkVals = [];\n count++;\n if (dmlType == \"D\") {\n syncSummary.checkInDIU_requested[0] += 1;\n } else if (dmlType == \"I\") {\n syncSummary.checkInDIU_requested[1] += 1;\n } else {\n syncSummary.checkInDIU_requested[2] += 1;\n }\n let colValList = [];\n //let splitted;\n colValList.push(String(mTableRow[\"VERSION__\"])); // version col\n if (dmlType == \"D\") { // delete\n for (let m = 0; m < syncTable.pkList.length; m++) {\n let obj = mTableRow[syncTable.columnsPkRegLob[m].columnName];\n\n if (obj != null) {\n // cast to String\n let str = db.colObjToString(\n obj, syncSchema.serverDbType, syncTable.columnsPkRegLob[m]);\n colValList.push(str);\n } else {\n colValList.push(null);\n }\n }\n } else { // insert or update\n tableRow = realm.objectForPrimaryKey(syncTable.name, mTableRow[syncTable.pks]);\n for (let m = 0; m < syncTable.columnsPkRegLob.length - syncTable.lobColCount; m++) {\n let obj = tableRow[syncTable.columnsPkRegLob[m].columnName];\n\n if (obj != null) {\n // cast to String\n let str = db.colObjToString(\n obj, syncSchema.serverDbType, syncTable.columnsPkRegLob[m]);\n colValList.push(str);\n } else {\n colValList.push(null);\n }\n if (m < syncTable.pkList.length) {\n pkVals.push(obj);\n }\n }\n }\n let cmd = {};\n cmd.name = \"ROW\";\n cmd.value = colValList;\n await transport.writeCommand(cmd);\n\n // lob payloads\n if ((dmlType == \"I\" || dmlType == \"U\") && syncTable.lobColCount > 0) { // insert/update and there are lob cols\n for (let m = 0; m < syncTable.lobColCount; m++) {\n let column =\n syncTable.columnsPkRegLob[m + syncTable.columnsPkRegLob.length - syncTable.lobColCount];\n let isBinary = (db.isBlob(syncSchema.serverDbType, column));\n let payload = tableRow[column.columnName];\n if (isBinary) {\n // ArrayBuffer to hex encoded Uint8Array\n payload = new Uint8Array(payload);\n payload = util.bytes2hex(payload);\n }\n await sendLob(payload, isBinary);\n }\n\n }\n }\n\n // TABLE DML (INSERT UPDATE DELETE) \"END\"\n let end_cmd =\n \"END_\" + dmlCmd;\n cmd = {};\n cmd.name = end_cmd;\n cmd.value = null;\n await transport.writeCommand(cmd);\n\n console.log(syncTable.name + \", \" + dmlCmd + \", \" +\n count);\n }\n }\n }\n }\n tableList.reverse();\n\n // END_SCHEMA\n cmd = {};\n cmd.name = \"END_SCHEMA\";\n cmd.value = null;\n await transport.writeCommand(cmd);\n }\n\n // END_CHECK_IN_DATA\n cmd = {};\n cmd.name = \"END_CHECK_IN_DATA\";\n cmd.value = null;\n await transport.writeCommand(cmd);\n console.log(\"end checkInData()\");\n}", "async negativeCheckUpdateCountry(clientName, field, changeto) {\n \n let flag = await this.checkUpdate(clientName, field, changeto,true)\n if(flag)\n {\n console.log(\"Test failed non exist country was update\")\n this.logger.error(\"Test failed non exist country was update\")\n }\n else\n {\n this.logger.info(\"Test - negativeCheckUpdateCountry - passed\")\n console.log(\"Test - negativeCheckUpdateCountry - passed\")\n } \n \n \n\n }", "function test_list() {\n callApi.list_call((err, res) => {\n //If err happened, the err will contain the detailed error message, or it will be null\n if (err) {\n sharedResource.dbgOut(err);\n }\n if (res) {\n sharedResource.dbgOut(`Total calls: ${res.list.length}`);\n sharedResource.dbgOut(res);\n }\n })\n}", "function syncMongodb(){\n\tvar index = 0;\n\tfor(k in regClientObj){\n\t\tif(regClientObj[k] != null){\n\t\t\tif(regFailedTimeFlag[k] >= maxFailed){\n\t\t\t\t//console.log(\"index >> %s [%s] same records errored more than %sth times ,no more result send ,this sync stopped , a mail has sended...\" , index , k , regFailedTimeFlag[k]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(clientState[k] == \"wait for sync\"){\n\t\t\t\tchangeOplogInfo(k);\n\t\t\t}else{\n\t\t\t\tconsole.log(colors.grey(\"index >> %s [%s] not synced , loop it next time ....\") , index , k);\n\t\t\t}\n\t\t}\n\t\tindex++;\n\t}\n}", "function createIgnore (host, reason, cb) {\n ignorelistDB.insert({\n host,\n reason,\n time: new Date()\n }, (err, doc) => {\n if (err) { console.log(err) }\n if (cb) {\n cb(err, Boolean(doc))\n }\n })\n}", "handleRequest(list) {\n if (this.currentOperation) {\n this.log(\"Cancelling sync operation with timer id\", this.currentOperation);\n clearTimeout(this.currentOperation);\n }\n list.forEach(e => {\n this.addToQueue(e);\n });\n // notify with fictional status 'syncing', in reality it does not exists\n this.notifyStatus(this.queue.map(d => ({\n ...d,\n status: \"syncing\"\n })));\n this.isOnline().then(online => {\n if (online) {\n this.currentOperation = setTimeout(() => {\n //this.processQueue();\n this.syncQueue();\n this.currentOperation = null;\n }, 5000);\n this.log(\"Scheduled sync with timer id\", this.currentOperation);\n }\n });\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
generateTrackingNumber() Purpose: Helper function generates a random tracking number Parameters: none Returns: string
function generateTrackingNumber() { const TN_LENGTH = 10; const TN_PREFIX = "IWD"; var tokens = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9','0']; var trackingNumber = new String(TN_PREFIX); for(var x = 0; x < TN_LENGTH; x++) { trackingNumber = trackingNumber.concat( tokens[ Math.floor( Math.random() * tokens.length ) ] ); } console.log("Generated: " + trackingNumber); return trackingNumber; }
[ "function generateTrackingNumber() {\r\n return Math.floor(Math.random() * 1000000);\r\n}", "function generateTrackingNumber() {\n return Math.floor(Math.random() * 1000000);\n}", "function generateTrackingID () {\n return Math.floor(Math.random() * 999999999999)\n}", "function generateTrackingNumber() {\r\n const TN_LENGTH = 10;\r\n const TN_PREFIX = \"IWD\";\r\n var tokens = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];\r\n var trackingNumber = new String(TN_PREFIX);\r\n for (var x = 0; x < TN_LENGTH; x++) {\r\n trackingNumber = trackingNumber.concat(tokens[Math.floor(Math.random() * tokens.length)]);\r\n }\r\n console.log(\"Generated: \" + trackingNumber);\r\n return trackingNumber;\r\n} // end generateTrackingNumber", "function generateUniqueTrackingNumber(){\n //generate random tracking numbers\n //until it is one that does not exist\n //in the parcels array yet\n var newTrackingNumber;\n do{\n newTrackingNumber = generateTrackingNumber();\n } while( parcels.find( ({ trackingNumber })=>trackingNumber===newTrackingNumber) );\n return newTrackingNumber;\n }", "function generateNumber() {\n\tgeneratedNumber = Math.floor(Math.random() * (121 - 19) + 19);\n}", "function genNumber(){\n return Math.round( Math.random() * 9 + 1 );\n }", "function generateNum() {\n goalNumber = Math.floor((Math.random() * 120) + 19);\n }", "function generateNoteID() {\n const min = 0;\n const max = 100000;\n return Math.floor(Math.random() * (max - min)) + min;\n}", "function generateNumber() {\n // Generate random number\n var numGenerated = Math.floor(Math.random() * 100000).toString();\n\n // Make a random number generated 5 digit number\n switch (numGenerated.length) {\n case 1:\n numGenerated += \"0000\";\n break;\n case 2:\n numGenerated += \"000\";\n break;\n case 3:\n numGenerated += \"00\";\n break;\n case 4:\n numGenerated += \"0\";\n break;\n default:\n break;\n }\n\n // Return the random 5 digit number generated\n return numGenerated;\n }", "function generateRandomNo() {\n return Math.floor(10000000 + Math.random() * 9000000)\n}", "function generateWinningNumber(){\n\t\t// add code here\n\t\treturn Math.floor(Math.random() * (100 - 1 + 1)) + 1;\n\t}", "function generateTargetNumber (){\n var num = Math.floor(Math.random() * 120) + 19;\n console.log(num)\n return num\n }", "function generateNumber() {\n\t\treturn Math.floor(Math.random() * tipsArray.length);\n\t}", "function randomNumber() {\n\t return Math.floor(Math.random() * 10000 + 1);\n\t }", "function generateURL() {\n var randomNum = (\"000\" + Math.floor(Math.random() * 1000)).slice(-4);\n return randomNum;\n }", "function genRegistrationNumber() {\n\t\tvar x = (Math.random().toString(36).substring(2,10)).toUpperCase();\n\t\tdocument.getElementById('registration').innerHTML = x;\n}", "function generateWinningNumber(){\n //Use random function generator to generate number unique for each game.\n return Math.floor(Math.random() * 100);\n }", "function generateNumber() {\n var num = Math.floor(Math.random() * 9) + 1;\n return num;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
adds zero padding to single number
function addZeroPaddingSingle(number){ var result=number; if(number<10 && number>-1) result="0"+number; return result; }
[ "function addPadding(number) {\n var a = (\"00000000\" + number).slice(-8);\n return a;\n}", "function padWithZero(val) {\n return val > 9 ? val : \"0\" + val;\n }", "function zeroPad(num){\n return (num < 10 ? \"0\" + num.toString() : num.toString());\n }", "function zeroPad(num) {\n if (num < 10) {\n return \"0\" + num.toString();\n } else {\n return num.toString();\n }\n}", "function padZeros(number) {\r\n\tvar result;\r\n\tif (number < 10) result = '000' + number; \r\n\telse if (number < 100) result = '00' + number;\r\n\telse if (number < 1000) result = '0' + number;\r\n\treturn result;\r\n}", "function padWithZero(num) {\n return num < 10 ? '0' + num : '' + num;\n}", "function padWithZero(num) {\n return num < 10 ? `0${num}` : `${num}`;\n}", "function pad(number) \n{ \n\tif(number < 10 && String(number).substr(0,1) == '0')\n\t{\n\t\treturn number;\n\t}\n \n\treturn (number < 10 ? '0' : '') + number\n \n}", "function tp_zero_pad(n, l)\n{\n\tn = n.toString();\n\tl = Number(l);\n\tvar pad = '0';\n\twhile (n.length < l) {n = pad + n;}\n\treturn n;\n}", "function pad(width, number)\n{\n return new Array(1 + width - number.length).join('0') + number;\n}", "function padded(value) {\n return value < 10 ? '0' + value : value;\n}", "function numToStringWithPadZero() {\n\tvar num = arguments[0];\n\tvar digit = arguments[1];\n\tvar val1 = \"\" + num\n\tvar val2 = (\"0000000000\" + num).slice(-digit);\n\tval2 = (val2.length < val1.length) ? val1 : val2;\n\treturn val2;\n}", "function pad(num) {\n \n while (num.length % 3 !== 0) {\n num = num.padStart(num.length + 1, \"0\")\n }\n return num\n }", "function padded(value) {\n return value < 10 ? '0' + value : value;\n }", "function padZeros(number, count)\n{\n\tvar padding = \"0\";\n\tfor (var i=1; i < count; i++)\n\t\tpadding += \"0\";\n\tif (typeof(number) == 'number')\n\t\tnumber = number.toString();\n\tif (number.length < count)\n\t\tnumber = (padding.substring(0, (count - number.length))) + number;\n\tif (number.length > count)\n\t\tnumber = number.substring((number.length - count));\n\treturn number;\n}", "function pad_with_zeroes(value, length) {\n value = Math.round(value).toString(); // Ensure value is treated as a string.\n\n // Add zeroes until the length matches.\n while (value.length < length) {\n value = '0' + value;\n }\n\n return value;\n }", "function zeroPad(number, len) {\n var s = number + \"\";\n while(s.length < len) {\n s = \"0\" + s;\n }\n return s;\n}", "function addPadding(number) {\n return (number > 0) ? ' ' : '';\n}", "function zeroPad(s, num)\n{\n s = \"\" + s;\n if (s.length >= num)\n\treturn s;\n return \"00000000\".slice(0, num - s.length) + s;\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
var locations = [ ['Oficina de ventas : Urb. Los Cedros Mz E lote 3 Yanahuara', 16.393940, 71.549208,1] ]; var icon = ['public/img/markermenorca.png','public/img/markermap.png']; Initialize and add the map
function initMap() { var icon = [{ url: path+"public/web/images/marker-menorca.svg", // url scaledSize: new google.maps.Size(70, 70), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(0, 50) // anchor }]; // console.log(locations[0][1]+locations[0][2]); // The location of Uluru , ,, var uluru = {lat: parseFloat(locations[0][1]), lng: parseFloat(locations[0][2])}; // The map, centered at Uluru var map = new google.maps.Map( document.getElementById('map'), { zoom: 7, center: uluru, //disableDefaultUI: true, styles: [ { "elementType": "geometry", "stylers": [ { "color": "#f5f5f5" } ] }, { "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "elementType": "labels.text.fill", "stylers": [ { "color": "#616161" } ] }, { "elementType": "labels.text.stroke", "stylers": [ { "color": "#f5f5f5" } ] }, { "featureType": "administrative.land_parcel", "elementType": "labels.text.fill", "stylers": [ { "color": "#bdbdbd" } ] }, { "featureType": "poi", "elementType": "geometry", "stylers": [ { "color": "#eeeeee" } ] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [ { "color": "#757575" } ] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [ { "color": "#e5e5e5" } ] }, { "featureType": "poi.park", "elementType": "labels.text.fill", "stylers": [ { "color": "#9e9e9e" } ] }, { "featureType": "road", "elementType": "geometry", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": "road.arterial", "elementType": "labels.text.fill", "stylers": [ { "color": "#757575" } ] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "color": "#dadada" } ] }, { "featureType": "road.highway", "elementType": "labels.text.fill", "stylers": [ { "color": "#616161" } ] }, { "featureType": "road.local", "elementType": "labels.text.fill", "stylers": [ { "color": "#9e9e9e" } ] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "color": "#e5e5e5" } ] }, { "featureType": "transit.station", "elementType": "geometry", "stylers": [ { "color": "#eeeeee" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#f8f8f9" } ] }, { "featureType": "water", "elementType": "geometry.fill", "stylers": [ { "color": "#e8e9ec" } ] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [ { "color": "#d9d9d9" } ] } ] }); // The marker, positioned at Uluru var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), icon: icon[0], map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { var content = '<div class="infowin">'+ '<p>'+locations[i][0]+'</p>'+ '</div>'; infowindow.setContent(content); infowindow.open(map, marker); } })(marker, i)); } }
[ "function addMarker(map) {\r\n for (var i = 0, length = data.length; i < length; i++) {\r\n var busdata = data[i];\r\n var myLatLng = {lat: parseFloat(busdata.stop_lat), lng: parseFloat(busdata.stop_lon)};\r\n\r\n // Creating markers and putting it on the map\r\n\r\n // {#var image = 'https://image.flaticon.com/icons/svg/164/164955.svg';#}\r\n // {#var image = \"{% static '../../static/img/bus.png' %}\";#}\r\n var marker = new google.maps.Marker({\r\n position: myLatLng,\r\n map: map,\r\n title: busdata.actual_stop_id + \"\\n\" + busdata.stop_name,\r\n // {#icon: image,#}\r\n\r\n });\r\n\r\n }\r\n}", "function setMarkers(map, locations) {\n var markers = [];\n var image = new google.maps.MarkerImage('img/svg/map-marker.svg', null, null, null, new google.maps.Size(40,58));\n for (var i = 0; i < locations.length; i++) {\n var point = locations[i];\n var myLatlng = new google.maps.LatLng(point[0], point[1]);\n var marker = new google.maps.Marker({\n position : myLatlng,\n map : map,\n icon : image,\n title : point[3].head,\n zIndex : point[2]\n });\n marker.infoContent = point[3];\n markers.push(marker);\n }\n return markers;\n}", "function setMarkers(map, locations) {\n var markers = [];\n var image = new google.maps.MarkerImage('img/map-baloon.png');\n for (var i = 0; i < locations.length; i++) {\n var point = locations[i];\n var myLatlng = new google.maps.LatLng(point[0], point[1]);\n var marker = new google.maps.Marker({\n position : myLatlng,\n map : map,\n icon : image,\n title : point[3].head,\n zIndex : point[2]\n });\n marker.infoContent = point[3];\n markers.push(marker);\n }\n return markers;\n }", "function initMap() {\n var map = new google.maps.Map(document.getElementById(\"map\"), {\n zoom: 6,\n center: {\n lat: 52.35551,\n lng: -1.17431\n }\n });\n\n var labels = \"ABCDEFGHIJKLMONPQRSTUVWXYZ\";\n\n var locations = [{\n name: \"London\",\n lat: 51.50735,\n lng: -0.12775,\n description: \"The capital of England and the United Kingdom, is a 21st-century city with history stretching back to Roman times. At its centre stand the imposing Houses of Parliament, the iconic ‘Big Ben’ clock tower and Westminster Abbey, site of British monarch coronations. Across the Thames River, the London Eye observation wheel provides panoramic views of the South Bank cultural complex, and the entire city.\",\n imgSrc: \"assets/images/beaches/bath-travelzoo.jpg\",\n }, {\n name: \"Bath\",\n lat: 51.38106,\n lng: -2.35901,\n description: \"Bath is the largest city in the county of Somerset, England, known for and named after its Roman-built baths. In 2011, the population was 88,859. Bath is in the valley of the River Avon, 97 miles west of London and 11 miles southeast of Bristol. The city became a World Heritage site in 1987.\",\n imgSrc: \"https://images.theconversation.com/files/93616/original/image-20150902-6700-t2axrz.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1000&fit=clip\"\n\n }, {\n name: \"Cornwall\",\n lat: 50.26604,\n lng: -5.05271,\n description: \"Cornwall is a county on England’s rugged southwestern tip. It forms a peninsula encompassing wild moorland and hundreds of sandy beaches, culminating at the promontory Land’s End. The south coast, dubbed the Cornish Riviera, is home to picturesque harbour villages such as Fowey and Falmouth. The north coast is lined with towering cliffs and seaside resorts like Newquay, known for surfing.\",\n imgSrc: \"https://images.theconversation.com/files/93616/original/image-20150902-6700-t2axrz.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1000&fit=clip\"\n\n\n }, {\n name: \"York\",\n lat: 53.95996,\n lng: -1.08729,\n description: \"York is a walled city in northeast England that was founded by the ancient Romans. Its huge 13th-century Gothic cathedral, York Minster, has medieval stained glass and 2 functioning bell towers. The City Walls form a walkway on both sides of the River Ouse. The Monk Bar gate houses an exhibition tracing the life of 15th-century Plantagenet King Richard III.\",\n imgSrc: \"https://images.theconversation.com/files/93616/original/image-20150902-6700-t2axrz.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1000&fit=clip\"\n\n }, \n\n\n\n];\n\n var markers = locations.map(function(location, i) {\n const marker = new google.maps.Marker({\n position: {\n lat: location.lat,\n lng: location.lng,\n },\n label: labels[i % labels.length]\n });\n attachDescriptionWindow(map, marker, location); \n return marker;\n });\n\n var markerCluster = new MarkerClusterer(map, markers, {\n imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'\n });\n \n}", "function setMarkersGE() {\n markers =[\n ['Nukriani', 41.6091781,45.8947416],\n ['Kazbegi', 42.657029,44.6308047],\n ];\n \n }", "function setMarkersTUR() {\n markers =[\n ['Istambul', 41.0055005,28.7319924],\n ['Ankara', 39.9035557,32.62268],\n ];\n \n }", "function addMarkers() {\n var i;\n for ( i=0; i<locations.length; i++) {\n var location =locations[i];\n var marker = new google.maps.Marker({\n position: new google.maps.LatLng(location[0], location[1]),\n draggable: false,\n animation: google.maps.Animation.DROP,\n icon: icons[Math.floor(Math.random() * icons.length)]\n });\n markers.push(marker);\n }\n }", "function initMap(center, holeLoc, teeLoc) {\n var map = new google.maps.Map(document.getElementById('map'), {\n draggable:false,\n disableDefaultUI:true,\n zoom: 17,\n center: center,\n mapTypeId: google.maps.MapTypeId.SATELLITE\n });\n var holemarker = new google.maps.Marker({\n position: holeLoc,\n map: map,\n title: 'Hole',\n icon: 'flagmarker.png'\n });\n var teemarker = new google.maps.Marker({\n position: teeLoc,\n animation:google.maps.Animation.BOUNCE,\n map: map,\n title: 'Tee',\n icon: 'teemarker.png'\n });\n}", "function setMarkers(map, biz_locations) {\n let locations = biz_locations;\n for (var i = 0; i < locations.length; i++) {\n var restaurant = locations[i];\n var marker = new google.maps.Marker({\n position: {lat: restaurant[1], lng: restaurant[2]},\n map: map,\n label: (i + 1).toString(),\n });\n markers.push(marker)\n }\n}", "function initMap() {\n const destination = {\n lat: 40.751332,\n lng: -74.006414\n };\n map = new google.maps.Map(document.getElementById('map'), {\n center: destination,\n zoom: 12\n });\n const marker = new google.maps.Marker({\n position: destination,\n map: map,\n icon: '/assets/dest.png'\n });\n}", "function initMap() {\n const destination = {\n lat: 40.751332,\n lng: -74.006414\n };\n map = new google.maps.Map(document.getElementById('map'), {\n center: destination,\n zoom: 12\n });\n const marker = new google.maps.Marker({\n position: destination,\n map: map,\n icon: '/assets/dest.png'\n });\n }", "function initMap() {\n \t'use strict';\n\t\tvar myCenter = new google.maps.LatLng(48.2089816, 16.3732133),\n\t\t mapCanvas = document.getElementById(\"officeMap\"),\n\t\t mapOptions = {center: myCenter, zoom: 13, scrollwheel: false},\n\t\t map = new google.maps.Map(mapCanvas, mapOptions);\n\n\t \tvar locations = markers;\n\t \tvar marker, i;\n\t \tvar infowindow = new google.maps.InfoWindow();\n\t \tvar image = {\n\t \t\turl: \"img/officemarker.png\",\n\t \t\tscaledSize: new google.maps.Size(30, 30), // scaled size\n\t \t};\n\t for (i = 0; i < locations.length; i++) { \n\t \tmarker = new google.maps.Marker({\n\t\t position: new google.maps.LatLng(locations[i][0], locations[i][1]),\n\t\t map: map,\n\t\t icon: image\n\t });\n\n\t google.maps.event.addListener(marker, 'click', (function(marker, i) {\n\t return function() {\n\t infowindow.setContent(locations[i][2]);\n\t infowindow.open(map, marker);\n\t map.setZoom(16);\n\t \t map.setCenter(marker.getPosition());\n\t }\n\t })(marker, i));\n\t }\n\t}", "function initMap() {\n var map = new google.maps.Map(document.getElementById('map_canvas'),{\n center: {lat: 20.5937, lng: 78.9629} ,\n zoom: 5,\n });\n\n var location = gon.locations\n var restaurant = gon.restaurant\n var restaurant_dish = gon.restaurant_dish\n var pictures = gon.pictures\n\n for(var i = 0 ; i < location.length; i++ ){\n var marker = new google.maps.Marker({\n position: {lat: location[i].latitude, lng: location[i].longitude},\n map: map,\n title: restaurant[i].name,\n label: {color:'white', fontWeight: \"bold\"},\n icon: {\n path: 'M22-48h-44v43h16l6 5 6-5h16z',\n fillColor: '#697f8c',\n fillOpacity: 1,\n strokeColor: '#FFFFFF',\n strokeWeight: 5,\n title: 'fdf',\n labelClass: \"label\",// the CSS class for the label\n labelOrigin: new google.maps.Point(0, -25),\n size: new google.maps.Size(32,32),\n anchor: new google.maps.Point(16,32) \n } \n });\n \n marker.content = '<p><img width =\"80px\" height = \"60px\" src='+pictures[i].image.url+' ><b> &nbsp;&nbsp;'+ restaurant[i].name+'</b><br><br><b class=\"location_address\">'+location[i].street+','+location[i].city+\n ','+location[i].state+','+location[i].pincode+','+location[i].country+'<b>';\n \n \n // var markerCluster = new MarkerClusterer(map, marker)\n\n\n //Marker onclick show info window and show all dishes related restaurant \n var infoWindow = new google.maps.InfoWindow();\n google.maps.event.addListener(marker, 'click',(function (marker, i) {\n return function(){\n infoWindow.setContent(this.content);\n infoWindow.open(map, this);\n var restaurant_id =restaurant[i].id;\n $.ajax({\n type: \"GET\",\n url: $(this).attr('href'),\n data: {restaurant_id: restaurant_id},\n dataType: \"script\",\n success: function () {\n }\n });\n }\n })(marker,i));\n }\n}", "function markerTest() {\n $.getJSON(\"http://localhost:9000\" + \"/getTowers\", function (marker){\n $.each(marker,function(i, mark) {\n\n\n var iconBase = 'img/WirelessTowerStandard.png';\n var addmark = new google.maps.Marker({\n position: loadpos = {\n lat: mark.latCoordDD,\n lng: mark.longCoordDD\n },\n map: map,\n icon: iconBase});\n addmark.setPosition(loadpos);\n });\n})}", "function addIconMarker(location,type){\n\tmarkerItem = new google.maps.Marker({\t\t\t\t\t\t\t\t\t\n\t\tposition: location,\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tmap: map\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t});\n\tmarkersArray.push(markerItem);\n\t\t\t\n\tsetMarkerIcon(type);\n\taddRadius();\n}", "function drawOnMap(array){\n for(var i=0; i<array.length; i++){\n var longitude = array[i].coords[1];\n var latitude = array[i].coords[0];\n var point = new Point(longitude, latitude);\n var symbol = new SimpleMarkerSymbol().setColor(\"#1036DE\").setSize(14);\n var infoTemplate = new InfoTemplate();\n infoTemplate.setTitle(array[i].name);\n infoTemplate.setContent(array[i].postcode);\n var graphic = new Graphic(point, symbol);\n locationLayer.add(graphic);\n graphic.setInfoTemplate(infoTemplate);\n console.log(\"I am working\");\n }\n map.addLayer(locationLayer);\n }", "function showfood_outletsMarkers() {\n setfood_outletsMap(map);\n}", "function createMarkers() {\n\n}", "function store_markers(){\n var image = {\n url : 'http://maps.google.com/mapfiles/kml/shapes/bus.png',\n scaledSize: new google.maps.Size(20, 20),\n };\n\n for (var i = 0; i < bus_located.length; i++){\n var bus = bus_located[i];\n var marker = new google.maps.Marker({\n position : {lat:bus[1], lng:bus[2]},\n icon : image,\n title : bus[0]\n });\n bus_markers.push(marker);\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to prefind all the "short descriptions" for the pattern tooltips
function createShortDescriptions(){ Patterns.forEach((pattern) => { pattern.ShortDescription = $(pattern.Content).find("i").first().text(); }); }
[ "shortDescription() {\n const shortDesc = this.description.length > 200 ? this.description.substring(0 ,200) + '...' : this.description;\n return shortDesc;\n }", "displayShortDescription(description) {\r\n let shortDesc = ''\r\n let counter = 0\r\n if (description.length > 64) {\r\n for (let i = 0; i < description.length; i++) {\r\n shortDesc = shortDesc + description.charAt(i)\r\n if (shortDesc.charAt(i) === ' ') {\r\n counter++\r\n }\r\n if (counter === 9) {\r\n return shortDesc + '...'\r\n }\r\n }\r\n } else {\r\n return description\r\n }\r\n }", "_addTooltips() {\n $(this.el.querySelectorAll('[title]')).tooltip({\n delay: { show: 500, hide: 0 }\n });\n }", "function addOverviewTooltipBehaviour() {\n $('.overview-list li a[title]').tooltip({\n position: 'center right',\n predelay: 500,\n effect: 'fade'\n });\n}", "function EllipsisToolTipOnSliderSamples() {\n //debugger;\n\n // ellipsis\n $('.descriptionSamples:not(.tooltip-temp)').dotdotdot({\n ellipsis: ' ..........'\n });\n\n // tool tip - append\n var ellipsisShortDescriptionElements = $('.descriptionSamples:contains(\" ..........\")');\n\n for (var i = 0; i < ellipsisShortDescriptionElements.length; i++) {\n\n var shortDescription = ellipsisShortDescriptionElements[i].innerHTML;\n var longDescription = ellipsisShortDescriptionElements[i].title;\n\n // vtipRight - right side\n shortDescription = shortDescription.replace('..........', '...<div title=\"' + longDescription + '\" class=\"ui-icon ui-icon-newwin vtipRight\" style=\"float: right; margin-right: 8px; margin-top: 7px; border: 0px solid black;\"></div>');\n\n ellipsisShortDescriptionElements[i].innerHTML = shortDescription;\n }\n\n // add new class to make it unique\n $('.descriptionSamples').addClass('tooltip-temp');\n\n // remove title\n $('.descriptionSamples').removeAttr(\"title\");\n\n // call tool tip functionality\n vtipRight();\n}", "toolTipTitle(tooltipItems, data){\t\t\n\t\treturn \"\";\n\t}", "getShortDescription(description) {\n var scope = this;\n var descriptionRender = scope.getFieldValue(scope._vfsFieldNotes);\n var moreLink = \"<a href = \" + \"#>\" + scope.getFieldValue(scope._vfsFieldNotesMoreLink, \"text\") + \"</a>\";\n //Defining properties for a link widget.\n var descriptionText = scope.getFieldValue(description);\n var shortText = descriptionRender.noteText + descriptionRender.ellipsis + moreLink;\n return shortText;\n }", "function Tooltip(){}", "function descPopup( text, ptext ) {\n\tvar o = {\n\t\tfnc: newDefPopup(\n\t\t\t\"dsc_\" + incpop( \"dsc\", 1 ),\n\t\t\taddMarkdown(replaceTypes(ptext, 1))),\n\t\ttxt: newTxtPopup( \"dsc_\" + incpop( \"dsc\" ), text )\n\t}\n\treturn o;\n}", "description () {}", "function showTips(){\n if (cfg[cfg.dragType][track] !== undefined) {\n tips.innerHTML = track + '<br/>' + fn[cfg.dragType][cfg[cfg.dragType][track].name][cfg.language];\n } else {\n tips.innerHTML = track + '<br/>' + (cfg.funNotDefine);\n }\n }", "function flagDescription(value){\n\n\t\tif(!value) return value;\n\n\t\t//Based on Description by Michael Rubio\n\t\tvar flags = {\n\t\t\tA : \"Address Change\",\n\t\t\tB : \"Seasonal Address Change\",\n\t\t\tC : \"Comment\",\n\t\t\tD : \"Deceased\",\n\t\t\tE : \"Email Reminders Only\",\n\t\t\tF : \"Foundation/Charitable Fund Correspondence\",\n\t\t\tG : \"Special Pledge Reminder Frequency\",\n\t\t\tI : \"Info Request\",\n\t\t\tJ : \"Bequest or Planned Giving\",\n\t\t\tK : \"EFT Sign Up\",\n\t\t\tN : \"Name Change\",\n\t\t\tO : \"Parish or Business Check/Payroll Deduction\",\n\t\t\tP : \"Opt Out/Cancel My Pledge\",\n\t\t\tR : \"Do Not Solicit\",\n\t\t\tU : \"Update Phone/Email\",\n\t\t\tX : \"Final Payment on Pledge\",\n\t\t\tY : \"New Donor\"\n\t\t};\n\n\t\treturn \"<div title='\"+flags[value]+\"'>\"+ value +\"</div>\";\n\t}", "get tooltip() {}", "getDescription(descriptionObj) {\n // Uncomment to view inconsistencies\n // const descStart = descriptionObj.lastIndexOf('<p>');\n // const description = descriptionObj.slice(descStart + 3, descriptionObj.length - 4);\n\n const description = 'A dummy description of the Flickr image, please view FlickrImage.js to see reasoning for using this here.'\n return description;\n }", "function addToolTips() {\n addToolTipStyle();\n\n buildUseString('cantaken');\n buildUseString('exttaken');\n buildUseString('kettaken');\n buildUseString('lsdtaken');\n buildUseString('opitaken');\n buildUseString('shrtaken');\n buildUseString('spetaken');\n buildUseString('pcptaken');\n buildUseString('xantaken');\n buildUseString('victaken');\n }", "function tooltips() {\n return [tooltipPlugin, baseTheme];\n} /// Behavior by which an extension can provide a tooltip to be shown.", "function getDescription() {\n\treturn 'A template for writing plug-in scripts.';\n}", "function genTooltip (node) {\n let desc = genDescription(node)\n let stats = timingStats(node)\n if (stats) {\n return `⌛ ${stats.mu} (σ ${stats.sigma})<br>${desc}`\n } else {\n return desc\n }\n}", "formatSynopsis() {\n if (this.demand) {\n return ` <${this.name}>`\n }\n return ` [${this.name}]`\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
grab all the expenses and related items from the database. call on renderExpense().
fetchAndLoadExpenses() { this.expensesAdapter .getExpenses() .then(expenses => { expenses.forEach(expense => this.expenses.push(new Expense(expense))) }) .then(() => { this.renderExpense() }) }
[ "function getAllExpensesFromDatabase() {\n ExpensesService.getAllExpensesFromDatabase()\n .then(\n function success(response) {\n // if the call is successful, return the list of expenses\n vm.expenseEntries = response.data;\n },\n function failure(response) {\n console.log('Error retrieving Expense Entries from database!');\n }\n );\n }", "static displayExpenses() {\n let expenses = Store.getExpenses();\n\n expenses.forEach(expense => UI.addExpenseToList(expense));\n }", "function getExpenseListItems()\n {\n var deferred = $q.defer();\n \n \n $http(ShareCoffee.REST.build.read.for.angularJS({ url: \"web/lists/GetByTitle('Expenses')/items\", hostWebUrl: hostURL }))\n // $http(ShareCoffee.REST.build.read.for.angularJS({ url: 'web/lists?$select=Title,Id', hostWebUrl: hostURL }))\n .success(function (data) {\n deferred.resolve(data.d.results);\n common.logger.log(\"retrieved Expense Items\", data, serviceId);\n })\n .error(function (data) {\n deferred.reject(error);\n common.logger.logError(\"Unable to retrieve Expense items\", error, serviceId);\n });\n return deferred.promise;\n }", "function getExpenseList(){\n\t\treturn Expenses.index()\n\t}", "function getAndDisplayExpenses() {\n\tdisplayGasExpenses();\n\tdisplayGroceryExpenses();\n\tdisplayRestaurantExpenses();\n\tdisplayEntertainmentExpenses();\n\tdisplayMedicalExpenses();\n\tdisplayMiscExpenses();\t\n}", "renderExpense() {\n const expensesContainer = document.getElementById('expenses-container')\n\n const expenseHTML = this.expenses.map(expense => {\n const itemHTML = expense.items.map(i => i.tableHTML).join('')\n\n return expense.html(itemHTML)\n }).join('')\n expensesContainer.innerHTML = expenseHTML\n\n this.invokeItemListeners()\n }", "constructor() {\n this.expenses = []\n this.items = []\n this.expensesAdapter = new ExpensesAdapter()\n this.itemsAdapter = new ItemsAdapter()\n this.expenseBindingsAndEventListeners()\n this.fetchAndLoadExpenses()\n }", "async _readAll() {\n // log method\n logger.log(2, '_readAll', 'Attempting to read all expenses');\n\n // compute method\n try {\n let expensesData = await this.databaseModify.getAllEntriesInDB();\n let expenses = _.map(expensesData, (expense) => {\n return new Expense(expense);\n });\n\n // log success\n logger.log(2, '_readAll', 'Successfully read all expenses');\n\n // return all expenses\n return expenses;\n } catch (err) {\n // log error\n logger.log(2, '_readAll', 'Failed to read all expenses');\n\n // return error\n return Promise.reject(err);\n }\n }", "fetchAll() {\n return new Promise((resolve, reject) => {\n this.database.find({}, (error, result) => {\n if (error) {\n console.log(\"[-] Error: failed to fetch all expenses\");\n reject(error);\n }\n\n resolve(result);\n });\n });\n }", "function setUpExpenses() {\r\n let data = getData()\r\n\r\n data.forEach(function (items) {\r\n createData(items.id, items.expense, items.date, items.amount)\r\n })\r\n\r\n total.innerHTML = localStorage.getItem(\"Total\")\r\n}", "async _getAllExpenseTypeExpenses(req, res) {\n // log method\n logger.log(1, '_getAllExpenseTypeExpenses', `Getting all expenses for expense type ${req.params.id}`);\n\n // compute method\n try {\n // restrict access only to admin and manager\n if (!this.isAdmin(req.employee)) {\n let err = {\n code: 403,\n message: `Unable to get all expenses for expense type ${req.params.id} due to insufficient\n employee permissions.`\n };\n throw err; // handled by try-catch\n }\n\n let expensesData = await this.expenseDynamo.querySecondaryIndexInDB(\n 'expenseTypeId-index',\n 'expenseTypeId',\n req.params.id\n );\n let expenses = _.map(expensesData, (expenseData) => {\n return new Expense(expenseData);\n });\n\n // log success\n logger.log(1, '_getAllExpenseTypeExpenses', `Successfully got all expenses for expense type ${req.params.id}`);\n\n // send successful 200 status\n res.status(200).send(expenses);\n\n // return expenses\n return expenses;\n } catch (err) {\n // log error\n logger.log(1, '_getAllExpenseTypeExpenses', `Failed to get all expenses for expense type ${req.params.id}`);\n\n // send error status\n this._sendError(res, err);\n\n // return error\n return err;\n }\n }", "onExpenseCreated(event) {\n\n this.loadExpenses();\n\n }", "getExpenses () {\n\t\treturn this.expenses;\n\t}", "function getAllExpenses() {\n fetch(\"http://localhost:8080/expenses/\" + tripname + \"/\" + username, {\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: \"Bearer \" + token,\n },\n })\n .then((data) =>{\n if(data.ok){\n return data.json();\n }else{\n alert(\"There is no expense\");\n navigation.navigate(\"Home\");\n }\n }) //After getting all of the trip expenses, response will return as json\n .then((result) => {\n setTripExpenses(result);\n })\n .catch((e) => Alert.alert(e));\n }", "function expenditures() {\n\t\n\tvar expenseModalName\t\t\t\t =\t\"#expenseModal\";\n\tvar expenseModal\t\t\t\t\t =\t$(expenseModalName);\n\tvar expenseForm\t\t\t\t\t\t =\texpenseModal.find(\"form\");\n\tvar expenseTableName\t\t\t\t =\t\"#allExpensesModal\";\n\t\n\t//EDITS EXPENDITURE\n\t$(\"body\").on(\"click\", `${ expenseTableName } table tbody tr`, function(e) {\n\t\t\n\t\te.preventDefault();\n\t\t\n\t\tvar values\t\t\t\t\t\t =\t$(this).data(\"values\");\n\t\texpenseForm.attr(\"action\", expenseForm.data(\"edit-url\").replace(-1, values.id))\n\t\t\n\t\tformValues(expenseForm, values);\n\t\t\n\t\texpenseModal.modal(\"show\");\n\t\t\n\t});\n\t\n}", "expenses(user) {\n\t\treturn UserModel.getExpenses(getDBDriver(), user.id)\n\t\t\t.then(res => res)\n\t\t\t.catch(err => [])\n\t}", "getExpenses() {\n return fetch(this.baseUrl).then(res => res.json())\n }", "async function getAndDisplayExpensesForDate() {\n if (currentMode == mode.EXPENSES && calendar.config.mode == 'single') {\n document.getElementById('expense-table-title').innerHTML = \"Expenses for \" + chosenDate;\n document.getElementById(\"history-bottom-expense-container\").style.display = \"block\";\n }\n var expenseTbody = document.getElementById(\"expense-table-tbody\");\n\n // clear the table of all expenses\n expenseTbody.innerHTML = '';\n\n var expenseObjArr = await getDateExpenses(chosenDate);\n\n for (var i=0; i<expenseObjArr.length; i++) {\n appendExpenseToTable(expenseTbody, expenseObjArr[i]);\n }\n}", "async index ({ response}) {\n var date=new Date(Date.now())\n date.setDate(date.getDate())\n date.setHours(-1,-1,-1,-1)\n const expenses=await Expense\n .query()\n .orderBy('service_delivery')\n .having('updated_at','>', date)\n .fetch()\n for (let i in expenses.rows) {\n const expense = expenses.rows[i]\n expense.expense_type=await expense.expenseType().fetch()\n }\n return response.status(201).json(expenses)\n }" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function: isPlusFloatTD4(valueOfStr, eLength). Description: Check out that if the parameter valueOfStr is one plus float number with effective length eLength and 4 decimals. Param: A string or a number. Return: True when it is or it can be cast to a plus float number and with effective length eLength and 4 decimals, otherwise return false.
function isPlusFloatTD4(valueOfStr, eLength){ var patrn1 = /^([+|]?[0-9])+(.[0-9]{0,4})?$/; try{ //alert("isPlusFloatTD4("+valueOfStr+","+eLength+").patrn="+patrn1.exec(valueOfStr)); if (patrn1.exec(valueOfStr)){ var tlen = valueOfStr.length; var dot = valueOfStr.indexOf('.'); var plus = valueOfStr.indexOf('+'); var neg = valueOfStr.indexOf('-'); var rlen = tlen; if(dot != -1) rlen = rlen - 1; if(plus != -1) rlen = rlen - 1; if(neg != -1) rlen = rlen - 1; if(rlen==parseInt(eLength)) return true; else return false; }else{ return false; } }catch(e){ return false; } }
[ "function isFloatTD4(valueOfStr, eLength){\r\n\tvar patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloatTD4(\"+valueOfStr+\",\"+eLength+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\t\t\r\n\t\t\tvar tlen = valueOfStr.length;\r\n\t\t\tvar dot = valueOfStr.indexOf('.');\r\n\t\t\tvar plus = valueOfStr.indexOf('+');\r\n\t\t\tvar neg = valueOfStr.indexOf('-');\r\n\t\t\tvar rlen = tlen;\r\n\t\t\tif(dot != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\tif(plus != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\tif(neg != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\t\t\r\n\t\t\tif(rlen==parseInt(eLength))\t\t\t\t\r\n\t\t\t\treturn true;\r\n\t\t\telse \r\n\t\t\t\treturn false;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isPlusFloatD4(valueOfStr){\r\n\tvar patrn1 = /^([+|]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isPlusFloatD4(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isFloatD4(valueOfStr){\r\n\tvar patrn1 = /^([+|-]?[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloatD4(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isNegativeFloatTD4(valueOfStr){\r\n\tvar patrn1 = /^(-[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isNegativeFloatTD4(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\tvar tlen = valueOfStr.length;\r\n\t\t\tvar dot = valueOfStr.indexOf('.');\r\n\t\t\tvar plus = valueOfStr.indexOf('+');\r\n\t\t\tvar neg = valueOfStr.indexOf('-');\r\n\t\t\tvar rlen = tlen;\r\n\t\t\tif(dot != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\tif(plus != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\tif(neg != -1)\r\n\t\t\t\trlen = rlen - 1;\r\n\t\t\t\t\r\n\t\t\tif(rlen==parseInt(eLength))\t\t\t\t\r\n\t\t\t\treturn true;\r\n\t\t\telse \r\n\t\t\t\treturn false;\r\n\t\t}else{\r\n\t\t\treturn false;\r\n\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isPlusFloat(valueOfStr){\r\n\tvar patrn1 = /^(\\d+)(\\.\\d+)?$/;\r\n\ttry{\r\n\t\t//alert(\"isPlusFloat(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isFloat(valueOfStr){\r\n\tvar patrn1 = /^([+|-]?\\d+)(\\.\\d+)?$/;\r\n\ttry{\r\n\t\t//alert(\"isFloat(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isNegativeFloatD4(valueOfStr){\r\n\tvar patrn1 = /^(-[0-9])+(.[0-9]{0,4})?$/;\r\n\ttry{\r\n\t\t//alert(\"isNegativeFloatD4(\"+valueOfStr+\").patrn=\"+patrn1.exec(valueOfStr));\r\n\t\tif (patrn1.exec(valueOfStr)){\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}else{\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t}catch(e){\r\n\t\treturn false;\r\n\t}\r\n}", "function isFloat(str)\n{\n trimmedStr = trimStr(str);\n\n if (trimmedStr == '')\n {\n return false;\n } else if (trimmedStr == '.' || trimmedStr == '-' || trimmedStr == '+')\n {\n return false;\n }\n\n\n result = /^[\\+\\-]?[0-9]*\\.?[0-9]*$/.test(str);\n\n return result;\n\n}", "static isFloatString(value) {\r\n return /^-?\\d*\\.?\\d+$/.test(value);\r\n }", "function isFloat (s)\r\n\r\n{ if (isEmpty(s)) \r\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\r\n else return (isFloat.arguments[1] == true);\r\n\r\n return reFloat.test(s)\r\n}", "_tryWriteFloat(str) {\n buf_8.writeDoubleBE(str);\n if((buf_8.readDoubleBE() + '') === str) {\n this._writeUInt8(CborTypes.TYPE_FLOAT_64);\n this._mInOut.write(buf_8);\n return true;\n } else {\n return false;\n }\n }", "function checkCorrectFloat(arg)\n{\n var temp_val = parseFloat(arg);\n return (!isNaN(temp_val) && arg.toString().length == temp_val.toString().length && (arg.toString().length - arg.toString().replace('.', '').length) < 2); //if not NaN then float or integer, otherwise it have other symbols\n}", "function isFloat (s)\r\n\r\n{ var i;\r\n var seenDecimalPoint = false;\r\n\r\n if (isEmpty(s))\r\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\r\n else return (isFloat.arguments[1] == true);\r\n\r\n if (s == decimalPointDelimiter) return false;\r\n\r\n // Search through string's characters one by one\r\n // until we find a non-numeric character.\r\n // When we do, return false; if we don't, return true.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character is number.\r\n var c = s.charAt(i);\r\n\r\n if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;\r\n else if (!isDigit(c)) return false;\r\n }\r\n\r\n // All characters are numbers.\r\n return true;\r\n}", "function isFloat(value){\n var floatReg = /[0-9]+(\\.[0-9]+)?/g;\n if( value.search(floatReg) != -1 ){\n return true;\n }\n return false;\n}", "function isFourDigits(inputVal) {\n\tinputStr = inputVal.toString();\n\tif (inputStr.length < 4 || inputStr.length > 4) {\n\t\treturn false;\n\t}\n\treturn true;\n}", "function isFloat (s)\n\n{ var i;\n var seenDecimalPoint = false;\n\n if (isEmpty(s))\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\n else return (isFloat.arguments[1] == true);\n\n if (s == decimalPointDelimiter) return false;\n\n // Search through string's characters one by one\n // until we find a non-numeric character.\n // When we do, return false; if we don't, return true.\n\n for (i = 0; i < s.length; i++)\n {\n // Check that current character is number.\n var c = s.charAt(i);\n\n if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;\n else if (!isDigit(c)) return false;\n }\n\n // All characters are numbers.\n return true;\n}", "function isFloat (s)\r\n\r\n{ var i;\r\n var seenDecimalPoint = false;\r\n\r\n if (isEmpty(s))\r\n if (isFloat.arguments.length == 1) return defaultEmptyOK;\r\n else return (isFloat.arguments[1] == true);\r\n\r\n if (s == decimalPointDelimiter) return false;\r\n\r\n // Search through string's characters one by one\r\n // until we find a non-numeric character.\r\n // When we do, return false; if we don't, return true.\r\n\r\n for (i = 0; i < s.length; i++)\r\n {\r\n // Check that current character is number.\r\n var c = s.charAt(i);\r\n\r\n if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;\r\n else if (!isDigit(c)) return false;\r\n }\r\n\r\n // All characters are numbers.\r\n return true;\r\n}", "function isFloat (s)\n\n{ var i;\n var seenDecimalPoint = false;\n\n if (isEmpty(s)) \n if (isFloat.arguments.length == 1) return defaultEmptyOK;\n else return (isFloat.arguments[1] == true);\n\n if (s == decimalPointDelimiter) return false;\n\n // Search through string's characters one by one\n // until we find a non-numeric character.\n // When we do, return false; if we don't, return true.\n\n for (i = 0; i < s.length; i++)\n { \n // Check that current character is number.\n var c = s.charAt(i);\n\n if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;\n else if (!isDigit(c)) return false;\n }\n\n // All characters are numbers.\n return true;\n}", "function isSignedFloat (s)\n\n{ if (isEmpty(s)) \n if (isSignedFloat.arguments.length == 1) return defaultEmptyOK;\n else return (isSignedFloat.arguments[1] == true);\n\n else {\n var startPos = 0;\n var secondArg = defaultEmptyOK;\n\n if (isSignedFloat.arguments.length > 1)\n secondArg = isSignedFloat.arguments[1];\n\n // skip leading + or -\n if ( (s.charAt(0) == \"-\") || (s.charAt(0) == \"+\") )\n startPos = 1; \n return (isFloat(s.substring(startPos, s.length), secondArg))\n }\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
builds and loads a checkout page via calls to the checkout.js file, and corresponding functions in cart.js files which generate and manage carts dynamically
function loadCheckoutPage(){ loadNavbar(); generateCheckoutPage(); }
[ "function processCheckoutPage(checkoutUrl)\n{\n\tif (DXR_CONFIG.justForFunMode)\n\t\treturn;\n\n\tvar page = require('webpage').create();\n\n\tpage.open(checkoutUrl, function(status) {\n\n\t\tsetTimeout(function() {\n\n\t\t\tvar success = page.evaluate(function(e, fn, ln, s1, s2, c, s, p, t) {\n\t\t\t\tconsole.log(\"Starting checkout process...\");\n\n\t\t\t\tvar guestButton = $('#dx-as-guest');\n\n\t\t\t\tif (guestButton.length > 0)\n\t\t\t\t\tguestButton.click();\n\n\t\t\t\ttry {\n\t\t\t\t\tvar formList = ['email', 'firstname', 'lastname', 'street1', 'street2', 'city', 'state', 'postalcode', 'phonenumber'];\n\t\t\t\t\tvar formValues = [e, fn, ln, s1, s2, c, s, p, t];\n\n\t\t\t\t\tfor (var i = 0; i < formList.length; i++)\n\t\t\t\t\t\tdocument.querySelector('#panel-' + formList[i]).value = formValues[i];\n\n\t\t\t\t\tdocument.querySelector('#saveAddress').click();\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tconsole.log('Couldn\\'t find form elements for some reason. Restarting...');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tDXR_CONFIG.address.email,\n\t\t\tDXR_CONFIG.address.firstName,\n\t\t\tDXR_CONFIG.address.lastName,\n\t\t\tDXR_CONFIG.address.street1,\n\t\t\tDXR_CONFIG.address.street2,\n\t\t\tDXR_CONFIG.address.city,\n\t\t\tDXR_CONFIG.address.state,\n\t\t\tDXR_CONFIG.address.postCode,\n\t\t\tDXR_CONFIG.address.telephone);\n\n\t\t\tif (!success)\n\t\t\t\trestart();\n\t\t\telse\n\t\t\t{\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tpage.evaluate(function() {\n\t\t\t\t\t\tdocument.querySelector('#placeOrder').click();\n\t\t\t\t\t});\n\t\t\t\t}, 10000);\n\t\t\t}\n\n\t\t}, 2000);\n\n\t});\n\n\tpage.onConsoleMessage = function(message) {\n\t\tconsole.log(message);\n\t};\n\n\tpage.onUrlChanged = function(url) {\n\t\tif (checkoutUrl == url)\n\t\t\treturn;\n\n\t\tprocessPaypal(url);\n\t};\n}", "function checkout(){\n\t//send an XML request to the server to view basket\n\tlet xmlreq = new XMLHttpRequest();\n\txmlreq.onreadystatechange = function(){\n\t\tif(this.readyState == 4 && this.status == 200){\n\n\t\t\t//append the login page to the HTML page\n\t\t\tlet login = document.getElementById(\"login\");\n\t\t\tlogin.innerHTML = this.responseText;\n\t\t\tlogin.hidden = false;\n\t\t}\n\t};\n\txmlreq.open(\"GET\", \"/store/checkout\", true);\n\txmlreq.setRequestHeader(\"Accept\", \"text/html\");\n\txmlreq.send();\n}", "function get_checkout(params) {\n\nif(params.type != \"PIT\") { var title = params.type + \" \" + params.match_order; } else { var title = \"PIT\"; } //checkout title\nif(params.checked_out) { var icon = \"cloud_upload\"; } else { var icon = \"add\"; } //icon name\nif(params.checked_out) { var ua_function = \"completeCheckout(\" + params.id + \");\"; } else { var ua_function = \"checkout(\" + params.id + \"); loadMyCheckouts(0, 30);\"; } // upload/add function\n\nreturn ' \\\n\t<div class=\"card blue-grey darken-1\" style=\"background: ' + params.cardColor + ' !important;\" id=\"' + params.id + '\"> \\\n\t\t<div class=\"card-content white-text\" onclick=\"' + params.onclick + '\"> \\\n\t\t\t<div> \\\n\t\t\t\t<span style=\"color: #FFF;\" class=\"card-title\">' + params.number + \" - \" + params.team + '</span> \\\n\t\t\t\t<p style=\"color: #FFF;\">' + title + '</p> \\\n\t\t\t\t<p style=\"color: #FFF;\">' + params.available + '</p> \\\n\t\t\t</div> \\\n\t\t</div> \\\n\t\t<a style=\"background: #2A2A2A; position: absolute; bottom: 10px; right: 10px;\" onclick=\"' + ua_function + '\" class=\"btn-floating btn-large waves-effect waves-light\"><i class=\"material-icons\">' + icon + ' \\\n\t\t</i></a> \\\n\t</div> \\\n';\n\n}", "function show_cart_content_in_checkout_page() {\n $.ajax({type:'POST',data:{action:'Show Cart Contents In Checkout Page'},url:'shop-native/'+url,success:function(data){$('#show_cart_content_in_checkout_page').html(data);}});\n}", "function show_checkout_content() {\n\tif (checksameurl(location.href, checkoutpage) == true) {\n\t\t// Checkout table\n\t\tdocument.write('<div class=\"simpleCart_items\"></div><div id=\"cartTotal\">');\n\t\tdocument.write('<div id=\"empty_cart\"><a href=\"javascript:;\" class=\"simpleCart_empty\">' + translate_sentence('Empty cart') + '</a></div>');\n\t\tdocument.write('<div class=\"total_quantity\">' + translate_sentence('You have') + ' <strong><span class=\"simpleCart_quantity\"></span></strong> ' + translate_sentence('item(s) in cart') + '</div>');\n\t\tif (shipping_method == 2) { document.write('<div class=\"total_amount\">' + translate_sentence('Total weight') + ': <strong><span class=\"simpleCart_weight\"></span>g</strong></div>'); }\n\t\tdocument.write('<div class=\"total_amount\">' + translate_sentence('Subtotal in Cart') + ': <strong><span class=\"simpleCart_total\"></span></strong></div>');\n\t\tdocument.write('<div class=\"total_amount\">' + translate_sentence('Shipping cost'));\n\t\tdocument.write(': <strong><span class=\"simpleCart_shipping\"></span></strong></div><div class=\"total_amount\">' + translate_sentence('Paypal commission'));\n\t\tdocument.write(': <strong><span class=\"simpleCart_tax\"></span></strong></div><div class=\"total_amount grandtotal\">');\n\t\tdocument.write(translate_sentence('Grand total') + ': <strong><span class=\"simpleCart_grandTotal\"></span></strong></div></div>');\n\t\t// Checkout table\n\t\t\n\t\t//Shipping methods\n\t\ti_shipping = localStorage.getItem('i_shipping');\n\t\tdocument.write('<center><div id=\"shipping_types\">');\n\t\tif (free_shipping_from > 0){\n\t\t\tdocument.write('<div class=\"separation\"><span>' + translate_sentence('If your purchase is over') + ' ' + format_currency(free_shipping_from) + ', ');\n\t\t\tdocument.write(translate_sentence('your shipping will be free!') + '</span> (' + translate_sentence(shipping_types[0][0]) + ')</div>');\n\t\t}\n\t\tdocument.write(translate_sentence('Shipping methods') + ': <select onChange=\"update_shipping(this.selectedIndex)\" id=\"sel_shipping\" name=\"sel_shipping\">');\n\t\tfor(var i=0; i < shipping_types.length; i++){\n\t\t\t//alert('i_shipping ' + i_shipping);\n\t\t\tif (i == i_shipping) {\n\t\t\t\tdocument.write('<option value=\"1\" selected>');\n\t\t\t} else {\n\t\t\t\tdocument.write('<option value=\"1\">');\n\t\t\t}\n\t\t\tdocument.write(translate_sentence(shipping_types[i][0]) + ' (' + shipping_types[i][1] + ' ' + translate_sentence('days approx.') +')</option>');\n\t\t}\n\t\tdocument.write('</select></div></center>');\n\t\t//Shipping methods\n\t\t\n\t\t// Tracking number\n\t\tif (track_price !== false) {\n\t\t\tdocument.write('<div id=\"track_wrap\"><center><div class=\"add_track\"><div class=\"item_image\">');\n\t\t\tdocument.write('<img class=\"item_thumb\" src=\"https://lh5.googleusercontent.com/-0fOox7Snmhs/U11aqpau6LI/AAAAAAAABAk/Db1QGyEEwqU/s100-no/track-number.png\" alt=\"' + translate_sentence('Tracking number') + '\" title=\"' + translate_sentence('Tracking number') + '\"></div>');\n\t\t\tdocument.write('<select class=\"item_color\" style=\"display: none;\"><option value=\"-\">-</option></select>');\n\t\t\tdocument.write('<select class=\"item_size\" style=\"display: none;\"><option value=\"-\">-</option></select>');\n\t\t\tdocument.write('<div class=\"product-summary\"><div class=\"item_name\">Tracking number</div><div class=\"item_description\">');\n\t\t\tdocument.write(translate_sentence('Get the tracking number of your order and stay calm!') + '</div><div class=\"track_price\">');\n\t\t\tdocument.write(format_currency(parseFloat(track_price)) + '</div></div><a class=\"item_add button\" href=\"javascript:;\">');\n\t\t\tdocument.write(translate_sentence('Add to cart') + '</a></div></center></div>');\n\t\t\tdocument.write('<div class=\"item_price\" style=\"display: none;\">' + parseInt(track_price) + '</div>');\n\t\t}\n\t\t// Tracking number\n\t\t\n\t\t//Set selected country\n\t\ti_country = localStorage.getItem('i_country');\n\t\tif (i_country === null || typeof i_country === 'undefined') {\n\t\t\ti_country = localStorage.setItem('i_country', 0);\n\t\t\ti_country = localStorage.getItem('i_country');\n\t\t}\n\t\t//Set selected country\n\t\t\t\n\t\t//Available countries in cart\n\t\tif (world_shipping == false) {\n\t\t\tdocument.write('<center><div id=\"countries\">' + translate_sentence('Select your country') + ': <select id=\"selcountries\" name=\"selcountries\">');\n\t\t\tcountry_list.unshift('...');\n\t\t\tfor(var i=0; i < country_list.length; i++){\n\t\t\t\tif (i == i_country) {\n\t\t\t\t\tdocument.write('<option value=\"' + i + '\" selected>');\n\t\t\t\t} else {\n\t\t\t\t\tdocument.write('<option value=\"' + i + '\">');\n\t\t\t\t}\n\t\t\t\tdocument.write(translate_sentence(country_list[i]) + '</option>');\n\t\t\t}\n\t\t\tdocument.write('</select></div></center>');\n\t\t}\n\t\t//Available countries in cart\n\t\t\n\t\t//Show cart text and place the order button\n\t\tdocument.write('<center>* ' + translate_sentence('You can pay with credit card or PayPal') + '.<br />');\n\t\tif (certified_shipping == true) {\n\t\t\tdocument.write('* ' + translate_sentence('Your packet will be sent with tracking number if you order it') + '.<br />');\n\t\t}\n\t\tdocument.write('* ' + translate_sentence('Do you have any question?') + ' ');\n\t\tshowpagelink(contactuspage, translate_sentence('Contact us!'));\n\t\tdocument.write('<br /></center>');\n\n\t\tif (world_shipping == true) {\n\t\t\tdocument.write('<a class=\"simpleCart_checkout button turquoise\" href=\"javascript:;\"><span class=\"checkout_btn\">' + translate_sentence('Place the order') + '</span></a>');\n\t\t} else {\n\t\t\tvar selcountries = 0;\n\t\t\twindow.onload = function() {\n\t\t\t\tdocument.getElementById(\"selcountries\").onchange=function(){\n\t\t\t\t\tselcountries = document.getElementById(\"selcountries\").value;\n\t\t\t\t\ti_country = localStorage.setItem('i_country', selcountries);\n\t\t\t\t\ti_country = localStorage.getItem('i_country');\n\t\t\t\t\tif (selcountries > 0){\n\t\t\t\t\t\tdocument.getElementById(\"place_button\").style.display = \"block\";\n\t\t\t\t\t\tdocument.getElementById(\"disable-button\").style.display = \"none\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdocument.getElementById(\"place_button\").style.display = \"none\";\n\t\t\t\t\t\tdocument.getElementById(\"disable-button\").style.display = \"block\";\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t document.getElementById(\"selcountries\").onchange();\n\t\t\t}\n\t\t\tdocument.write('<a style=\"display: none;\" id=\"place_button\" class=\"simpleCart_checkout button turquoise\" href=\"javascript:;\"><span class=\"checkout_btn\">' + translate_sentence('Place the order') + '</span></a>');\n\t\t\tdocument.write('<div id=\"disable-button\">' + translate_sentence('Select your country') + '</div>');\n\t\t}\n\t\t//Show cart text and place the order button\n\t}\n}", "function start() {\n var cart = app.getModel('Cart').get();\n var physicalShipments, pageMeta, homeDeliveries;\n\n if (!cart) {\n app.getController('Cart').Show();\n return;\n }\n // Redirects to multishipping scenario if more than one physical shipment is contained in the basket.\n physicalShipments = cart.getPhysicalShipments();\n if (Site.getCurrent().getCustomPreferenceValue('enableMultiShipping') && physicalShipments && physicalShipments.size() > 1) {\n app.getController('COShippingMultiple').Start();\n return;\n }\n\n // Initializes the singleshipping form and prepopulates it with the shipping address of the default\n // shipment if the address exists, otherwise it preselects the default shipping method in the form.\n if (cart.getDefaultShipment().getShippingAddress()) {\n app.getForm('singleshipping.shippingAddress.addressFields').copyFrom(cart.getDefaultShipment().getShippingAddress());\n app.getForm('singleshipping.shippingAddress.addressFields.states').copyFrom(cart.getDefaultShipment().getShippingAddress());\n app.getForm('singleshipping.shippingAddress').copyFrom(cart.getDefaultShipment());\n } else {\n if (customer.authenticated && customer.registered && customer.addressBook.preferredAddress) {\n app.getForm('singleshipping.shippingAddress.addressFields').copyFrom(customer.addressBook.preferredAddress);\n app.getForm('singleshipping.shippingAddress.addressFields.states').copyFrom(customer.addressBook.preferredAddress);\n }\n }\n session.forms.singleshipping.shippingAddress.shippingMethodID.value = cart.getDefaultShipment().getShippingMethodID();\n\n // Prepares shipments.\n homeDeliveries = prepareShipments();\n\n Transaction.wrap(function () {\n cart.calculate();\n });\n\n // Go to billing step, if we have no product line items, but only gift certificates in the basket, shipping is not required.\n if (cart.getProductLineItems().size() === 0) {\n app.getController('COBilling').Start();\n } else {\n pageMeta = require('*/cartridge/scripts/meta'); // Custom : Changed ~ to *\n pageMeta.update({\n pageTitle: Resource.msg('singleshipping.meta.pagetitle', 'checkout', 'SiteGenesis Checkout')\n });\n\n // Custom Start: Add cloudinary object //\n var cloudinaryConstants = require('*/cartridge/scripts/util/cloudinaryConstants');\n var cloudinary = {};\n\n cloudinary.isEnabled = cloudinaryConstants.CLD_ENABLED;\n if (cloudinaryConstants) {\n cloudinary.highResImgViewType = cloudinaryConstants.CLD_HIGH_RES_IMAGES_VIEW_TYPE;\n cloudinary.pageType = cloudinaryConstants.PAGE_TYPES.CHECKOUT;\n }\n // Custom End: Add cloudinary object //\n\n app.getView({\n ContinueURL: URLUtils.https('COShipping-SingleShipping'),\n Basket: cart.object,\n HomeDeliveries: homeDeliveries,\n cloudinary: cloudinary\n }).render('checkout/shipping/singleshipping');\n }\n}", "function checkoutHandler() {\n event.preventDefault();\n storeLocalStorage();\n window.open('cart.html','_self');\n displayCheckoutList();\n}", "function start() {\n\n app.getForm('singleshipping').clear();\n app.getForm('multishipping').clear();\n app.getForm('billing').clear();\n\n Transaction.wrap(function () {\n Cart.goc().removeAllPaymentInstruments();\n });\n\n // Direct to first checkout step if already authenticated.\n if (customer.authenticated) {\n response.redirect(URLUtils.https('COShipping-Start'));\n return;\n } else {\n var loginForm = app.getForm('login');\n loginForm.clear();\n\n // Prepopulate login form field with customer's login name.\n if (customer.registered) {\n loginForm.setValue('username', customer.profile.credentials.login);\n }\n\n //var loginAsset = Content.get('myaccount-login');\n //var pageMeta = require('~/cartridge/scripts/meta');\n //pageMeta.update(loginAsset);\n\n app.getView({\n ContinueURL: URLUtils.https('COCustomer-LoginForm')\n }).render('checkout/checkoutlogin');\n }\n\n}", "function createCheckout() {\n let lodgingImage = JSON.parse(localStorage.getItem(\"user-lodging-image\"));\n let lodgingDescription = JSON.parse(localStorage.getItem(\"user-lodging\"));\n let lodgingPrice = JSON.parse(localStorage.getItem(\"user-lodging-cost\"));\n let spaceshipImage = JSON.parse(localStorage.getItem(\"user-spaceship-image\"));\n let spaceshipDescription = JSON.parse(localStorage.getItem(\"user-spaceship\"));\n let spaceshipPrice = JSON.parse(localStorage.getItem(\"user-spaceship-cost\"));\n let tableHeader = createTableHeader();\n $(\".checkout-head\").append(tableHeader);\n let lodgingRow = createLodgingRow(lodgingImage, lodgingDescription, lodgingPrice);\n $(\".checkout-body\").append(lodgingRow);\n let spaceshipRow = createSpaceshipRow(spaceshipImage, spaceshipDescription, spaceshipPrice);\n $(\".checkout-body\").append(spaceshipRow);\n let totalRow = createTotalRow(parseInt(lodgingPrice) + parseInt(spaceshipPrice));\n $(\".checkout-body\").append(totalRow);\n}", "function createCheckout(item) {\n var totalPrice = document.createElement('p')\n totalPrice.setAttribute('id', 'checkout-price')\n totalPrice.textContent = 'Total:' + ' ' + '$' + getTotalPrice(cart) + '.00'\n\n var checkoutForm = document.createElement('form')\n\n var name = document.createElement('div')\n name.classList.add('form-group')\n name.setAttribute('id', 'name-field')\n\n var nameLabel = document.createElement('a')\n nameLabel.textContent = 'Name:'\n\n var nameInput = document.createElement('input')\n nameInput.setAttribute('id', 'name-input')\n\n var address = document.createElement('div')\n address.classList.add('form-group')\n\n var addressLabel = document.createElement('a')\n addressLabel.textContent = 'Address:'\n\n var addressInput = document.createElement('input')\n addressInput.setAttribute('id', 'address-input')\n\n var location = document.createElement('div')\n location.classList.add('form-group')\n\n var locationLabel = document.createElement('a')\n locationLabel.textContent = 'City/State:'\n\n var locationInput = document.createElement('input')\n locationInput.setAttribute('id', 'location-input')\n\n var payment = document.createElement('div')\n payment.classList.add('form-group')\n\n var paymentLabel = document.createElement('a')\n paymentLabel.textContent = 'Payment:'\n\n var paymentInput = document.createElement('input')\n paymentInput.setAttribute('id', 'payment-input')\n\n var orderButton = document.createElement('button')\n orderButton.setAttribute('id', 'order-button')\n orderButton.setAttribute('type', 'button')\n orderButton.classList.add('btn')\n orderButton.classList.add('btn-secondary')\n orderButton.textContent = 'Place Order'\n\n checkoutContainer.appendChild(totalPrice)\n name.appendChild(nameLabel)\n name.appendChild(nameInput)\n checkoutContainer.appendChild(name)\n address.appendChild(addressLabel)\n address.appendChild(addressInput)\n checkoutContainer.appendChild(address)\n location.appendChild(locationLabel)\n location.appendChild(locationInput)\n checkoutContainer.appendChild(location)\n payment.appendChild(paymentLabel)\n payment.appendChild(paymentInput)\n checkoutContainer.appendChild(payment)\n checkoutContainer.appendChild(orderButton)\n\n orderButton.addEventListener('click', function (event) {\n if (nameInput.value === '') {\n alert('Please enter a name.')\n }\n\n else if(addressInput.value === '') {\n alert('Please enter an address.')\n }\n\n else if(locationInput.value === ''){\n alert('Please enter a city.')\n }\n\n else if(paymentInput.value === ''){\n alert('Please enter a valid credit card.')\n }\n\n else {alert('Thank you for your order!')\n checkoutContainer.classList.add('invisible')\n itemContainer.classList.remove('invisible')\n cart = []\n quantityCounter.textContent = 'x' + totalCartQuantity()\n window.location.reload(true)\n }\n })\n}", "function loadCheckOutUserCart() {\n\t $.ajax({\n \t\t\turl: \"/Demand1/auth/GetCartItemByUser.html\",\n \t\t\ttype: \"GET\",\n \t\t\tdataType: \"json\",\n \t\t\tsuccess: renderCheckOutUserCart\n \t\t});\n }", "function createMagentoCheckout () {\n var productsToAdd = []\n\n sgData.cart.products.forEach(function (sgProduct) {\n productsToAdd.push({item_id: sgProduct.uid, sku: sgProduct.productNumber, qty: sgProduct.quantity})\n })\n\n var cartRequest = sendRequest(magentoUrl + \"sg-cloudapi/rest/carts\", {})\n cartRequest.onreadystatechange = function() {\n if (this.readyState == 4) {\n if (this.status == 200) {\n console.log('success')\n var cartId = this.response.success[0].cartId\n console.log(cartId)\n\n var addProductsRequest = sendRequest(magentoUrl + \"sg-cloudapi/rest/carts/\" + cartId + \"/items\", productsToAdd)\n addProductsRequest.onreadystatechange = function() {\n if (this.readyState == 4) {\n if (this.status == 200) {\n console.log('products added')\n var redirectUrl = magentoUrl + 'shopgate-checkout/quote/auth/token/' + cartId\n\n if (sgData.user.loggedIn && sgData.user.email) {\n redirectUrl = redirectUrl + '/login/' + sgData.user.email\n }\n\n SGAction.openPage({\n src: redirectUrl,\n emulateBrowser: true,\n navigationBarParams: {\n rightButtonCallback: \"SGAction.showTab({'targetTab': 'main'});\"\n }\n })\n } else {\n console.log('could not add products to cart')\n }\n }\n }\n } else {\n console.log('could not fetch cart')\n }\n }\n }\n }", "function doCheckout(){\n window.location.href = \"/checkout.html\";\n}", "function generateShoppingContent() {\n generateShoppingHTML();\n addCategoriesHTML();\n}", "initializeCheckout() {\n const checkoutView = new CheckoutView();\n // $('#recipt-info').attr(\"hidden\", false);\n }", "function checkout() {\n update(); //call update() first to make sure everything is up-to-date\n var obj = {}; //create object for transmitting\n obj.idArray = idArr;\n obj.quantityArray = qttArr;\n obj.isDelivery = isDelivery;\n obj.total = total;\n var jsonStr = JSON.stringify(obj);\n //checkout action is only approved when there's item in the cart\n if (total !== 0) {\n $.ajax({\n type: \"post\",\n url: '../checkout/',\n data: jsonStr,\n dataType: 'json',\n //if success\n success: function () {\n // remove everything in the modal first\n $(\"#modal1_content\").children().remove();\n //codes below shows actions of adding DOMs to modal which show success information\n var success_container = document.createElement(\"div\");\n success_container.className = \"card-panel\";\n var success_info = document.createElement(\"div\");\n success_info.innerText = \"Your order has been placed.\";\n success_info.className = \"big-font\";\n var success_icon = document.createElement(\"i\");\n success_icon.className = \"material-icons\";\n success_icon.style = \"font-size: 10rem; color: green;\";\n success_icon.innerText = \"check\";\n success_container.appendChild(success_icon);\n success_container.appendChild(success_info);\n $(\"#modal1_content\").append(success_container);\n var back_button = document.createElement(\"a\");\n back_button.className = \"btn-large waves-effect\";\n back_button.innerText = \"OK\";\n //redirect back to index\n back_button.href = \"../\";\n $(\"#modal_footer\").children().remove();\n $(\"#modal_footer\").append(back_button);\n }\n });\n }\n}", "function processCartPage() {\n var _this = this;\n // Check current page is cart page\n if (!isCartPage()) {\n goToCartPage();\n return;\n }\n // Get the body element\n var content = document.querySelector(\"body\");\n var html = \"<body>\" + content.innerHTML + \"</body>\";\n (function () { return __awaiter(_this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4 /*yield*/, sendCartDetailsToApi(html)];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n }); })();\n}", "function showCart() {\n createHTML();\n}", "function navigateToCheckout() {\n\tremoveMessageFromDivId();\n\tremoveSuccessOrFailureStrip();\n\thashChangedCalled = true;\n\tmakeActiveTab('footerHomeTab');\n\tbookmarks.sethash(\"#checkout\", loadCheckoutScreen);\n mainPaymentPageResize();\n}" ]
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }