Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Promise Get scheduler data
GetSchedulerData(JobSchedule){ return new Promise((resolve, reject)=>{ let SchedulerData = new Object() this.GetDbConfig("BackupScheduler").then((reponse)=>{ SchedulerData = reponse if (JobSchedule == null) { SchedulerData.JobScheduleStarted = false SchedulerData.JobScheduleNext = "Scheduler not started" } else { SchedulerData.JobScheduleStarted = true SchedulerData.JobScheduleNext = this.GetDateTimeString(JobSchedule.nextInvocation()) } resolve(SchedulerData) },(erreur)=>{ this.LogAppliError("GetSchedulerData error : " + erreur, "Server", "Server") reject(erreur) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getScheduled() {\n return new Promise(function (resolve, reject) {\n dbPromised\n .then(function (db) {\n const tx = db.transaction(\"scheduled\", \"readonly\");\n const store = tx.objectStore(\"scheduled\");\n return store.getAll();\n })\n .then(function (items) {\...
[ "0.7078292", "0.68326926", "0.664383", "0.6631095", "0.63639724", "0.6363569", "0.627917", "0.6231549", "0.621632", "0.6188361", "0.61731756", "0.6157059", "0.61437184", "0.6102911", "0.610148", "0.6071183", "0.60359764", "0.6003829", "0.5986173", "0.59820014", "0.5974757", ...
0.766756
0
Save user entry, get partner entry callback(error, partner, parity, entry)
function roulettePartner(user, entry, callback) { root.child('users').once('value', function(usersSnapshot) { // Save own entry. usersSnapshot.child(user + '/roulette/entry').ref().set(entry); var users = usersSnapshot.val(); var partner = null; if (!users[user].roulette || !users[user].roulette.partner) { // If no partner, find one. for (var other in users) { if (other != user && !users[other].roulette) { partner = other; usersSnapshot.child(user + '/roulette').ref().set({ partner: other, parity: false }); usersSnapshot.child(other + '/roulette').ref().set({ partner: user, parity: true }); break; } } if (!partner) { callback('You have no partner.'); return; } callback(false, partner, false, undefined); } else { partner = users[user].roulette.partner; var partnerData = users[partner].roulette; if (partnerData) { callback(false, partner, partnerData.parity, partnerData.entry); } else { callback(false, partner, false, undefined); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveEntry(entry) {\n return rest.post(entry);\n }", "function saveUser(name, surname, password, address, tel) {\n // save user code\n}", "function user_save(account, callback) {\n var method = 'user.save';\n var timestamp = get_timestamp();\n var nonce = get_non...
[ "0.6139811", "0.576772", "0.56919515", "0.56761044", "0.56010735", "0.5541642", "0.5501614", "0.5463625", "0.5454333", "0.54518527", "0.54366505", "0.5425014", "0.5402603", "0.5384396", "0.5382403", "0.53804815", "0.53578496", "0.5343637", "0.53398603", "0.5323549", "0.528156...
0.7025083
0
Find results from the search. Returns true for azAZ09 and &, false otherwise.
function isAlnum(ch) { if ((ch >= "a" && ch <= "z") || (ch == "&") || (ch >= "A" && ch <= "Z") || (ch >= "0" && ch <="9")) { return true; } else { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find() {\n\t\tvar query = $(\"#search-query\").val();\n\n\t\t// check to see if the query contains special commands/characters\n\t\tconvert(query);\n\t\t\n\n\t\tfindSimilar(query);\n\t}", "function matchesAll( query, str ) {\n for( const term of query ) {\n\tconst regexp = new RegExp( term );\n\tif...
[ "0.62013334", "0.5662757", "0.553434", "0.5349265", "0.53331846", "0.5315967", "0.5280604", "0.5262645", "0.52089196", "0.5197572", "0.51841205", "0.5170505", "0.5159286", "0.5156996", "0.513886", "0.5131114", "0.5123166", "0.5112344", "0.5090575", "0.5082423", "0.50736743", ...
0.0
-1
find all the matches in a single item
function searchElement(item, matchType, upperSearchString) { var element = libdata[item][matchType].toUpperCase(); var pos, origPos = 0; libdata[item][N_MATCHES] = 0; pos = element.indexOf(upperSearchString); while (pos >= 0) { origPos += pos + 1; libdata[item][MATCHES + libdata[item][N_MATCHES]] = origPos - 1; libdata[item][N_MATCHES]++; element = element.substring(pos + 1, element.length); while (isAlnum(element.charAt(0)) && element.length > 0) { element = element.substring(1, element.length); origPos++; } pos = element.indexOf(upperSearchString); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find(items, text) {\n text = text.split(\" \")\n return items.filter(function(item) {\n return text.every(function(el) {\n return item.name.toLowerCase().indexOf(el) > -1\n })\n })\n }", "function whereToFindEach(item) {\n let result = []\n for (let key in item) {\n ...
[ "0.64474666", "0.63355404", "0.6152445", "0.6109853", "0.6061996", "0.59987324", "0.5953643", "0.5939446", "0.5876374", "0.5860957", "0.58171296", "0.5804764", "0.5797508", "0.57930285", "0.5785337", "0.576731", "0.57547814", "0.5752879", "0.57492584", "0.57299304", "0.572920...
0.0
-1
Create results web page. Results are written to the html variable and then sent to the browser.
function putHeader() { html = "<html><head><title>Search results</title>"; html += "<link rel=\"stylesheet\" type=\"text/css\" href=\"idldoc-resources/main.css\" />"; html += "<style type=\"text/css\" media=\"all\">"; html += " span.score { color: black; }"; html += " span.context { color: #A0A0A0; }"; html += " span.term { color: black; background: yellow; }"; html += " li { margin-bottom: 0.5em; }"; html += "</style>"; html += "</head><body>"; html += "<div class=\"header smaller\">"; html += "<h1>" + title + "</h1>"; html += "<h2>" + subtitle + "</h2>"; html += "</div>"; html += "<div class=\"content\">"; html += "<h2>Search results for \"" + searchString + "\"</h2>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createHtml (){\n fs.writeFileSync(outputPath, render(teamTotal), \"utf-8\");\n console.log(\"Your Team html has been created. Go to the output folder to see your creation.\")\n}", "function htmlWriteResults(cases) {\r\n var myHTML = '';\r\n myHTML +=\r\n `<article><div class=\"col-md-4\">\r\n...
[ "0.6584106", "0.6555618", "0.63690823", "0.63199997", "0.63087165", "0.6296336", "0.62651867", "0.6234805", "0.6233259", "0.6121178", "0.60697573", "0.60296655", "0.60131633", "0.6007273", "0.5998112", "0.59820706", "0.5966201", "0.5956832", "0.5922945", "0.59226197", "0.5904...
0.0
-1
Event handlers for forms on search page.
function basicsearch() { searchString = document.basicForm.basicText.value; searchTerms = searchString.split(/\s/); putHeader(); findResults(); putResults(); putFooter(); writeResultsPage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchHandler(e) {\n \"use strict\";\n // Prevent default form action\n e.preventDefault();\n showFilteredBreeds();\n}", "function handleSearch(event) {\n event.preventDefault();\n if (formSearch) {\n searchGoogleBooksAPI(formSearch.search);\n }\n\n }", "...
[ "0.76752156", "0.7508113", "0.7470994", "0.74510914", "0.73765695", "0.73606926", "0.71965045", "0.71661603", "0.71609056", "0.7090671", "0.70380443", "0.698658", "0.6977603", "0.6952246", "0.6928941", "0.6902224", "0.6883427", "0.68696475", "0.68471235", "0.6810173", "0.6795...
0.0
-1
Any changes to properties defined in the static properties will trigger a rerender of the component.
static get properties() { return { recipient_email : { type: String }, //Should be array? form_obj : { type: Object }, msgSuccess : { type: Boolean }, recipient_email : { type: String }, loading : { type: Boolean }, }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupStaticProperties() {\n var _a, _b;\n let updateBaseColor = false;\n for (const propName in this.styledProperties) {\n if (!this.styledProperties.hasOwnProperty(propName)) {\n continue;\n }\n const currentValue = this.currentStyledProperties[...
[ "0.6781116", "0.6633212", "0.638633", "0.6379255", "0.6379255", "0.63152206", "0.6251871", "0.62281936", "0.618251", "0.6130282", "0.61195296", "0.60785735", "0.6056635", "0.6056635", "0.6012019", "0.5926526", "0.59029955", "0.5880511", "0.587698", "0.5873847", "0.5873523", ...
0.0
-1
The _render callback is called each time any of the defined properties change. lithtml is optimized for handling frequent updates and updating the DOM efficiently
render() { return html` <style> .centerContent{ color: #39DB80; position: absolute; left: 50%; top: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); z-index: 99; } </style> <div style="position: relative"> ${this.renderBasicContactForm()} </div> `; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(changedProperties) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n /...
[ "0.71844596", "0.71844596", "0.7095778", "0.6839016", "0.6714255", "0.6704235", "0.66151613", "0.65875095", "0.65875095", "0.6586208", "0.6541697", "0.6540882", "0.6536392", "0.6536392", "0.6500843", "0.6476605", "0.6476605", "0.6476605", "0.64437324", "0.6394889", "0.6392763...
0.0
-1
Calculate positions for all sessions
function calc_session_positions (storyline, jsessions) { // STEP 1. read position from dot graph var digraph = json2dot(jsessions); var inputgraph = Viz(digraph, format="dot", engine="dot", options=null); var graph = graphlibDot.read(inputgraph); var sessionPos = d3.map(); var charnodePos = d3.map(); for (var i=0; i<graph._nodeCount; i++) { var nodename = graph.nodes()[i]; if (nodename.substring(0, 4) == 'char') { var charId = nodename.replace('character', ''); var xy = graph.node(nodename).pos.split(','); x = xy[0]; y = xy[1]; charnodePos.set(charId, xy); } else if (nodename.substring(0, 4) == 'sess') { var sessionId = nodename.replace('session', ''); var xy = graph.node(nodename).pos.split(','); x = xy[0]; y = xy[1]; sessionPos.set(sessionId, xy); } else { console.log("invalid node"); } } // 步骤二. 计算会话的位置 var index = 0; storyline.sessions.sort(function(a, b) { return a.start - b.start; }); storyline.sessions.forEach(function(session) { if (session.type == "session") { // set height & width session.height = Math.max( 0,session.chars.length*storyline.link_width+(session.chars.length-1)*storyline.link_gap ); // session.width = storyline.panel_width*session.duration session.width = storyline.panel_width; // set x & y var xy = sessionPos.get(session.id); session.x = storyline.panel_width*6 + storyline.panel_width*session.start + storyline.session_sep*index; session.y = parseInt(xy[1]); index++; } }); var entries = charnodePos.entries(); entries.sort(function (a, b) { return a.value[1] - b.value[1]; }); var index = 0; entries.forEach(function(entry) { storyline.char_map[entry.key].order = (index++); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPositions(){\n this.PlayerMove = playerOption;\n this.ComputerMove = [Math.floor(Math.random() * whoWonTheBattle.length)];\n getFinalPosition();\n }", "winningPositions() {\n return [\n [0,1,2],\n [3,4,5],\n [6,7,8],\n [0,3,6],\n [1,4,7],\n ...
[ "0.65803045", "0.64305025", "0.6136292", "0.6111045", "0.60683376", "0.60125315", "0.59993374", "0.59769213", "0.59460425", "0.5943549", "0.5905328", "0.5838329", "0.5837331", "0.58364177", "0.579651", "0.5788833", "0.5776048", "0.57720095", "0.5767585", "0.5752114", "0.57500...
0.674505
0
Calculate positions for links created by generate_links() And create new links within sessions
function calc_link_positions (storyline) { var charsessionMap = d3.map(); // calculate positions of links which connect two sessions storyline.sessions.forEach(function(session) { calc_link_positions_of_session(storyline, session); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate_link_positions(scenes) {\n scenes.forEach(function(scene) {\n\tfor (var i = 0; i < scene.out_links.length; i++) {\n\t scene.out_links[i].y0 = -1;\n\t}\n\n\tfor (var i = 0; i < scene.in_links.length; i++) {\n\t // These are links incoming to the node, so we're setting the \n\t // co-c...
[ "0.6665139", "0.5894189", "0.5752403", "0.5747233", "0.57232976", "0.57132465", "0.56919557", "0.5685442", "0.56074697", "0.55599535", "0.5542385", "0.55313414", "0.55313414", "0.55242974", "0.5517053", "0.55140287", "0.540146", "0.53677416", "0.5356562", "0.534852", "0.53329...
0.6984122
0
global window:false document:false CONFIG:false WebSocket:false SentiCloud:false LineChart:false / eslintdisable indent Stops eslint complaining about indentation in switch statement
function sortObjectKeys(object) { const orderedObject = {}; Object.keys(object).sort().forEach((key) => { orderedObject[key] = object[key]; }); return orderedObject; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hello2() {\n const bye = \"bye\";\n\n /**\n * For disable the es-lint on the line\n * Please put the below comment\n * now instead of the error we will have the warning for below 2\n */\n // eslint-disable-next-line\n console.log(\"this is sample \", bye);\n\n /**\n * disabling a particular...
[ "0.6323719", "0.5451801", "0.5433673", "0.5265257", "0.5262129", "0.5205865", "0.5205039", "0.5172711", "0.5158591", "0.5149491", "0.5114334", "0.51132095", "0.5093134", "0.50782216", "0.5042462", "0.5017509", "0.500172", "0.500172", "0.500172", "0.49972245", "0.4984804", "...
0.0
-1
FILTER stop words out
function filterStopWords(wordArray) { var commonWords = getStopWords(); var commonObj = {}; var uncommonArr = []; for (i = 0; i < commonWords.length; i++) { commonObj[commonWords[i].trim()] = true; } for (i = 0; i < wordArray.length; i++) { word = wordArray[i].trim().toLowerCase(); if (!commonObj[word]) { uncommonArr.push(word); } } return uncommonArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterWords(text) {\r\n\r\n text = text.split(' '); //split the string by spaces\r\n\r\n //create an array to hold unnecessary words from stopWords.js file\r\n var filter_words = [];\r\n\r\n //check if stopWordsList variable is undefined\r\n if (stopWordsList !== undefined) {\r\n fil...
[ "0.80571836", "0.7510893", "0.7446224", "0.72619426", "0.69893175", "0.6956811", "0.6794041", "0.65013313", "0.64887446", "0.6402165", "0.6374632", "0.6338508", "0.63045734", "0.6278257", "0.62346965", "0.6177938", "0.61762273", "0.6154579", "0.6138318", "0.6090079", "0.60806...
0.69237334
6
stop word not included in stats
function getStopWords() { return ["a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", "either", "else", "ever", "every", "for", "from", "get", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "in", "into", "is", "it", "its", "just", "least", "let", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "only", "or", "other", "our", "own", "rather", "said", "say", "says", "she", "should", "since", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "tis", "to", "too", "twas", "us", "wants", "was", "we", "were", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "would", "yet", "you", "your", "ain't", "aren't", "can't", "could've", "couldn't", "didn't", "doesn't", "don't", "hasn't", "he'd", "he'll", "he's", "how'd", "how'll", "how's", "i'd", "i'll", "i'm", "i've", "isn't", "it's", "might've", "mightn't", "must've", "mustn't", "shan't", "she'd", "she'll", "she's", "should've", "shouldn't", "that'll", "that's", "there's", "they'd", "they'll", "they're", "they've", "wasn't", "we'd", "we'll", "we're", "weren't", "what'd", "what's", "when'd", "when'll", "when's", "where'd", "where'll", "where's", "who'd", "who'll", "who's", "why'd", "why'll", "why's", "won't", "would've", "wouldn't", "you'd", "you'll", "you're", "you've", "pg", "http://www.gutenberg.com", "http://www.gutenberg.org", "http://www.gutenberg.net"]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterWords(text) {\r\n\r\n text = text.split(' '); //split the string by spaces\r\n\r\n //create an array to hold unnecessary words from stopWords.js file\r\n var filter_words = [];\r\n\r\n //check if stopWordsList variable is undefined\r\n if (stopWordsList !== undefined) {\r\n fil...
[ "0.6814582", "0.6656704", "0.6571564", "0.6306278", "0.6258867", "0.6237602", "0.61469275", "0.60803205", "0.60075104", "0.5953153", "0.5922646", "0.5912592", "0.5884927", "0.5874628", "0.5853942", "0.5783788", "0.5769637", "0.5734613", "0.57291496", "0.57262844", "0.5713887"...
0.66572917
1
I use this multiple times. This is nice and DRY isn't it?
function topFiveObjsUsingCount(arrOfObjects) { // 1. Sort the array by count const sortedArr = [ ...arrOfObjects, ].sort(({ count: countAInt }, { count: countBInt }) => countAInt > countBInt ? -1 : 1 ); // 2. slice the first 5 largest counts and return it return sortedArr.slice(0, 5); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "function _____SHARED_functions_____(){}", "transient protected internal function ...
[ "0.5902564", "0.58753884", "0.5867053", "0.56042624", "0.55217254", "0.55130666", "0.55118585", "0.5487332", "0.5472433", "0.5370829", "0.53484124", "0.5297713", "0.5272955", "0.51951796", "0.5172299", "0.51669466", "0.5165957", "0.5144522", "0.51106334", "0.50854826", "0.506...
0.0
-1
Runs the sbbangular specs in Karma.
function runSbbAngularSpecs() { // By importing all spec files, Karma will run the tests directly. return Promise.all( specFiles.map(function (fileName) { return System.import(fileName); }), ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unitTests(done) {\n new karma.Server({\n configFile: __dirname + '/test/unit/karma.conf.js',\n singleRun: true\n }, done).start();\n}", "function initTesting() {\n return Promise\n .all(allSpecFiles.map(moduleName => System.import(moduleName)))\n .then(__karma__.start, __karma...
[ "0.62326485", "0.6181234", "0.6179972", "0.61270183", "0.6088612", "0.60135555", "0.59360874", "0.5889457", "0.5880984", "0.5794699", "0.5657134", "0.5629245", "0.56202966", "0.55873054", "0.5573674", "0.5561589", "0.5509409", "0.54882", "0.54447836", "0.5428415", "0.5407553"...
0.8022204
0
Whether the specified file is part of sbbangular.
function isSbbAngularSpecFile(path) { return path.slice(-8) === '.spec.js' && path.indexOf('node_modules') === -1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isScssFile(file) {\n return stringEndsWith(file.relative, 'scss');\n}", "static isSourceFile(structure) {\r\n return structure.kind === StructureKind_1.StructureKind.SourceFile;\r\n }", "hasFile(file) {\n let files = this.getOwnFiles();\n let hasFile = files.includes(file);\...
[ "0.6311816", "0.5815797", "0.5793792", "0.5743461", "0.5725328", "0.5661905", "0.5653212", "0.5597174", "0.55635923", "0.5541948", "0.5540872", "0.5540872", "0.5465665", "0.546042", "0.5458935", "0.54375225", "0.5437318", "0.5428004", "0.54179054", "0.54070556", "0.5403531", ...
0.6358328
0
jslint devel: true, browser: true /global $
function calculate() { //---- FORM VALUES ---- //variables: miles_driving, average_miles_per_gallon, cost_per_gallon, hotel_cost, snacks, other_costs //Estimate Distance var miles_driving = Number($("#miles_driving").val()); //YOUR CODE HERE TO GET THE VALUE console.log("miles_driving " + miles_driving); //MPG var average_miles_per_gallon = Number($("#average_miles_per_gallon").val()); //YOUR CODE HERE TO GET THE VALUE console.log("average_miles_per_gallon " + average_miles_per_gallon); //PPG var cost_per_gallon = Number($("#cost_per_gallon").val()); //YOUR CODE HERE TO GET THE VALUE console.log("cost_per_gallon " + cost_per_gallon); //Hotel var hotel_cost = Number($("#hotel_cost").val()); console.log("hotel_cost " + hotel_cost); //Snacks var snacks_cost = Number($("#snacks_cost").val()); console.log("snacks_cost " + snacks_cost); //other_costs var other_costs = Number($("#other_costs").val()); console.log("other_costs" + other_costs); //----- CALCULATED VALUES ----- //calculate: distance / mpg var number_of_gallons = miles_driving / average_miles_per_gallon; //YOUR CODE HERE TO GET THE VALUE console.log("number_of_gallons" + number_of_gallons); //calculate: total_mileage_cost = estimate distance * ppg var total_mileage_cost = number_of_gallons * cost_per_gallon; //YOUR CODE HERE TO GET THE VALUE console.log("total_mileage_cost " + total_mileage_cost); var sum = total_mileage_cost + hotel_cost + snacks_cost + other_costs; alert("$" + sum); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function strictly() {\n 'use strict';\n\n}", "function foo() {\n \"use strict\";\n}", "function fixMyJS(data, src, options) {\n var code = new Code(src);\n var warnings = data.errors || [];\n var results = [];\n var config = data.options || {};\n var current = 0;\n\n// merge custom...
[ "0.6041227", "0.59110856", "0.57668835", "0.56602526", "0.5592256", "0.5591012", "0.55786943", "0.55354214", "0.54879814", "0.5450761", "0.544415", "0.5393474", "0.5380252", "0.53693366", "0.53375727", "0.5317635", "0.5282698", "0.5274884", "0.52636456", "0.52547413", "0.5234...
0.0
-1
add()function inputs the data then calculates the result and display it.
function add() { //obtain values from the user's input var a = document.getElementById("book_1").value; var b = document.getElementById("book_2").value; var c = document.getElementById("book_3").value; var f = a*19.99; var g = b*86; var h = c*55; var sum = f+g+h; if(a.length==0||b. length==0||c.length==0){//scenario that there is no input. alert("Please enter a number!"); } else if(isNaN(a)||isNaN(b)||isNaN(c)){//scenario that the input is invalid. alert("You can only enter numbers!"); } else { var node0 = document.createElement("div");//create a new element div called node0. node0.Id="messages"; /* output nodes */ var node1 = document.createElement("p"); node1.id = "p1"; var node2 = document.createElement("p"); node2.id = "p2"; var node3 = document.createElement("p"); node3.id = "p3"; var node4 = document.createElement("p"); node4.id = "p4"; /* put all of output nodes under element div. */ node0.appendChild(node1); node0.appendChild(node2); node0.appendChild(node3); node0.appendChild(node4); document.body.appendChild(node0);//put node0 under body section /* display on the html. */ document.getElementById("p1").innerHTML = "<strong>Basic XHTML (Quantity = </strong>" + a + "): $" + (f)+"<br/>"; document.getElementById("p2").innerHTML = "<strong>Intro to PHP (Quantity = </strong>" + b + "): $" + (g)+"<br/>"; document.getElementById("p3").innerHTML = "<strong>Advanced JQuery (Quantity = </strong>" + c + "): $" + (h)+"<br/><br/>"; document.getElementById("p4").innerHTML = "<strong>Final Total: $</strong>" + sum; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add() {\r\n const enteredNumber = getUserInputValue();\r\n const initialValue = currentResult ;\r\n const calcDescription = `${enteredNumber} + ${initialValue}`\r\n currentResult = enteredNumber + initialValue;\r\n getOperator('+', initialValue ,enteredNumber)\r\n}", "add() {\n\t\tlet args = argumen...
[ "0.74376875", "0.71903217", "0.7174178", "0.7044713", "0.701594", "0.70031816", "0.69912845", "0.6988676", "0.69877625", "0.6971644", "0.6927584", "0.68830746", "0.6856094", "0.68244165", "0.67925704", "0.6770813", "0.67700285", "0.67700285", "0.6767768", "0.67661667", "0.674...
0.6265526
61
5.0 PREVENT KEYBOARD EVENTS
function preventKeyboardListeners(event) { if (activeElement !== undefined) { if (event.keyCode === 37 || event.keyCode === 39 || event.keyCode === 73) { event.preventDefault(); event.stopPropagation(); return false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onKeyDown(e) {\n // do not handle key events when not in input mode\n if (!imode) {\n return;\n }\n\n // only handle special keys here\n specialKey(e);\n }", "HandleKeyDown(event) {}", "function keydown_handler(event)\n{\n\tif (event.defaultPrevented) r...
[ "0.7064907", "0.70447356", "0.69713265", "0.6945047", "0.6899289", "0.6884626", "0.6873527", "0.68714195", "0.686236", "0.68506324", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", "0.6825734", ...
0.0
-1
check local storage, set wins and total games played text
function checkStorage() { if (localStorage.getItem("gamesPlayed") == null) { console.log('no games storage!'); gamesPlayed = 0; localStorage.setItem("gamesPlayed", gamesPlayed); } else { gamesPlayed = localStorage.getItem("gamesPlayed"); } if (localStorage.getItem("wins") == null) { console.log('no wins storage!'); wins = 0; localStorage.setItem("wins", wins); } else { wins = localStorage.getItem("wins"); } $("#totalWins").text("Wins: " + wins); $("#totalGames").text("Games Played: " + gamesPlayed); console.log("games: " + localStorage.getItem("gamesPlayed")); console.log("wins: " + localStorage.getItem("wins")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "displayStatsScreen() {\n // Display wins\n const wins = getLocalStorage('wins', 0);\n $('.games-won').text(wins);\n\n const highestScore = getLocalStorage('highestScore', '0');\n $('.highest-score').text(highestScore);\n\n const highestLevel = getLocalStorage('highestLevel', '0');\n $('.highes...
[ "0.70248026", "0.6808347", "0.6732994", "0.6715706", "0.6690933", "0.66596746", "0.6653375", "0.66028166", "0.6593646", "0.6578239", "0.6566952", "0.6531225", "0.65149355", "0.65141666", "0.6508037", "0.6506339", "0.64983374", "0.6476651", "0.647337", "0.6471674", "0.6449918"...
0.75662124
0
generation des inputs dynamique page Questionnaire FIN
function deleteChamp(l){ var supprimer = document.getElementById('line'+l); supprimer.remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function NameQuestion() {\n console.log('%c NAME QUESTION ', fct);\n console.log('%cAttribue des id à tous les éléments du form', exp)\n\n for (let x = 0; x < $('#SouvenirsVisuels fieldset').length; x++) {\n \n //* On nomme chaque fieldset avec un numéro de question, idem pour button & canvas\n ...
[ "0.6796459", "0.6739706", "0.6586284", "0.6578539", "0.6577685", "0.65667534", "0.65530604", "0.6547081", "0.64933723", "0.6491755", "0.6477266", "0.6469192", "0.646491", "0.6443269", "0.6430245", "0.6428801", "0.6416287", "0.64009684", "0.6398829", "0.639806", "0.63950616", ...
0.0
-1
correcciones llenado del formulario
function setInfo() { var name = document.querySelector("#name_form_student"); name.value = local_user.name; var account_number = document.querySelector("#no_cuenta_form_student"); account_number.value = local_user.num_account; var career = document.querySelector("#carrer_form_student"); career.value = local_user.career; var email = document.querySelector("#email_form_student"); email.value = local_user.email; var semester = document.querySelector("#semester_form_student"); semester.value = local_user.semester; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function correccion(){\r\n\tir_a(ID_FORM, URL_CORRECCION);\r\n}", "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n ...
[ "0.71221215", "0.6689902", "0.65201813", "0.6329704", "0.6301981", "0.62768686", "0.6220196", "0.62140155", "0.62129074", "0.6188354", "0.61620474", "0.6144885", "0.6110832", "0.6046732", "0.60200596", "0.6006702", "0.59771895", "0.5960741", "0.59527063", "0.5947631", "0.5932...
0.0
-1
Given an array and an additional value, insert this value at the beginning of the array. Do this without using any builtin array methods.
function pushFront(arr, val){ for(var i = arr.length-1; i >= 0; i--){ arr[i+1] = arr[i]; } arr[0] = val; return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function destructivelyAddElementToBeginningOfArray(array, add){\n \n array.unshift(add)\n return array\n}", "function addElementToBeginningOfArray(array, add){\n return [add, ...array]\n}", "function destructivelyAddElementToBeginningOfArray(array,element){\n array.unshift(element)\n return array\n}", ...
[ "0.7882932", "0.7790514", "0.77246916", "0.76582664", "0.76554114", "0.7578127", "0.7453376", "0.7452531", "0.7432808", "0.7393185", "0.7375962", "0.7322324", "0.73068875", "0.72684777", "0.7234468", "0.7151022", "0.7115463", "0.7082706", "0.7065521", "0.70444554", "0.7010770...
0.6836137
24
Pop Front Given an array, remove and return the value at the beginning of the array. Do this without using any builtin array methods except pop().
function popFront(arr){ var val = arr[0]; for(var i = 1; i<arr.length; i++){ arr[i-1] = arr[i]; } arr.pop(); return val; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function popFront(array) {\n return removeAt(array, 0);\n}", "function popFront(arr){\n var val = arr[0];\n for (var index = 0; index < arr.length; index++){\n var currentValue = arr[index];\n arr[index] = arr[index+1]\n }\n arr.length--;\n return val;\n}", "function popFront(arr)...
[ "0.8566836", "0.84587926", "0.845179", "0.84476763", "0.8418433", "0.8390154", "0.82737714", "0.82616657", "0.8249019", "0.80931306", "0.8024679", "0.79505086", "0.7869429", "0.78540945", "0.77744025", "0.7751155", "0.7686439", "0.76678616", "0.7500283", "0.7399402", "0.73994...
0.8385539
6
Insert At Given an array, index, and additional value, insert the value into array at given index. Do this without using builtin array methods. You can think of pushFront(arr,val) as equivalent to insertAt(arr,0,val).
function insertAt(arr, idx, val){ for(var i = arr.length-1; i >= idx; i--){ arr[i+1] = arr[i]; } arr[idx] = val; return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertAt(arr, index, value){\n var newArr = []\n for(var i=0; i<arr.length; i++){\n if(i!=index){\n newArr.push(arr[i])\n }else{\n newArr.push(value)\n newArr.push(arr[i])\n }\n }\n return newArr\n}", "function insertAt(arr,givenIndex,val...
[ "0.7725754", "0.76134586", "0.75591624", "0.74727887", "0.7434969", "0.7401545", "0.7336455", "0.7299504", "0.72849214", "0.7256696", "0.72527635", "0.72303015", "0.72258306", "0.71999097", "0.71917003", "0.71917003", "0.7189535", "0.7189535", "0.7189535", "0.7189535", "0.718...
0.7503642
3
Remove At Given an array and an index into array, remove and return the array value at that index. Do this without using builtin array methods except pop(). Think of popFront(arr) as equivalent to removeAt(arr,0).
function removeAt(arr, idx){ var val = arr[idx]; for(var i = idx; i<arr.length-1; i++){ arr[i-1] = arr[i]; } arr.pop(); return val; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeAt(arr, index){\n var array = arr;\n if (index == 0){\n return popFront(array);\n }\n else if(index == arr.length-1){\n return arr.pop();\n }\n else{\n for(var i = index; i<arr.length; i++){\n arr[i] = arr[i+1];\n }\n return arr.pop();\...
[ "0.81876206", "0.81367403", "0.794461", "0.7824795", "0.77818316", "0.77162725", "0.7700505", "0.76349115", "0.75685203", "0.7564488", "0.75287515", "0.7526307", "0.7519226", "0.7497839", "0.74393433", "0.7412568", "0.7368754", "0.73649156", "0.7364369", "0.72870135", "0.7284...
0.8081667
2
Swap Pairs Swap positions of successive pairs of values of given array. If length is odd, do not change the final element. For [1,2,3,4], return [2,1,4,3]. For example, change input ["Brendan",true,42] to [true,"Brendan",42]. As with all array challenges, do this without using any builtin array methods.
function swapPairs(arr){ for(var i = 0; i < arr.length-1; i +=2){ var temp = arr[i]; arr[i] = arr[i+1]; arr[i+1] = temp; } return arr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function swapPair(array) {\n for (let i = 0; i < array.length; i = i + 2) {\n let temp = array[i];\n array[i] = array[i + 1];\n array[i + 1] = temp;\n }\n return array\n}", "function swapPairs(arr){\n for (index = 0; index < arr.length-1; index+=2){\n var currentValue = ar...
[ "0.8306707", "0.81877214", "0.818235", "0.8176283", "0.81380266", "0.8034971", "0.78555745", "0.78019524", "0.7288094", "0.7224244", "0.7179455", "0.71563375", "0.7132818", "0.70742464", "0.7002432", "0.69978887", "0.6994309", "0.69589925", "0.6934937", "0.69307756", "0.69305...
0.8108733
5
Remove Duplicates Sara is looking to hire an awesome web developer and has received applications from various sources. Her assistant alphabetized them but noticed some duplicates. Given a sorted array, remove duplicate values. Because array elements are already in order, all duplicate values will be grouped together. As with all these array challenges, do this without using any builtin array methods.
function removeDuplicates(arr){ for(var i = 0; i < arr.length - 1; i++){ if (arr[i] == arr[i+1]){ for(var j = i+1; j < arr.length-1; j++){ arr[j] = arr[j+1]; } arr.pop(); i--; } } return arr }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeDuplicates(arr){\n var temp = arr[0]\n var newArr = []\n for(var i=0; i<arr.length; i++){\n for(var j=i+1; j<arr.length; j++){\n if(arr[i]>arr[j]){\n var temp = arr[i]\n arr[i] = arr[j]\n arr[j] = temp\n }else if(arr[...
[ "0.8012522", "0.79876727", "0.79805225", "0.7967352", "0.7954182", "0.78974235", "0.7892946", "0.78838116", "0.78569186", "0.7852667", "0.7844857", "0.78446144", "0.7830197", "0.7824041", "0.78185064", "0.78123415", "0.7795078", "0.7779378", "0.77693105", "0.7750867", "0.7750...
0.7605155
41
Second: Solve this without using any nested loops.
function removeDuplicates(arr){ newArr = []; for(var i = 0; i < arr.length - 1; i++){ if (arr[i] !== arr[i+1]){ newArr.push(arr[i]); } } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function problem9(){\n for(let a=1; a<1000; a++){\n for(let b=2; b<1000; b++){\n let c = 1000-a-b;\n if(Math.pow(a, 2) + Math.pow(b, 2) == Math.pow(c, 2)){\n if(a+b+c==1000){\n return a*b*c;\n }\n }\n }\n }\n}", "function problem9(){\n console.time('Problem 9 Runt...
[ "0.62331474", "0.6169299", "0.61488044", "0.6018406", "0.6015608", "0.59857", "0.5980656", "0.59473926", "0.58859736", "0.5848805", "0.58437765", "0.5836547", "0.58054435", "0.580505", "0.5780604", "0.5763232", "0.57576245", "0.5754042", "0.5740069", "0.5733125", "0.5727838",...
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new _Hash2.default(), 'map': new (_Map2.default || _ListCache2.default)(), 'string': new _Hash2.default() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemo...
[ "0.7590112", "0.70694387", "0.6735414", "0.6652174", "0.6530006", "0.6267597", "0.62582785", "0.62582785", "0.62582785", "0.617115", "0.617115", "0.617115", "0.6166302", "0.61519635", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614...
0.0
-1
Main render function. Returns the entire web view.
render() { const titleList = this.state.jsonList.map(json => json.default.title); return <div> <QuizSidebarView titleList={titleList} chosenTitle={this.state.chosenTitle} chooseTitle={(title) => this.chooseTitle(title)}/> <MainContentView chosenTitle={this.state.chosenTitle} vocabData={this.state.vocabData} percentCorrect={this.state.percentCorrect} changeColumns={event => this.changeColumns(parseInt(event.target.value))} onSubmit={event => this.onSubmit(event)} onCellChange={(ed, cn, nv) => this.onCellChange(ed, cn, nv)}/> </div>; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render(){ \n console.log('`render function` ran');\n const createdHtml = generateHtml(STORE); \n $('main').html(createdHtml);\n}", "function render() {\n\n const renderedString = createRenderString(store);\n\n // insert html into DOM\n $('main').html(renderedString);\n}", "function renderPage(...
[ "0.6661412", "0.6646226", "0.6537063", "0.65182096", "0.6509584", "0.6509584", "0.6509584", "0.6504274", "0.6493728", "0.6408705", "0.63855296", "0.6384394", "0.6331348", "0.6331348", "0.6308745", "0.63033193", "0.6284098", "0.62787366", "0.624372", "0.6233836", "0.6222645", ...
0.0
-1
localStorage is to access database document when header mounts, it updates user data
componentDidMount() { db.collection("users") .doc(JSON.parse(localStorage.getItem("currentUser"))) .get() .then(data => { if (data.exists) { this.setState({ user: data.data() }); } else { //console.log("Sad toot"); } }); db.collection("notifications") .where("user", "==", JSON.parse(localStorage.getItem("currentUser"))) .onSnapshot(data => { let tempNotifications = []; let activeNotificationCount = 0; data.forEach(doc => { if (!doc.data().seen) { activeNotificationCount++; } tempNotifications.push(doc.data()); }); this.setState({ unreadNotifications: activeNotificationCount, notifications: tempNotifications }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _storage() {\n localStorage.setObject(\"data\", data);\n }", "authListener() {\n fireDB.auth().onAuthStateChanged((user) => {\n // console.log(user);\n if (user) {\n this.setState({ user });\n localStorage.setItem('user', user.uid);\n }\n else {\n th...
[ "0.69975495", "0.6861488", "0.68300664", "0.68300664", "0.68300664", "0.68300664", "0.68300664", "0.68300664", "0.68254703", "0.6801854", "0.67586684", "0.6736687", "0.6725301", "0.67003655", "0.6691341", "0.66778934", "0.6630164", "0.6622576", "0.6618779", "0.6600993", "0.65...
0.0
-1
Renders the buttons to view/add contacts and sign out button and name of user
render() { return ( <div> <header style={headerStyle}> <div> <header> <img src={logo} height="117px" width="150px" alt="Schedule It" /> </header> </div> <Badge badgeContent={this.state.unreadNotifications} color="secondary" > <IconButton onClick = { () => this.handleClick()}> <NotificationsIcon /> </IconButton> </Badge> {this.state.displayNotifications && (this.NotificationBar())} {this.state.user && ( <div> <div style={headButtonStyle}> <Button variant="contained" color="primary" size="small" component={Link} to="/profile" > Profile </Button> <br /> <Button variant="contained" color="primary" size="small" component={Link} to="/home" > Events </Button> </div> </div> )} <h1>Schedule It!</h1> <AddContact/> <ViewContacts/> </header> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderButton() {\n gapi.signin2.render('signin2', {\n 'scope': 'profile email',\n 'width': 250,\n 'height': 40,\n 'longtitle': true,\n 'theme': 'dark',\n 'onsuccess': onSuccess,\n 'onfailure': onFailure\n });\n\n gapi.signin2.render('registrar-gmail', {\n '...
[ "0.6906894", "0.6351865", "0.633421", "0.630096", "0.6285893", "0.6275164", "0.6256585", "0.6218294", "0.6210114", "0.6203394", "0.61543024", "0.6149826", "0.60528225", "0.6037832", "0.6029114", "0.60170805", "0.5981362", "0.59717053", "0.5961457", "0.59417486", "0.5924075", ...
0.0
-1
temperature given net energy flux
function T(E) { return Math.pow( (1+0.75*τ)*E/σ, 1/4 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get temperature() {\n // convertimos los grados F a C\n this.temperature_F = 5 / 9 * (this.temperature_F - 32)\n return this.temperature_F;\n }", "function getTemperature() {\n local supplyVoltage = hardware.voltage();\n local voltage = supplyVoltage * Temperature.read() / 65535.0;\...
[ "0.67824554", "0.6734337", "0.66095454", "0.6387972", "0.6271911", "0.6207762", "0.6206055", "0.6205485", "0.61645764", "0.616168", "0.6155698", "0.61438036", "0.6124173", "0.61170906", "0.6104304", "0.6090675", "0.6086434", "0.6077741", "0.6060839", "0.60317683", "0.59290093...
0.0
-1
entropy production given heat flux
function N(F, Ih, Ic) { return 2*F/T(Ic+F) - 2*F/T(Ih-2*F); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get entropy(): number {\n return Math.log(this.xm * Math.exp(1 + (1 / this.alpha)) / this.alpha);\n }", "function y=entropy(x){\n var tot = 0.0;\n var ent = 0.0;\n for (i=0;i < x.length; i++){\n tot = tot + x[i]ˆ2;\n }\n for (i=0;i < x.length; i++){\n quo = x[i]ˆ2 / tot;\n ent = ent + (qu...
[ "0.6956874", "0.6861978", "0.6409794", "0.6056205", "0.6037323", "0.5792957", "0.5740514", "0.56954414", "0.56659", "0.5406377", "0.54034173", "0.5341467", "0.5341467", "0.53364915", "0.532671", "0.52795", "0.52520555", "0.5248344", "0.52233666", "0.5217854", "0.50936496", ...
0.0
-1
Example visitsOnCircularRoad(4, [1, 3, 2, 3, 1]) = 6 [input] integer N number of houses, positive integer [input] array.integer visitsOrder array of integers (each from 1 to N, inclusive) representing the order in which you have to visit the houses [output] integer
function visitsOnCircularRoad(N, visitsOrder) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getVisited(N, path) {\n let visited = [];\n for (let i = 0; i < N; ++i) {\n visited.push(Array(N).fill(0));\n }\n for (let i = 0; i < path.length; ++i) {\n visited[path[i].x][path[i].y] = 1;\n }\n return visited;\n}", "function trafficLights(road, n) {\n let light = \"GGGGGORRRRR\", len = r...
[ "0.5509539", "0.5298958", "0.5269518", "0.523038", "0.5157829", "0.5148995", "0.5016139", "0.49939433", "0.49744463", "0.49469608", "0.4933737", "0.4922471", "0.4922157", "0.48955822", "0.48748708", "0.48640907", "0.4854382", "0.48463464", "0.48387396", "0.48375332", "0.47902...
0.85657865
0
Refactor it to use the rest operator & an arrow function:
function filterOutOdds2(...nums) { return nums.filter((num) => { return num % 2 === 0; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sum_rest(...args){\r\n return args.reduce((accumulator, currentValue) => accumulator + currentValue); //using reduce...\r\n} //Rest Operator", "function myFunc2(x, y, ...params) { // used rest operator here\n console.log(x);\n console.log(y);\n console.log(params);\n}", "function rest(func, start...
[ "0.66418713", "0.6440785", "0.6416414", "0.6332658", "0.62863636", "0.62863636", "0.62863636", "0.62863636", "0.62863636", "0.62376803", "0.6182729", "0.60466164", "0.59727275", "0.59533733", "0.5938479", "0.5837563", "0.5813539", "0.57947344", "0.57632804", "0.5755494", "0.5...
0.0
-1
findMin Write a function called findMin that accepts a variable number of arguments and returns the smallest argument. Make sure to do this using the rest and spread operator.
function findMin(...nums) { return Math.min(...nums); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMin(...args){\n return Math.min(...args);\n}", "function smallestValue(...args) {\n return Math.min(...args);\n}", "function smallestValue(){\n return Math.min(...arguments);\n}", "function min(arg1, arg2) {\nreturn Math.min(arg1,arg2);\n}", "function findSmallest(...args) {\n if (ar...
[ "0.8788209", "0.7727407", "0.7646311", "0.751521", "0.7501856", "0.7474693", "0.7242972", "0.7234295", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0.7186538", "0...
0.8188229
1
mergeObjects Write a function called mergeObjects that accepts two objects and returns a new object which contains all the keys and values of the first object and second object.
function mergeObjects(obj1, obj2) { let newObj = { ...obj1, ...obj2 }; return newObj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merge_objects(object1, object2) {\n var returnVal = {};\n for (var attrname in object1) { \n returnVal[attrname] = object1[attrname]; \n }\n for (var attrname in object2) { \n returnVal[attrname] = object2[attrname]; \n }\n return returnVal;\n}", "function merge(obj1, obj2) {...
[ "0.80321646", "0.7889169", "0.7830029", "0.78103817", "0.7776578", "0.7775974", "0.7734152", "0.77321243", "0.76817393", "0.7667503", "0.7597749", "0.7561148", "0.75608075", "0.7521532", "0.7502138", "0.74856585", "0.7462711", "0.74022883", "0.7285831", "0.7273806", "0.722707...
0.74890834
15
doubleAndReturnArgs Write a function called doubleAndReturnArgs which accepts an array and a variable number of arguments. The function should return a new array with the original array values and all of additional arguments doubled.
function doubleAndReturnArgs(arr, ...args) { let doubled = args.map((n) => { return n * 2; }); let newArr = [...arr, ...doubled]; return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doubleAndReturnArgs(arr, ...nums){\n nums.map( val => {\n const double = val * 2;\n arr.push(double);\n })\n return arr;\n}", "function doubleAndReturnArgs(arr, ...args){\n let arr3 = [];\n for(let i = 0; i<args.length; i++){\n args[i] = args[i]*2;\n ...
[ "0.7549442", "0.7187676", "0.62261486", "0.5721777", "0.5678434", "0.5677294", "0.5647463", "0.56424785", "0.5636388", "0.5633119", "0.5597416", "0.55798703", "0.5576592", "0.55719614", "0.5571896", "0.5571896", "0.55590534", "0.5553125", "0.55367666", "0.55233586", "0.550415...
0.80535555
0
enables buttons when document is saved
function checkDisabled() { var newDoc = jQuery('#doc_id').val().length === 0 ? true : false; console.log("CHECKING", newDoc, 'doc', jQuery('#doc_id').val().length) jQuery('button').each(function(){ var el = jQuery(this); console.log('button',el.attr('id')) if(!newDoc){ el.attr('disabled', false) if(el.attr('id')==='createNewFile'){ el.attr('disabled', true) } } else { el.attr('disabled', true); if(el.attr('id')==='createNewFile' || el.attr('id')==='saveToSystem'){ el.attr('disabled', false) } } }) var inp = jQuery('#loadFile')[0]; if(!newDoc){ jQuery(inp).attr('disabled', true) } else { console.log("NEW") jQuery(inp).attr('disabled', false) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function enableSaveButton() {\n $('#save-changes').attr('disabled', false);\n }", "function enable_save() {\n save_button.prop('disabled', false)\n }", "function enableButtons()\n {\n //show buttons for updating and creating new workflow\n $(\"#perc-update-wf-save-cance...
[ "0.7352359", "0.7298365", "0.698499", "0.6774256", "0.6762625", "0.67205465", "0.66575193", "0.6587052", "0.6587052", "0.6565777", "0.6418114", "0.640216", "0.6382944", "0.63538283", "0.6349965", "0.6320659", "0.63161826", "0.63161826", "0.6315418", "0.6281365", "0.6272732", ...
0.6182171
24
create funtion to convert distance response from meters to miles.
function LengthConverter(valNum) { return valNum * 0.000621371; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function distanceToMiles(distance) {\r\n\tswitch(distance) {\r\n\t\tcase \"miles\":\r\n\t\t\treturn 1.00;\r\n\t\tcase \"km\":\r\n\t\t\treturn 0.621371;\r\n\t\tcase \"m\":\r\n\t\t\treturn 0.000621371;\r\n\t\tcase \"yds\":\r\n\t\t\treturn 0.000568182;\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t}\r\n}", "function k...
[ "0.7143141", "0.7043965", "0.7009326", "0.6981397", "0.67985237", "0.6760776", "0.6753371", "0.6753371", "0.6753371", "0.6743304", "0.672005", "0.6626389", "0.6490908", "0.6422916", "0.63950247", "0.6384015", "0.6322528", "0.63153267", "0.627966", "0.625626", "0.6163322", "...
0.0
-1
Start Quote creation function
function quote() { // define variable used throughout. let quote = 0 let wagePerMile = .30; let wageExpense = wagePerMile * distanceInMiles; let milesPerGallon = 7.75; let fuelCostPerGallon = 3.00; let fuelExpense = (distanceInMiles / milesPerGallon) * fuelCostPerGallon; let margins = [1.3, 1.5, 1.7, 1.9] //create cost plus quote tool. Simplified to only Fuel and Wage Expense consideration. function costPlusQuote() { if (distanceInMiles >= 100) { quote = (wageExpense + fuelExpense) * margins[3]; return quote } else if (distanceInMiles >= 500) { quote = (wageExpense + fuelExpense) * margins[2]; return quote } else if (distanceInMiles >= 1000) { quote = (wageExpense + fuelExpense) * margins[1]; return quote } else { quote = (wageExpense + fuelExpense) * margins[0]; return quote } } //hard coded quote for short distance deliveries if (distanceInMiles < 20) { quote = 69.98 return quote } else if (distanceInMiles < 40) { quote = 99.98 return quote } else if (distanceInMiles < 60) { quote = 129.98 return quote } else if (distanceInMiles < 100) { quote = 179.98 return quote } else if (distanceInMiles >= 100) { quote = costPlusQuote() return quote } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initializeQuote() {\n clearQuote()\n printQuote()\n}", "generateQuotes() {\n this.pickColor();\n this.createQuotes();\n this.showQuotes = true;\n }", "function inspiringQuote() {\r\n // Example quotes: \r\n // \"If opportunity doesn't knock, build a door.\"\r\n // \"The best...
[ "0.7323007", "0.71851426", "0.71341926", "0.70016706", "0.67437196", "0.6587179", "0.65560263", "0.652185", "0.64967555", "0.6450138", "0.64295393", "0.6413235", "0.6373851", "0.6354023", "0.6348059", "0.629165", "0.6284268", "0.62644905", "0.62378347", "0.6191279", "0.618193...
0.0
-1
create cost plus quote tool. Simplified to only Fuel and Wage Expense consideration.
function costPlusQuote() { if (distanceInMiles >= 100) { quote = (wageExpense + fuelExpense) * margins[3]; return quote } else if (distanceInMiles >= 500) { quote = (wageExpense + fuelExpense) * margins[2]; return quote } else if (distanceInMiles >= 1000) { quote = (wageExpense + fuelExpense) * margins[1]; return quote } else { quote = (wageExpense + fuelExpense) * margins[0]; return quote } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function quote() {\n // define variable used throughout.\n let quote = 0\n let wagePerMile = .30;\n let wageExpense = wagePerMile * distanceInMiles;\n let milesPerGallon = 7.75;\n let fuelCostPerGallon = 3.00;\n ...
[ "0.7128645", "0.63782185", "0.60985327", "0.604387", "0.59234446", "0.5885747", "0.57938397", "0.57856613", "0.57852054", "0.5750358", "0.5707515", "0.5677232", "0.5673549", "0.5603479", "0.5510755", "0.5503837", "0.54783404", "0.5474233", "0.54241496", "0.54219085", "0.53820...
0.6750842
1
Extract the `maxEntityCount` longest words
function extractEntities(text) { return text.split(/[ \t\n\r\.\?!,;]+/) .sort(function (a, b) { return b.length - a.length; }) .slice(0, maxEntityCount); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestWord(sentence) {\n const arrayOfSentences = sentence.split(' '); \n const countLength = arrayOfSentences.map( word => word.length); \n const longestWordCount = Math.max(...countLength); \n const longestWordInSentence = arrayOfSentences.find( word => word.length === longestWordCount); \...
[ "0.7185652", "0.7153595", "0.7100343", "0.6926611", "0.6916593", "0.6908991", "0.6881978", "0.6870416", "0.68656486", "0.68339664", "0.6828478", "0.6823131", "0.680619", "0.67583174", "0.674987", "0.67481285", "0.6740096", "0.6732261", "0.6721669", "0.67136055", "0.66983426",...
0.0
-1
Common function for numbers
function buttonPress(clickId,displayId,number){ const clickBtn= document.getElementById(clickId); clickBtn.addEventListener("click", function(){ document.getElementById(displayId).value+= number; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function leastCommonMultiple(num1, num2){\n // your code here...\n}", "function commonIntegers(arr1, arr2) { }", "function smallestCommons(arr) {\n // sort arr in an ascending order\n arr = arr.sort((a, b) => a - b);\n // create an arr that holds all number between the two nums\n const newArr = [];\n for...
[ "0.7545415", "0.6699605", "0.66207325", "0.6569155", "0.6482158", "0.6453208", "0.6430628", "0.64250064", "0.6408187", "0.63864326", "0.63656247", "0.63138235", "0.6300607", "0.62900317", "0.6275914", "0.6273961", "0.626695", "0.6250913", "0.62472653", "0.6237102", "0.6221782...
0.0
-1
triangular prism: ABC is triangle; square base in ABD plane
constructor(shapes, vtxA, edgeAB, edgeAC, edgeAD, baseColour, material) { let adjVtxA = vecPlus(vecPlus(vecPlus(vtxA, vecScalar(LITTLE_SPACE, vecNormalize(edgeAB))), vecScalar(LITTLE_SPACE, vecNormalize(edgeAC))), vecScalar(LITTLE_SPACE, vecNormalize(edgeAD))); let adjEdgeAB = vecMinus(edgeAB, vecScalar(2 * LITTLE_SPACE, vecNormalize(edgeAB))); let adjEdgeAC = vecMinus(edgeAC, vecScalar(2 * LITTLE_SPACE, vecNormalize(edgeAC))); let adjEdgeAD = vecMinus(edgeAD, vecScalar(2 * LITTLE_SPACE, vecNormalize(edgeAD))); let oppVtx = vecPlus(vecPlus(adjVtxA, adjEdgeAC), adjEdgeAD); let adjEdgeCA = vecScalar(-1, adjEdgeAC); let adjEdgeCB = vecPlus(adjEdgeCA, adjEdgeAB); let adjEdgeDA = vecScalar(-1, adjEdgeAD); shapes.push(new Triangle(adjVtxA, adjEdgeAC, adjEdgeAB, baseColour, material)); shapes.push(new Square(adjVtxA, adjEdgeAD, adjEdgeAC, baseColour, material)); shapes.push(new Square(adjVtxA, adjEdgeAB, adjEdgeAD, baseColour, material)); shapes.push(new Triangle(oppVtx, adjEdgeCA, adjEdgeCB, baseColour, material)); shapes.push(new Square(oppVtx, adjEdgeCB, adjEdgeDA, baseColour, material)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Triangle(p1, p2, p3) {\n this.blockers = [0,0,0,0,0,0,0,0,0,0];\n this.pos = [p1,p2,p3];\n //this.bounds = bounds(this.pos);\n var edge1 = sub(p3, p1);\n var edge2 = sub(p2, p1);\n var normal = cross(edge1, edge2);\n var axis;\n if (Math.abs(normal[0]) > Math.abs(normal[1]))\n ...
[ "0.6570879", "0.6083228", "0.6054636", "0.6017712", "0.59751153", "0.5951285", "0.5941518", "0.5940569", "0.591256", "0.5833844", "0.5826384", "0.5822323", "0.576162", "0.5740653", "0.5728749", "0.57105875", "0.5684311", "0.5673756", "0.5667233", "0.5664533", "0.5664454", "...
0.0
-1
start with cube, cut off corners (which is why A is called chopped vertex; B, C, D are also chopped)
constructor(shapes, choppedVtxA, edgeAB, edgeAC, edgeAD, baseColourSquare, baseColourTriangle, material) { let adjVtxA = vecPlus(vecPlus(vecPlus(choppedVtxA, vecScalar(LITTLE_SPACE, vecNormalize(edgeAB))), vecScalar(LITTLE_SPACE, vecNormalize(edgeAC))), vecScalar(LITTLE_SPACE, vecNormalize(edgeAD))); // create 12 vertices: combinations of up/down, nesw; A is down south west. let ds = vecPlus(adjVtxA, vecScalar(0.5 - LITTLE_SPACE / vecLength(edgeAB), edgeAB)); let dw = vecPlus(adjVtxA, vecScalar(0.5 - LITTLE_SPACE / vecLength(edgeAC), edgeAC)); let dn = vecPlus(ds, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAC), edgeAC)); let de = vecPlus(dw, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAB), edgeAB)); let sw = vecPlus(adjVtxA, vecScalar(0.5 - LITTLE_SPACE / vecLength(edgeAD), edgeAD)); let nw = vecPlus(sw, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAC), edgeAC)); let ne = vecPlus(nw, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAB), edgeAB)); let se = vecPlus(sw, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAB), edgeAB)); let un = vecPlus(dn, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAD), edgeAD)); let ue = vecPlus(de, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAD), edgeAD)); let us = vecPlus(ds, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAD), edgeAD)); let uw = vecPlus(dw, vecScalar(1 - 2 * LITTLE_SPACE / vecLength(edgeAD), edgeAD)); shapes.push(new Square(ds, vecMinus(dw, ds), vecMinus(de, ds), baseColourSquare, material)); shapes.push(new Square(ne, vecMinus(dn, ne), vecMinus(un, ne), baseColourSquare, material)); shapes.push(new Square(se, vecMinus(de, se), vecMinus(ue, se), baseColourSquare, material)); shapes.push(new Square(sw, vecMinus(ds, sw), vecMinus(us, sw), baseColourSquare, material)); shapes.push(new Square(nw, vecMinus(dw, nw), vecMinus(uw, nw), baseColourSquare, material)); shapes.push(new Square(us, vecMinus(ue, us), vecMinus(uw, us), baseColourSquare, material)); shapes.push(new Triangle(dn, vecMinus(ne, dn), vecMinus(de, dn), baseColourTriangle, material)); shapes.push(new Triangle(de, vecMinus(se, de), vecMinus(ds, de), baseColourTriangle, material)); shapes.push(new Triangle(ds, vecMinus(sw, ds), vecMinus(dw, ds), baseColourTriangle, material)); shapes.push(new Triangle(dw, vecMinus(nw, dw), vecMinus(dn, dw), baseColourTriangle, material)); shapes.push(new Triangle(un, vecMinus(ue, un), vecMinus(ne, un), baseColourTriangle, material)); shapes.push(new Triangle(ue, vecMinus(us, ue), vecMinus(se, ue), baseColourTriangle, material)); shapes.push(new Triangle(us, vecMinus(uw, us), vecMinus(sw, us), baseColourTriangle, material)); shapes.push(new Triangle(uw, vecMinus(un, uw), vecMinus(nw, uw), baseColourTriangle, material)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cube() {\r\n\r\n var half = 0.5\r\n var verts = [vec4(-half,-half,-half,1),\r\n vec4(half,-half,-half,1),\r\n vec4(half,half,-half,1),\r\n vec4(-half,half,-half,1),\r\n vec4(-half,-half,half,1),\r\n vec4(half,-half,half,1),\r\n vec4(half,half,h...
[ "0.70214194", "0.6837793", "0.6835355", "0.6796771", "0.67862576", "0.6647521", "0.6616111", "0.6613463", "0.66053677", "0.65591735", "0.65470624", "0.6525572", "0.6489256", "0.6488979", "0.64573", "0.64536047", "0.64477754", "0.6440975", "0.64289355", "0.64133215", "0.640372...
0.59953904
44
normally use this instead of Sphere (to leave a LITTLE_SPACE)
constructor(shapes, centre, radius, baseColour, material) { shapes.push(new Sphere(centre, radius - LITTLE_SPACE, baseColour, material)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sphere(radius){\n return -1;\n }", "function Sphere1 (long, lat) {\n\n\tthis.name = \"sphere1\";\n\n\t// vertices definition\n\t////////////////////////////////////////////////////////////\n\n\tthis.vertices = new Float32Array(3*((long-1)*(lat)+2));\n\n\tvar radius = 1.0;\n\t...
[ "0.72197133", "0.7072936", "0.69413495", "0.6919556", "0.6755058", "0.6678764", "0.6669101", "0.6664157", "0.66466975", "0.65996385", "0.6588764", "0.65769297", "0.65568393", "0.6555605", "0.6535018", "0.64854836", "0.64698905", "0.6453539", "0.6429646", "0.6426424", "0.63948...
0.6419356
20
normalDir points away from hemisphere direction (so disc is on top)
constructor(shapes, centre, radius, normalDir, truncateMin, truncateMax, baseColour, material) { let adjTrMin = (truncateMin == undefined) ? LITTLE_SPACE : truncateMin + LITTLE_SPACE; let adjTrMax = (truncateMax == undefined) ? undefined : truncateMax - LITTLE_SPACE; shapes.push(new Hemisphere(centre, radius - LITTLE_SPACE, vecScalar(-1, normalDir), adjTrMin, adjTrMax, true, baseColour, material)); shapes.push(new Disc(vecPlus(centre, vecScalar(-1 * adjTrMin, vecNormalize(normalDir))), Math.sqrt((radius - LITTLE_SPACE) ** 2 - adjTrMin ** 2), normalDir, baseColour, material)); if (truncateMax < radius) { // possibly add cap on other end shapes.push(new Disc(vecPlus(centre, vecScalar(-1 * adjTrMax, vecNormalize(normalDir))), Math.sqrt((radius - LITTLE_SPACE) ** 2 - adjTrMax ** 2), vecScalar(-1, normalDir), baseColour, material)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "normal() {\n return new Vector(-this.y, this.x);\n }", "get normal (){\n\t\treturn this.dir.perp(1);\t\t\t\n\t}", "getNormal(ray) {\r\n let normal = createVector(this.nx, this.ny, this.nz);\r\n return normal;\r\n }", "function planeNormal(cords,origo){\r\n\tvar origo = getOrigo(cords);\r\n\t...
[ "0.64821297", "0.61553276", "0.61514413", "0.6123156", "0.60881287", "0.6060835", "0.6056314", "0.6033127", "0.6031257", "0.5992265", "0.5950068", "0.5940571", "0.5886306", "0.5880572", "0.5700214", "0.5696424", "0.5696416", "0.5687849", "0.568044", "0.56798613", "0.5672507",...
0.0
-1
normalDir points in direction of rim to do: add truncate; see Halfball
constructor(shapes, centre, outerRadius, innerRadius, normalDir, baseColour, material) { shapes.push(new Hemisphere(centre, outerRadius - LITTLE_SPACE, vecScalar(-1, normalDir), 0, undefined, true, baseColour, material)); shapes.push(new Hemisphere(centre, innerRadius + LITTLE_SPACE, vecScalar(-1, normalDir), 0, undefined, false, baseColour, material)); shapes.push(new Annulus(centre, outerRadius - LITTLE_SPACE, innerRadius + LITTLE_SPACE, normalDir, baseColour, material)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "normalize() {var m = this.magnitude();return new M.XY(this.x/m,this.y/m);}", "get normalSmoothingAngle() {}", "function rNormal(v) {\n return [-v[1], v[0]];\n}", "get normal (){\n\t\treturn this.dir.perp(1);\t\t\t\n\t}", "function normal() {\n var x = 0, y = 0, rds, c;\n do {\n ...
[ "0.58063906", "0.5772381", "0.57211167", "0.5645201", "0.56316406", "0.5538989", "0.54273814", "0.5422722", "0.5418578", "0.5414283", "0.5410168", "0.5371051", "0.5323503", "0.5317704", "0.5310101", "0.528575", "0.52818364", "0.52776074", "0.52734673", "0.52715015", "0.526303...
0.0
-1
to do: add other kinds of lamps
constructor(shapes, lights, centre, radius, dir, wattage, colour) { new Bowl(shapes, centre, 1.3 * radius, 1.125 * radius, dir, COL_RAW_UMBER, MAT_COPPER); // 1.125 is slightly bigger than sqrt(5)/2, to make sure that light (Which is set back by 0.5 * radius) fits inside let s = shapes.push(new Disc(vecPlus(centre, vecScalar(-0.5 * radius, vecNormalize(dir))), radius, dir)); //let s = shapes.push(new Disc(vecPlus(centre, vecScalar(-0.25 * radius, vecNormalize(dir))), radius, dir)); lights.push(s - 1); // store index of light shape so that we can easily find all lights later shapes[s - 1].isLight = true; shapes[s - 1].wattage = wattage; shapes[s - 1].lightColour = colour || COL_WHITE; shapes[s - 1].area = Math.PI * radius ** 2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addAnchorL() {\n var pole = addStreetPostsL();\n\n pole.lightPost.position.z = -4770;\n pole.light.position.z = -4770;\n}", "lazer() {\n\t\tif( this.lzfrm > this.lzrcd ) {\n\t\t\tthis.lzfrm = 0;\n\t\t\tif( this.lzlvl === 1 ) {\n\t\t\t\tfor( let i = 0; i < 3; i++ ) {\n\t\t\t\t\tlet l = new game....
[ "0.5893373", "0.55869484", "0.55859613", "0.5584959", "0.55817443", "0.5567501", "0.55049103", "0.54984266", "0.5491098", "0.5417446", "0.53951883", "0.538479", "0.5353361", "0.53365964", "0.53302836", "0.53284794", "0.52934015", "0.5276247", "0.5273426", "0.52718395", "0.527...
0.0
-1
to do: make Cup class (cylinder with 1 cap)
constructor(centre, axis, radius, halfHeight, convex, baseColour, material) { super(); this.type = 'cylinder'; this.centre = centre; this.axis = vecNormalize(axis); this.radius = radius; this.halfHeight = halfHeight; this.convex = convex; // if true, surface points away from centre this.baseColour = baseColour || COL_WHITE; this.material = material; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cylinder(radius, height) { \n this.radius = radius;\n this.height = height;\n}", "cylinder() {\n const context = GameState.current;\n\n Helper.strewnSprite(\n Helper.getMember(GroupPool.cylinder().members),\n { y: context.game.stage.height },\n { y: 10 }\n );\n }", "...
[ "0.67385596", "0.6442819", "0.63018763", "0.6282985", "0.62481815", "0.6239022", "0.6080669", "0.6076098", "0.6002913", "0.5960613", "0.5948586", "0.5948586", "0.5933279", "0.5914887", "0.5889724", "0.5876861", "0.58633804", "0.5858091", "0.58480823", "0.58448267", "0.5844435...
0.55439126
40
normalDir points towards half that exists; truncate is minimum distance along normal
constructor(centre, radius, normalDir, truncateMin, truncateMax, convex, baseColour, material) { super(); this.type = 'hemisphere'; this.centre = centre; this.radius = radius; this.normalDir = vecNormalize(normalDir); this.truncateMin = truncateMin; this.truncateMax = truncateMax; this.convex = convex; // if true, surface points away from centre this.baseColour = baseColour || COL_FIRE_ENGINE_RED; this.material = material; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normal() {\n var x = 0, y = 0, rds, c;\n do {\n x = Math.random() * 2 - 1;\n y = Math.random() * 2 - 1;\n rds = x * x + y * y;\n } while (rds == 0 || rds > 1);\n c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform\n ...
[ "0.6211654", "0.60927176", "0.6062477", "0.6042828", "0.5994514", "0.59921575", "0.59895873", "0.5953759", "0.588887", "0.5885768", "0.588406", "0.5874191", "0.5871589", "0.58543205", "0.584321", "0.5826144", "0.5825823", "0.5802158", "0.57707745", "0.5756922", "0.57461244", ...
0.0
-1
to do: try moving this out of class to see if it speeds things up
intersectDist(shape) { switch (shape.type) { case 'plane': { let a = shape.origin; let n = shape.normalDir; if (Math.abs(vecDot(this.dir, n)) < EPSILON) { return undefined; } let t = vecDot(vecMinus(a, this.origin), n) / vecDot(this.dir, n); return t > EPSILON ? t : undefined; } case 'sphere': { let a = 1; let halfB = vecDot(this.dir, vecMinus(this.origin, shape.centre)); let c = vecSqLength(vecMinus(this.origin, shape.centre)) - shape.radius * shape.radius; let t = qRoots(a, halfB, c); if (t == undefined) { return undefined; } else { if (t[0] > EPSILON) { return t[0]; } else { if (t[1] > EPSILON) { return t[1]; } } } return undefined; } case 'hemisphere': { let a = 1; let halfB = vecDot(this.dir, vecMinus(this.origin, shape.centre)); let c = vecSqLength(vecMinus(this.origin, shape.centre)) - shape.radius * shape.radius; let t = qRoots(a, halfB, c); if (t == undefined) { return undefined; } else { for (let i in [0, 1]) { // check intersections to see whether they're in positive direction along ray and in the proper halfspace (at distance within min / max truncation) if (t[i] > EPSILON) { let pos = vecPlus(this.origin, vecScalar(t[i], this.dir)); let proj = vecDot(vecMinus(pos, shape.centre), shape.normalDir); if (proj > shape.truncateMin && (shape.truncateMax == undefined || proj < shape.truncateMax)) { return t[i]; } } } return undefined; } } case 'cylinder': { let centre = shape.centre; let axis = shape.axis; let h = shape.halfHeight; let v = vecMinus(this.origin, centre); let vd = vecDot(v, this.dir); let va = vecDot(v, axis); let da = vecDot(this.dir, axis); let a = 1 - da * da; let halfB = vd - va * da; let c = vecSqLength(v) - va * va - shape.radius * shape.radius; let t = qRoots(a, halfB, c); if (t == undefined) { return undefined; } else { for (let i in [0, 1]) { // check intersections to see whether they're in positive direction along ray and in the proper halfspace (at distance within min / max truncation) if (t[i] > EPSILON) { if (h == undefined) { return t[i]; } // cylinder is infinite; no need to check height let pos = vecPlus(this.origin, vecScalar(t[i], this.dir)); if (Math.abs(vecDot(vecMinus(pos, centre), axis)) < h - EPSILON) { return t[i]; } // hits within height of cylinder } } return undefined; } } case 'triangle': { // Möller-Trumbore algorithm let h = vecCross(this.dir, shape.edgeAC); let a = vecDot(shape.edgeAB, h); if (a > -EPSILON && a < EPSILON) { return undefined; } let f = 1 / a; let s = vecMinus(this.origin, shape.vtxA); let u = f * vecDot(s, h); if (u < 0 || u > 1) { return undefined; } let q = vecCross(s, shape.edgeAB); let v = f * vecDot(this.dir, q); if (v < 0 || u + v > 1) { return undefined; } let t = f * vecDot(shape.edgeAC, q); return (t > EPSILON) ? t : undefined; } case 'square': { // Möller-Trumbore algorithm let h = vecCross(this.dir, shape.edgeAC); let a = vecDot(shape.edgeAB, h); if (a > -EPSILON && a < EPSILON) { return undefined; } let f = 1 / a; let s = vecMinus(this.origin, shape.vtxA); let u = f * vecDot(s, h); if (u < 0 || u > 1) { return undefined; } let q = vecCross(s, shape.edgeAB); let v = f * vecDot(this.dir, q); if (v < 0 || v > 1) { return undefined; } let t = f * vecDot(shape.edgeAC, q); return (t > EPSILON) ? t : undefined; } case 'disc': { let c = shape.centre; let n = shape.normalDir; if (Math.abs(vecDot(this.dir, n)) < EPSILON) { return undefined; } let t = vecDot(vecMinus(c, this.origin), n) / vecDot(this.dir, n); if (t > EPSILON) { // hits plane of disc; now check radius let pos = vecPlus(this.origin, vecScalar(t, this.dir)); return (vecSqLength(vecMinus(c, pos)) + EPSILON < shape.radius * shape.radius) ? t : undefined; } return undefined; } case 'annulus': { let c = shape.centre; let n = shape.normalDir; if (Math.abs(vecDot(this.dir, n)) < EPSILON) { return undefined; } let t = vecDot(vecMinus(c, this.origin), n) / vecDot(this.dir, n); if (t > EPSILON) { // hits plane of disc; now check radii let pos = vecPlus(this.origin, vecScalar(t, this.dir)); let rSq = vecSqLength(vecMinus(c, pos)); return (rSq + EPSILON < shape.outerRadius * shape.outerRadius && rSq - EPSILON > shape.innerRadius * shape.innerRadius) ? t : undefined; } return undefined; } default: { throw new Error(`I didn't recognize the shape! (${shape.type})`); return undefined; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "transient final protected i...
[ "0.6915414", "0.6423196", "0.6387036", "0.6337244", "0.6279634", "0.6278542", "0.6230182", "0.5977244", "0.59593546", "0.5890135", "0.58002996", "0.57297194", "0.5661892", "0.5658817", "0.56187844", "0.5598312", "0.5585906", "0.5537205", "0.5516622", "0.5513442", "0.5442679",...
0.0
-1
now bubble sort, making sure not to bubble a small tile past a larger one if they overlap
function bubbleSort(ary) { var length = ary.length; for (let i = length - 2; i >= 0; i--) { for (let j = i; j < length - 1; j++) { if ( (ary[j].region[0] >= ary[j+1].region[0] + tileSize * SUPER_SAMPLE_BASE ** ary[j+1].scale) || (ary[j].region[1] >= ary[j+1].region[1] + tileSize * SUPER_SAMPLE_BASE ** ary[j+1].scale) || (ary[j+1].region[0] >= ary[j].region[0] + tileSize * SUPER_SAMPLE_BASE ** ary[j].scale) || (ary[j+1].region[1] >= ary[j].region[1] + tileSize * SUPER_SAMPLE_BASE ** ary[j].scale)) { // tiles don't overlap; okay to compare them and bubble if appropriate if (ary[j].photonDiff >= ary[j+1].photonDiff) { var temp = ary[j]; ary[j] = ary[j+1]; ary[j+1] = temp; } } else { // tiles overlap: stop bubbling! (otherwise small tile will be drawn before larger one; final picture will be wrong) break; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bubblesortalgo() {\n c_delay = 0;\n\n for (var i = 0; i < array_size - 1; i++) {\n for (var j = 0; j < array_size - i - 1; j++) {\n div_update(divs[j], div_size[j], \"#ffff66\");\n\n if (div_size[j] > div_size[j + 1]) {\n div_update(divs[j], div_size[j], \"#ff4d4d\");\n div_up...
[ "0.698849", "0.67776304", "0.673197", "0.66906404", "0.66821307", "0.66729784", "0.6627691", "0.6570449", "0.653104", "0.6525639", "0.6497038", "0.64674747", "0.6459792", "0.64274555", "0.6425867", "0.64096034", "0.640436", "0.638374", "0.637243", "0.63717073", "0.6361364", ...
0.8028502
0
Get current user info
function userProfile() { return baseUser().get(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getInfo() {\n let userResult = await this.request(\"user\");\n return userResult.user;\n }", "async function getUserInfo() {\n let userData = await Auth.currentAuthenticatedUser();\n setUser(userData.username);\n setUserEmail(userData.attributes.email);\n }", "function getCurre...
[ "0.8006106", "0.79776895", "0.7950321", "0.78781956", "0.7745532", "0.76878273", "0.7674154", "0.76719385", "0.7607484", "0.7575131", "0.7558404", "0.75564694", "0.74728477", "0.74555063", "0.7452981", "0.744574", "0.74434996", "0.7383859", "0.73621887", "0.7360771", "0.73553...
0.73733056
18
PUT update user info
function updateProfile(user) { return baseUser().customPUT(user); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateUserInfo(id, user) {\n}", "function putEditedUser(updatedUserInfo) {\r\n toggleSpinner();\r\n fetch(`https://jsonplaceholder.typicode.com/users/${updatedUserInfo.id}`, {\r\n method: \"PUT\",\r\n body: JSON.stringify(updatedUserInfo),\r\n headers: {\r\n \"Content-type\":...
[ "0.7436698", "0.7381642", "0.7352143", "0.73056036", "0.7295463", "0.7234053", "0.7226985", "0.7215733", "0.72112095", "0.7207129", "0.71910304", "0.7154218", "0.71435773", "0.7123887", "0.7121627", "0.712035", "0.70969504", "0.7077833", "0.7070031", "0.7067058", "0.7060589",...
0.7057626
21
POST check if email changed and if exist
function emailExistUpdate(email) { var emailObj = { 'value':email }; return baseAuth().post('email', emailObj); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkEmail() {}", "function update_email(){\n\tvar username = localStorage.getItem('username');\n\tvar email = localStorage.getItem('email');\n\tvar newEmail = $(\"#updateemail\").val();\n\tif (email.trim()!==newEmail.trim()){\n\t\temail_check(newEmail).then(function(){\n\t\t\tlet inputs = {\n\t\t\t\t\t...
[ "0.6913957", "0.68793255", "0.68517464", "0.67890346", "0.67428994", "0.6590057", "0.64795387", "0.64694446", "0.6449407", "0.644843", "0.64083487", "0.63778144", "0.63719666", "0.6366726", "0.63586766", "0.6317905", "0.6312827", "0.628798", "0.6287641", "0.62812865", "0.6260...
0.8047873
0
The actual plugin constructor
function Plugin( element, options ) { this.element = element; this.options = $.extend( {}, defaults, options ); this._defaults = defaults; this._name = pluginName; this.init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this._init();\n }", "constructor() {\n\t\t// ...\n\t}", "consructor() {\n }", "constructor() {\r\n super()\r\n this.init()\r\n }", "init() {\n }", "constructor()\n {\n this.init();\n }", "function contruct() {\n\n ...
[ "0.7422684", "0.7349132", "0.7314277", "0.73003334", "0.7299704", "0.7292701", "0.72775894", "0.72354233", "0.7233936", "0.7181569", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71798736", "0.71761876", "0.7157667", "0.71499527", "0.71496284", "0.71496284", "0.7...
0.0
-1
this is a contorted version of floodbad (below) that doesn't use recursion because it was exceeding the maximum call stack length
flood(xpos, ypos, id) { const kStart = 0; const kUp = 1; const kRight = 2; const kDown = 3; let stack = [[xpos, ypos, kStart]]; while (stack.length > 0) { let elt = stack.pop(); xpos = elt[0]; ypos = elt[1]; switch (elt[2]) { case kStart: if (!this.img) { console.log('missing img'); } if (!this.img[ypos]) { console.log(`missing img[${ypos}]`); } if (!this.img[ypos].length) { console.log(`missing img[${ypos}].length`); } if (this.img[ypos][xpos] != 0) continue; if (this.idImg[ypos][xpos] > 0) continue; // already has an ID this.idImg[ypos][xpos] = id; if (xpos > 0) { stack.push([xpos, ypos, kUp]); stack.push([xpos - 1, ypos, kStart]); continue; } case kUp: if (ypos > 0) { stack.push([xpos, ypos, kRight]); stack.push([xpos, ypos - 1, kStart]); continue; } case kRight: if (xpos < (this.width - 1)) { stack.push([xpos, ypos, kDown]); stack.push([xpos + 1, ypos, kStart]); continue; } case kDown: if (ypos < (this.height - 1)) { stack.push([xpos, ypos + 1, kStart]); continue; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runNearStackLimit(f) {\n function t() {\n try {\n t();\n } catch (e) {\n f();\n }\n };\n try {\n t();\n } catch (e) {\n }\n}", "function calcMaxRecursionDepth() {\n return min(7, floor(log2(pixelCount)))\n}", "function AckCallStack() {}", "function floodFill (rowNumber, c...
[ "0.6017875", "0.5935996", "0.59003186", "0.5688252", "0.560595", "0.5596729", "0.5575884", "0.549559", "0.5461267", "0.54547185", "0.54245293", "0.53363734", "0.5299581", "0.5270372", "0.52644175", "0.52542394", "0.5230411", "0.5220088", "0.5218711", "0.52170473", "0.52109534...
0.57675666
3
Get all components reachable from the given subrectangle
getReachableComponents(left, top, right, bottom) { let ret = []; for (let y = top; y < bottom; y++) { for (let x = left; x < right; x++) { const component = this.componentAtPixel(x, y); if (component < 0) continue; if (ret.indexOf(component) >= 0) continue; if (!this.componentIsValid(component)) { console.log('found invalid component in subrect'); return []; } mergeArray(ret, [component]); } } if (ret.length == 0) { console.log('no components found'); return ret; } console.log('found ' + ret.length + ' components in box'); // expand with reachable valid components let todo = Array.from(ret); // copy array let invalid = []; while (todo.length > 0) { console.log(todo); let found = []; // IDs found this iteration for (let i = 0; i < todo.length; i++) { let reachable = this.findNearbyQuick(todo[i]); for (let j = 0; j < reachable.length; j++) { const nearcomp = reachable[j]; if (invalid.indexOf(nearcomp) >= 0) continue; if (ret.indexOf(nearcomp) < 0 && found.indexOf(nearcomp) < 0) { if (!this.componentIsValid(nearcomp)) { invalid.push(nearcomp); continue; } found.push(nearcomp); } } } ret = ret.concat(found); todo = found; } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get rects() {\n return this.layers\n .filter(layer => layer.active)\n .map(layer => this.getLayerRects(layer)).reduce((cur, prev) => {\n return prev.concat(cur);\n }, []);\n }", "subdivide(){\n\tthis.divided = true;\n\tlet x = this.boundary.x;\n\tlet y = this.boundary.y;\n\tlet w = this...
[ "0.56736386", "0.56688905", "0.5654806", "0.55945873", "0.55945873", "0.55945873", "0.55945873", "0.55024225", "0.5424036", "0.5407423", "0.5390375", "0.5390375", "0.5390375", "0.5390375", "0.5385604", "0.53625417", "0.5361906", "0.53443986", "0.53209376", "0.5314305", "0.531...
0.70177346
0
Get an image with just certain components
imageWithComponents(ids) { let ret = []; for (let y = 0; y < this.height; y++) { let row = []; for (let x = 0; x < this.width; x++) { if (ids.indexOf(this.idImg[y][x]) >= 0) row.push(0); else row.push(1); } ret.push(row); } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get tag(){return\"full-width-image\"}", "getImage(){\n return '';//This might change later, we will see what I want this to be\n }", "getImages(arg){\n if(!arg){\n return this.images;\n }\n else{\n if(this.images.sized[arg]) return this.images.sized[arg];\n ...
[ "0.6266643", "0.5961922", "0.5937154", "0.5879125", "0.5854729", "0.58466905", "0.58393776", "0.5821038", "0.5791526", "0.5764591", "0.5732813", "0.57244986", "0.57109404", "0.5704386", "0.5665102", "0.56609935", "0.56609803", "0.5643692", "0.56383187", "0.563212", "0.5624791...
0.6206058
1
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the nonzero elements. Example: Input: [0,1,0,3,12] Output: [1,3,12,0,0]
function moveZero(data) { var b = []; var c = []; for (var i = 0; i < data.length; i++) { if (data[i] !== 0) { b.push(data[i]); } else { c.push(0) } } if (c.length > 0) { b = b.concat(c); } return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function moveZeroes(nums) {\n let insertIdx = 0;\n\n // iterate thru arr, swapping out zeroes for other numbers\n for (let num of nums) {\n if (num !== 0) {\n nums[insertIdx] = num;\n insertIdx++;\n }\n }\n\n // put zeroes back in, starting at insert position until end\n while (insertIdx < nu...
[ "0.86472803", "0.8604897", "0.81519103", "0.8098082", "0.80779564", "0.80556154", "0.7972218", "0.7949405", "0.7881032", "0.76965964", "0.76723266", "0.75752884", "0.75735587", "0.74446803", "0.74179745", "0.725726", "0.6971905", "0.6821398", "0.6791924", "0.67369866", "0.666...
0.6976787
16
Divide number reception A number reception B
function Divide(This, A, B) { evaluate(A); evaluate(B); if (act[A] === true && act[b] === true && val[b] !== 0) { val[This] = val[A] / val[B]; act[This] = true;} else { act[This] = false;} return true;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toDivision(num1, num2){\n let quotient = num1 / num2\n output(quotient)\n}", "function divide(a, b) {\n return divide(a, b);\n}", "function divide(a,b) {\n\treturn a / b\n}", "function bnDivide(a) {\n var r = nbi();this.divRemTo(a, r, null);return r;\n }", "function bnDivide(a) {\n var r...
[ "0.7655419", "0.76223356", "0.75806653", "0.75561965", "0.75561965", "0.75561965", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718", "0.7554718"...
0.0
-1
TODO the evaluate() calls
function ReceptionCurrentValueOf(This, ReceptionA) { act[This] = act[A] || preact[This]; if (act[A] === true) { val[This] = val[A];} else { val[This] = preval[This];} return true;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Evaluate() {}", "evaluate () {\n this.value = this.get();\n this.dirty = false;\n }", "function Eval() {\r\n}", "evaluate () {\n this.value = this.get()\n this.dirty = false\n }", "function evaluate(){\n number = math[operand](x,y)\n x = number\n display(number)\n number = 0\n ...
[ "0.81348383", "0.67316365", "0.6589254", "0.6563459", "0.646838", "0.6403018", "0.6349384", "0.62973744", "0.6251771", "0.6238675", "0.6228786", "0.6217893", "0.6204339", "0.61995995", "0.6109854", "0.6091359", "0.60872203", "0.60864174", "0.6071708", "0.60539615", "0.6053352...
0.0
-1
Define the makeStyles function
function makeStyles(css) { var returnStyle = { font: css.font.title }; Object.assign(returnStyle, css.flexRow); var iconStyle = { marginRight: '10px' }; return { returnStyle: returnStyle, iconStyle: iconStyle }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "makeStyles(requireFunc, components) {\n var styles = {};\n styles.__requireFunc = requireFunc;\n\n components.forEach(key => {\n styles[key] = true;\n });\n\n return styles;\n }", "styles() { }", "function getClasses() {\n return {\n ...(makeStyles(theme => ({\n slider...
[ "0.6731672", "0.6547601", "0.6267074", "0.62456995", "0.62456995", "0.62308323", "0.6178812", "0.608137", "0.60627556", "0.60627556", "0.6049731", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291", "0.6033291",...
0.5876188
31
Returns a human readable running time for a VM
function str_start_time(vm){ return pretty_time(vm.STIME); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "function timeRun() {\n return ((new Date()).getTime() - START_TIME)/1000;\n}", "toString() {\n\t\tlet difference;\n\t\tif (this.options && this.options.ms) {\n\t\t\tdifference = this.toMs(this.difference);\n\t\t} e...
[ "0.6350342", "0.6054124", "0.60369897", "0.5996689", "0.5826877", "0.5787262", "0.57818586", "0.57793444", "0.5741032", "0.5707315", "0.5701816", "0.56932324", "0.5681134", "0.56766605", "0.56686306", "0.56662387", "0.56199104", "0.56155413", "0.55463636", "0.5537863", "0.552...
0.6565225
1
Returns an array formed by the information contained in the vm_json and ready to be introduced in a dataTable
function vMachineElementArray(vm_json){ var vm = vm_json.VM; var state = OpenNebula.Helper.resource_state("vm",vm.STATE); if (state == "ACTIVE") { state = OpenNebula.Helper.resource_state("vm_lcm",vm.LCM_STATE); } return [ '<input type="checkbox" id="vm_'+vm.ID+'" name="selected_items" value="'+vm.ID+'"/>', vm.ID, vm.USERNAME ? vm.USERNAME : getUserName(vm.UID), vm.NAME, state, vm.CPU, humanize_size(vm.MEMORY), vm.HISTORY ? vm.HISTORY.HOSTNAME : "--", str_start_time(vm) ] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTableDataFromJSON() {\n\n }", "function vMachineElementArray(vm_json){\n var vm = vm_json.VM;\n var state = OpenNebula.Helper.resource_state(\"vm\",vm.STATE);\n var hostname = \"--\";\n\n if (state == tr(\"ACTIVE\") || state == tr(\"SUSPENDED\") || state == tr(\"POWEROFF\")){\n ...
[ "0.6244766", "0.6225503", "0.616402", "0.56862503", "0.5541573", "0.54076564", "0.5395823", "0.53472674", "0.5319546", "0.5289034", "0.52581483", "0.5256488", "0.5205264", "0.52015644", "0.5197722", "0.51927227", "0.51638514", "0.5160238", "0.51428586", "0.51154494", "0.51078...
0.6131957
3
Creates a listener for the TDs of the VM table
function vMachineInfoListener(){ $('#tbodyvmachines tr').live("click", function(e){ if ($(e.target).is('input')) {return true;} popDialogLoading(); var aData = dataTable_vMachines.fnGetData(this); var id = $(aData[0]).val(); Sunstone.runAction("VM.showinfo",id); return false; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupListener() {\n if (!this.isDestroyed && !this.isDestroying) {\n this._registerTableScroll();\n this._registerViewResize();\n\n set(\n this,\n 'mutationObserver',\n new MutationObserver(() => {\n this._registerViewResize();\n })\n );\n\n document...
[ "0.6195097", "0.58901733", "0.5831112", "0.5825871", "0.569836", "0.5604182", "0.5473852", "0.5459248", "0.5414505", "0.5404113", "0.53874594", "0.53683126", "0.5324858", "0.53169477", "0.53083014", "0.53027403", "0.5285508", "0.52060413", "0.516869", "0.5144841", "0.5139047"...
0.6034211
1
Callback to refresh a single element from the list
function updateVMachineElement(request, vm_json){ var id = vm_json.VM.ID; var element = vMachineElementArray(vm_json); updateSingleElement(element,dataTable_vMachines,'#vm_'+id) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function refreshCurrentList() {\n await displayList(elements.source.value);\n}", "function refreshTodoList(){\n jsonOverHttp({uri: '/db/item', method: 'GET'}).then(function(response){\n var todos = response.body;\n element.empty();\n ...
[ "0.6655291", "0.6568474", "0.653121", "0.6519002", "0.6512873", "0.6374906", "0.6199703", "0.6191489", "0.6188743", "0.6186379", "0.6150916", "0.6146552", "0.61351067", "0.61251456", "0.60654414", "0.5964646", "0.59148115", "0.58877623", "0.5880506", "0.5880506", "0.5876881",...
0.0
-1
Callback to delete a single element from the list
function deleteVMachineElement(req){ deleteElement(dataTable_vMachines,'#vm_'+req.request.data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteFromList() {\n list.splice((this.id), 1)\n }", "function deleteListItem() {\n item.remove();\n }", "function deleteListItem(e) {\n\t\te.remove();\n\t}", "function deleteElement(listElement) {\n var text = $(listElement).text();\n var itemText = text.slice(0,-1) // Removes the x from the...
[ "0.73244745", "0.6953609", "0.69358116", "0.6831889", "0.6819379", "0.6805584", "0.67913073", "0.6772484", "0.67293024", "0.671087", "0.67045546", "0.66249526", "0.65950024", "0.65949345", "0.65759355", "0.6571046", "0.65581316", "0.65574706", "0.6541872", "0.65398586", "0.65...
0.0
-1
Callback to add an element to the list
function addVMachineElement(request,vm_json){ var id = vm_json.VM.ID; var element = vMachineElementArray(vm_json); addElement(element,dataTable_vMachines); //Popup info panel after creation. updateVMInfo(null,vm_json); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "add(element) {}", "function addWithFunction(list, item, hashFunction) {\n if (findWithFunction(list, hashFunction) === -1) {\n list.push(item);\n }\n }", "add(element){\n this.addLast(element);\n }", "function addToMylist() { return changeMylistState('add',this); }", "...
[ "0.7129301", "0.6975083", "0.6855002", "0.6821536", "0.67648566", "0.67138326", "0.66773665", "0.663428", "0.6624041", "0.66074884", "0.6592156", "0.6549871", "0.6463869", "0.6444842", "0.6441033", "0.6414587", "0.6401281", "0.6393531", "0.63489956", "0.63489956", "0.63489956...
0.0
-1
Callback to refresh the list of Virtual Machines
function updateVMachinesView(request, vmachine_list){ vmachine_list_json = vmachine_list; var vmachine_list_array = []; $.each(vmachine_list,function(){ vmachine_list_array.push( vMachineElementArray(this)); }); updateView(vmachine_list_array,dataTable_vMachines); updateDashboard("vms",vmachine_list_json); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function vms_update() {\n _.each(server_list, function(data, hostname, i) {\n vm_update(hostname);\n });\n //self.reset_server_list();\n }", "function vms_start() {\n _.each(server_list, function(data, hostname, i) {\n vm_start(hostname, false);\n });\n //self.reset_server_list();\n ...
[ "0.7022252", "0.6393514", "0.6166403", "0.6162471", "0.61198956", "0.5909455", "0.5785657", "0.5655645", "0.56293577", "0.55570215", "0.5482905", "0.54531735", "0.5426205", "0.5344587", "0.5330432", "0.5315191", "0.5269334", "0.5262556", "0.525313", "0.52297", "0.522566", "...
0.6922116
1
Refreshes the information panel for a VM
function updateVMInfo(request,vm){ var vm_info = vm.VM; var info_tab = { title : "VM information", content: '<table id="info_vm_table" class="info_table">\ <thead>\ <tr><th colspan="2">Virtual Machine information - '+vm_info.NAME+'</th></tr>\ </thead>\ <tr>\ <td class="key_td">ID</td>\ <td class="value_td">'+vm_info.ID+'</td>\ </tr>\ <tr>\ <td class="key_td">Name</td>\ <td class="value_td">'+vm_info.NAME+'</td>\ </tr>\ <tr>\ <td class="key_td">State</td>\ <td class="value_td">'+OpenNebula.Helper.resource_state("vm",vm_info.STATE)+'</td>\ </tr>\ <tr>\ <td class="key_td">LCM State</td>\ <td class="value_td">'+OpenNebula.Helper.resource_state("vm_lcm",vm_info.LCM_STATE)+'</td>\ </tr>\ <tr>\ <td class="key_td">Start time</td>\ <td class="value_td">'+pretty_time(vm_info.STIME)+'</td>\ </tr>\ <tr>\ <td class="key_td">Deploy ID</td>\ <td class="value_td">'+(typeof(vm_info.DEPLOY_ID) == "object" ? "-" : vm_info.DEPLOY_ID)+'</td>\ </tr>\ </table>\ <table id="vm_monitoring_table" class="info_table">\ <thead>\ <tr><th colspan="2">Monitoring information</th></tr>\ </thead>\ <tr>\ <td class="key_td">Net_TX</td>\ <td class="value_td">'+vm_info.NET_TX+'</td>\ </tr>\ <tr>\ <td class="key_td">Net_RX</td>\ <td class="value_td">'+vm_info.NET_RX+'</td>\ </tr>\ <tr>\ <td class="key_td">Used Memory</td>\ <td class="value_td">'+humanize_size(vm_info.MEMORY)+'</td>\ </tr>\ <tr>\ <td class="key_td">Used CPU</td>\ <td class="value_td">'+vm_info.CPU+'</td>\ </tr>\ </table>' } var template_tab = { title: "VM Template", content: '<table id="vm_template_table" class="info_table">\ <thead><tr><th colspan="2">VM template</th></tr></thead>'+ prettyPrintJSON(vm_info.TEMPLATE)+ '</table>' } var log_tab = { title: "VM log", content: '<pre>'+spinner+'</pre>' } Sunstone.updateInfoPanelTab("vm_info_panel","vm_info_tab",info_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_template_tab",template_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_log_tab",log_tab); //Here it is special, as we will let the callback from the VM.log //action popUp the info panel again when the info is received. Sunstone.popUpInfoPanel("vm_info_panel"); Sunstone.runAction("VM.log",vm_info.ID); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refresh() {\n getInfoMat();\n}", "function refresh() {\n\t\t\tself.getNodePosition();\n\t\t\tself.getViewPortSize();\n\t\t\tcheck(null, {});\n\t\t}", "show() {\n super.show();\n this.component.refresh();\n }", "refresh()\n\t{\n\t}", "function refresh( done ) {\n panini.refre...
[ "0.67744946", "0.6146781", "0.61421514", "0.6128883", "0.6096986", "0.6091904", "0.60691845", "0.6034172", "0.5994615", "0.59912735", "0.59904253", "0.5981305", "0.59738857", "0.596756", "0.58824", "0.5838472", "0.5806375", "0.57923645", "0.5788256", "0.57816285", "0.5777976"...
0.58776957
15
Sets up the createVM dialog and all the processing associated to it, which is a lot.
function setupCreateVMDialog(){ //Helper functions for the dialog operations // Called when changing tabs. Since we use the same form for both // KVM, XEN and others we need to do some operation to update it var vmTabChange = function(event,ui){ // ui.tab // anchor element of the selected (clicked) tab // ui.panel // element, that contains the selected/clicked tab contents // ui.index // zero-based index of the selected (clicked) tab switch(ui.index){ case 0: enable_kvm(); break; case 1: enable_xen(); break; case 2: break; case 3: break; } } //Using kvm wizard. Updates mandatory tag, optional tags, disable //XEN-only (and others) items, enables KVM items var enable_kvm = function(){ man_class="kvm"; opt_class="kvm_opt"; $(xen_items).attr("disabled","disabled"); $(kvm_items).removeAttr("disabled"); //$(items+':disabled').hide(); //KVM particularities: // * Add no_type option for disks // * Add driver default option for boot and select it - hide some fields // * Set the raw type to kvm // * Show the inputs section $('div#disks select#TYPE option:selected').removeAttr("selected"); $('div#disks select#TYPE').prepend( '<option id="no_type" value="">None</option>'); $('div#disks select#TYPE option#no_type').attr("selected","selected"); $('select#boot_method option').removeAttr("selected"); $('select#boot_method option#no_boot').html("Driver default"); $('select#boot_method option').removeAttr("selected"); $('.kernel, .bootloader', $('div#os_boot_opts')).hide(); $('div#disks select#BUS').append( '<option id="virtio" value="virtio">virtio</option>'); $('input#TYPE', section_raw).val("kvm"); $(section_inputs).show(); }; // Using XEN wizard. Update mandatory and optional classes, disable // KVM-only (and other) items, enable XEN fields... enable_xen = function(){ man_class="xen"; opt_class="xen_opt"; $(kvm_items).attr("disabled","disabled"); $(kvm_items).css("background",""); $(xen_items).removeAttr("disabled"); //$(items+':disabled').hide(); // XEN particularities: // * Remove no_type option from disks // * Remove driver default boot method // * Set the raw section to XEN // * Hide the inputs section $('div#disks select#TYPE option#no_type').remove(); $('select#boot_method option:selected').removeAttr("selected"); $('select#boot_method option#no_boot').html("Please choose"); $('.kernel, .bootloader', $('div#os_boot_opts')).hide(); $('div#disks select#BUS option#virtio').remove(); $('input#TYPE', section_raw).val("xen"); $(section_inputs).hide(); //not present for xen }; //This function checks that all mandatory items within a section //have some value. Returns true if so, false if not. var mandatory_filter = function(context){ var man_items = "."+man_class; //find enabled mandatory items in this context man_items = $(man_items+' input:visible, '+man_items+' select:visible',context); var r = true; //we fail it the item is enabled and has no value $.each(man_items,function(){ if ($(this).parents(".vm_param").attr("disabled") || !($(this).val().length)) { r = false; return false; }; }); return r; }; //Adds an option element to a multiple select box. Before doing so, //it checks that the desired filter is passed var box_add_element = function(context,box_tag,filter){ var value=""; var params= $('.vm_param',context); var inputs= $('input:enabled',params); var selects = $('select:enabled',params); var fields = $.merge(inputs,selects); //are fields passing the filter? var result = filter(); if (!result) { notifyError("There are mandatory parameters missing in this section"); return false; } value={}; //With each enabled field we form a JSON object var id = null; $.each(fields,function(){ if (!($(this).parents(".vm_param").attr("disabled")) && $(this).val().length){ //Pick up parent's ID if we do not have one id = $(this).attr('id').length ? $(this).attr('id') : $(this).parent().attr('id'); value[id] = $(this).val(); } }); var value_string = JSON.stringify(value); var option= '<option value=\''+value_string+'\'>'+ stringJSON(value)+ '</option>'; $('select'+box_tag,context).append(option); return false; }; //Removes selected elements from a multiple select box var box_remove_element = function(section_tag,box_tag){ var context = $(section_tag); $('select'+box_tag+' :selected',context).remove(); return false; }; //Given the JSON of a VM template (or of a section of it), it crawls //the fields of certain section (context) and add their name and //values to the template JSON. var addSectionJSON = function(template_json,context){ var params= $('.vm_param',context); var inputs= $('input:enabled',params); var selects = $('select:enabled',params); var fields = $.merge(inputs,selects); fields.each(function(){ if (!($(this).parents(".vm_param").attr("disabled"))){ //if ! disabled if ($(this).val().length){ //if has a length template_json[$(this).attr('id')]=$(this).val(); } } }); } // Given an array (usually empty), a section (context) and a tag for // a multiple select in that section, it adds the contents of the // box as objects in the array. // TODO: Make it return a new array? var addBoxJSON = function(array,context,box_tag){ $('select'+box_tag+' option',context).each(function(){ array.push( JSON.parse($(this).val()) ); }); } //Given an object, removes those elements which are empty //Used to clean up a template JSON before submitting //it to opennebula.js var removeEmptyObjects = function(obj){ for (elem in obj){ var remove = false; var value = obj[elem]; if (value instanceof Array) { if (value.length == 0) remove = true; } else if (value instanceof Object) { var obj_length = 0; for (e in value) obj_length += 1; if (obj_length == 0) remove = true; } else { value = String(value); if (value.length == 0) remove = true; } if (remove) delete obj[elem]; } return obj; } //Toggles the icon when a section is folded/unfolded var iconToggle = function(){ $('.icon_right').toggle( function(e){ $('span',e.currentTarget).removeClass("ui-icon-plusthick"); $('span',e.currentTarget).addClass("ui-icon-minusthick"); },function(e){ $('span',e.currentTarget).removeClass("ui-icon-minusthick"); $('span',e.currentTarget).addClass("ui-icon-plusthick"); }); } // Set ups the capacity section var capacity_setup = function(){ //Actually there is nothing to set up, but it used to be //possible to hide it like others /* $('fieldset',section_capacity).hide(); $('#add_capacity',section_capacity).click(function(){ $('fieldset',section_capacity).toggle(); return false; }); */ } //Sets up the OS_BOOT section var os_boot_setup = function(){ $('fieldset',section_os_boot).hide(); $('.bootloader, .kernel',section_os_boot).hide(); $('#add_os_boot_opts',section_os_boot).click(function(){ $('fieldset',section_os_boot).toggle(); return false; }); //Chrome workaround $('#boot_method').change(function(){ $(this).trigger("click"); }); //Depending on the boot method we enable/disable some options $('#boot_method',section_os_boot).click(function(){ select = $(this).val(); switch (select) { case "kernel": $('.bootloader',section_os_boot).hide(); $('.bootloader',section_os_boot).attr("disabled","disabled"); $('.kernel',section_os_boot).show(); $('.kernel',section_os_boot).removeAttr("disabled"); break; case "bootloader": $('.kernel',section_os_boot).hide(); $('.kernel',section_os_boot).attr("disabled","disabled"); $('.bootloader',section_os_boot).show(); $('.bootloader',section_os_boot).removeAttr("disabled"); break; default: $('.kernel, .bootloader',section_os_boot).hide(); $('.kernel, .bootloader',section_os_boot).attr("disabled","disabled"); $('.kernel input, .bootloader input',section_os_boot).val(""); }; }); }; // Sets up the disk section var disks_setup = function(){ $('fieldset',section_disks).hide(); $('.vm_param', section_disks).hide(); //$('#image_vs_disk',section_disks).show(); $('#add_disks', section_disks).click(function(){ $('fieldset',section_disks).toggle(); return false; }); //Depending on adding a disk or a image we need to show/hide //different options and make then mandatory or not $('#image_vs_disk input',section_disks).click(function(){ //$('fieldset',section_disks).show(); $('.vm_param', section_disks).show(); var select = $('#image_vs_disk :checked',section_disks).val(); switch (select) { case "disk": $('.add_image',section_disks).hide(); $('.add_image',section_disks).attr("disabled","disabled"); $('.add_disk',section_disks).show(); $('.add_disk',section_disks).removeAttr("disabled"); $('#TARGET',section_disks).parent().removeClass(opt_class); $('#TARGET',section_disks).parent().addClass(man_class); break; case "image": $('.add_disk',section_disks).hide(); $('.add_disk',section_disks).attr("disabled","disabled"); $('.add_image',section_disks).show(); $('.add_image',section_disks).removeAttr("disabled"); $('#TARGET',section_disks).parent().removeClass(man_class); $('#TARGET',section_disks).parent().addClass(opt_class); break; } $('#SIZE',section_disks).parent().hide(); $('#SIZE',section_disks).parent().attr("disabled","disabled"); $('#FORMAT',section_disks).parent().hide(); $('#SIZE',section_disks).parent().attr("disabled","disabled"); $('#TYPE :selected',section_disks).removeAttr("selected"); }); //Chrome workaround $('select#TYPE',section_disks).change(function(){ $(this).trigger('click'); }); //Depending on the type of disk we need to show/hide //different options and make then mandatory or not $('select#TYPE',section_disks).click(function(){ var select = $(this).val(); switch (select) { //size,format,target case "swap": //size mandatory $('#SIZE',section_disks).parent().show(); $('#SIZE',section_disks).parent().removeAttr("disabled"); $('#SIZE',section_disks).parent().removeClass(opt_class); $('#SIZE',section_disks).parent().addClass(man_class); //target optional $('#TARGET',section_disks).parent().removeClass(man_class); $('#TARGET',section_disks).parent().addClass(opt_class); //format hidden $('#FORMAT',section_disks).parent().hide(); $('#FORMAT',section_disks).parent().attr("disabled","disabled"); break; case "fs": //size mandatory $('#SIZE',section_disks).parent().show(); $('#SIZE',section_disks).parent().removeAttr("disabled"); $('#SIZE',section_disks).parent().removeClass(opt_class); $('#SIZE',section_disks).parent().addClass(man_class); //target mandatory $('#TARGET',section_disks).parent().removeClass(opt_class); $('#TARGET',section_disks).parent().addClass(man_class); //format mandatory $('#FORMAT',section_disks).parent().show(); $('#FORMAT',section_disks).parent().removeAttr("disabled"); $('#FORMAT',section_disks).parent().removeClass(opt_class); $('#FORMAT',section_disks).parent().addClass(man_class); break; case "block": //size shown and optional $('#SIZE',section_disks).parent().show(); $('#SIZE',section_disks).parent().removeAttr("disabled"); $('#SIZE',section_disks).parent().removeClass(man_class); $('#SIZE',section_disks).parent().addClass(opt_class); //target mandatory $('#TARGET',section_disks).parent().removeClass(opt_class); $('#TARGET',section_disks).parent().addClass(man_class); //format hidden $('#FORMAT',section_disks).parent().hide(); $('#FORMAT',section_disks).parent().attr("disabled","disabled"); break; case "floppy": case "disk": case "cdrom": default: //size hidden $('#SIZE',section_disks).parent().hide(); $('#SIZE',section_disks).parent().attr("disabled","disabled"); //target mandatory $('#TARGET',section_disks).parent().removeClass(opt_class); $('#TARGET',section_disks).parent().addClass(man_class); //format optional $('#FORMAT',section_disks).parent().hide(); $('#FORMAT',section_disks).parent().attr("disabled","disabled"); } }); //Our filter for the disks section fields is the mandatory //filter for this section var diskFilter = function(){ return mandatory_filter(section_disks); }; $('#add_disk_button',section_disks).click(function(){ box_add_element(section_disks,'#disks_box',diskFilter); return false; }); $('#remove_disk_button',section_disks).click(function(){ box_remove_element(section_disks,'#disks_box'); return false; }); }; // Sets up the network section var networks_setup = function(){ $('.vm_param',section_networks).hide(); $('fieldset',section_networks).hide(); $('#add_networks',section_networks).click(function(){ $('fieldset',section_networks).toggle(); return false; }); //Depending on adding predefined network or not we show/hide //some fields $('#network_vs_niccfg input',section_networks).click(function(){ select = $('#network_vs_niccfg :checked',section_networks).val(); switch (select) { case "network": $('.niccfg',section_networks).hide(); $('.niccfg',section_networks).attr("disabled","disabled"); $('.network',section_networks).show(); $('.network',section_networks).removeAttr("disabled"); break; case "niccfg": $('.network',section_networks).hide(); $('.network',section_networks).attr("disabled","disabled"); $('.niccfg',section_networks).show(); $('.niccfg',section_networks).removeAttr("disabled"); break; } }); //The filter to add a new network checks that we have selected a //network, or that the ip or mac are set //TODO: Improve this check var nicFilter = function(){ return mandatory_filter(section_networks); }; $('#add_nic_button',section_networks).click(function(){ box_add_element(section_networks,'#nics_box',nicFilter); return false; }); $('#remove_nic_button',section_networks).click(function(){ box_remove_element(section_networks,'#nics_box'); return false; }); }; //Sets up the input section - basicly enabling adding and removing from box var inputs_setup = function() { $('fieldset',section_inputs).hide(); $('#add_inputs',section_inputs).click(function(){ $('fieldset',section_inputs).toggle(); return false; }); $('#add_input_button',section_inputs).click(function(){ //no filter box_add_element(section_inputs,'#inputs_box',True); return false; }); $('#remove_input_button',section_inputs).click(function(){ box_remove_element(section_inputs,'#inputs_box'); return false; }); }; //Set up the graphics section var graphics_setup = function(){ $('fieldset',section_graphics).hide(); $('.vm_param',section_graphics).hide(); $('select#TYPE',section_graphics).parent().show(); $('#add_graphics',section_graphics).click(function(){ $('fieldset',section_graphics).toggle(); return false; }); //Chrome workaround $('select#TYPE',section_graphics).change(function(){ $(this).trigger("click"); }); $('select#TYPE',section_graphics).click(function(){ g_type = $(this).val(); switch (g_type) { case "vnc": $('#LISTEN',section_graphics).parent().show(); $('#PORT',section_graphics).parent().show(); $('#PASSWD',section_graphics).parent().show(); $('#KEYMAP',section_graphics).parent().show(); $('#PORT',section_graphics).parent().removeAttr("disabled"); $('#PASSWD',section_graphics).parent().removeAttr("disabled"); $('#KEYMAP',section_graphics).parent().removeAttr("disabled"); break; case "sdl": $('#LISTEN',section_graphics).parent().show(); $('#PORT',section_graphics).parent().hide(); $('#PASSWD',section_graphics).parent().hide(); $('#KEYMAP',section_graphics).parent().hide(); $('#PORT',section_graphics).parent().attr("disabled","disabled"); $('#PASSWD',section_graphics).parent().attr("disabled","disabled"); $('#KEYMAP',section_graphics).parent().attr("disabled","disabled"); break; default: $('#LISTEN',section_graphics).parent().hide(); $('#PORT',section_graphics).parent().hide(); $('#PASSWD',section_graphics).parent().hide(); $('#KEYMAP',section_graphics).parent().hide(); } }); } //Set up the context section - TODO: Apply improvements here... var context_setup = function(){ $('fieldset',section_context).hide(); $('#add_context',section_context).click(function(){ $('fieldset',section_context).toggle(); return false; }); $('#add_context_button', section_context).click(function(){ var name = $('#var_name',section_context).val(); var value = $('#var_value',section_context).val(); if (!name.length || !value.length) { notifyError("Context variable name and value must be filled in"); return false; } option= '<option value=\''+value+'\' name=\''+name+'\'>'+ name+'='+value+ '</option>'; $('select#context_box',section_context).append(option); return false; }); $('#remove_context_button', section_context).click(function(){ box_remove_element(section_context,'#context_box'); return false; }); }; // Set up the placement section var placement_setup = function(){ $('fieldset',section_placement).hide(); $('#add_placement',section_placement).click(function(){ $('fieldset',section_placement).toggle(); return false; }); }; // Set up the raw section var raw_setup = function(){ $('fieldset',section_raw).hide(); $('#add_raw',section_raw).click(function(){ $('fieldset',section_raw).toggle(); return false; }); }; //***CREATE VM DIALOG MAIN BODY*** $('div#dialogs').append('<div title="Create Virtual Machine" id="create_vm_dialog"></div>'); //Insert HTML in place $('#create_vm_dialog').html(create_vm_tmpl); //Enable tabs $('#vm_create_tabs').tabs({ select:vmTabChange }); //Prepare jquery dialog var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window $('#create_vm_dialog').dialog({ autoOpen: false, modal: true, width: 700, height: height }); // Enhace buttons $('#create_vm_dialog button').button(); //Enable different icon for folded/unfolded categories iconToggle(); //toogle +/- buttons //Sections, used to stay within their scope var section_capacity = $('#capacity'); var section_os_boot = $('#os_boot_opts'); var section_disks = $('#disks'); var section_networks = $('#networks'); var section_inputs = $('#inputs'); var section_graphics = $('#graphics'); var section_context = $('#context'); var section_placement = $('#placement'); var section_raw = $('#raw'); //Different selector for items of kvm and xen (mandatory and optional) var items = '.vm_section input,.vm_section select'; var kvm_man_items = '.kvm input,.kvm select'; var kvm_opt_items = '.kvm_opt input, .kvm_opt select'; var kvm_items = kvm_man_items +','+kvm_opt_items; var xen_man_items = '.xen input,.xen select'; var xen_opt_items = '.xen_opt input, .xen_opt select'; var xen_items = xen_man_items +','+ xen_opt_items; //Starting template type, optional items class and mandatory items class var templ_type = "kvm"; var opt_class=".kvm_opt"; var man_class=".kvm"; enable_kvm(); //enable all kvm options //Fold/unfold all sections button $('#fold_unfold_vm_params').toggle( function(){ $('.vm_section fieldset').show(); return false; }, function(){ $('.vm_section fieldset').hide(); $('.vm_section fieldset').first().show(); //Show capacity opts return false; }); //initialise all sections capacity_setup(); os_boot_setup(); disks_setup(); networks_setup(); inputs_setup(); graphics_setup(); context_setup(); placement_setup(); raw_setup(); //Process form $('button#create_vm_form_easy').click(function(){ //validate form var vm_json = {}; //process capacity options var scope = section_capacity; if (!mandatory_filter(scope)){ notifyError("There are mandatory fields missing in the capacity section"); return false; }; addSectionJSON(vm_json,scope); //process os_boot_opts scope= section_os_boot; switch (templ_type){ case "xen": boot_method = $('#boot_method option:selected',scope).val(); if (!boot_method.length){ notifyError("Xen templates must specify a boot method"); return false;} }; if (!mandatory_filter(scope)){ notifyError("There are mandatory fields missing in the OS Boot options section"); return false; }; vm_json["OS"] = {}; addSectionJSON(vm_json["OS"],scope); //process disks -> fetch from box scope = section_disks; vm_json["DISK"] = []; addBoxJSON(vm_json["DISK"],scope,'#disks_box'); //process nics -> fetch from box scope = section_networks; vm_json["NIC"] = []; addBoxJSON(vm_json["NIC"],scope,'#nics_box'); //process inputs -> fetch from box scope = section_inputs; vm_json["INPUT"] = []; addBoxJSON(vm_json["INPUT"],scope,'#inputs_box'); //process graphics -> fetch fields with value scope = section_graphics; vm_json["GRAPHICS"] = {}; addSectionJSON(vm_json["GRAPHICS"],scope); //context scope = section_context; var context = $('#CONTEXT',scope).val(); vm_json["CONTEXT"] = {}; $('#context_box option',scope).each(function(){ name = $(this).attr("name"); value = $(this).val(); vm_json["CONTEXT"][name]=value; }); //placement -> fetch with value scope = section_placement; addSectionJSON(vm_json,scope); //raw -> if value set type to driver and fetch scope = section_raw; vm_json["RAW"] = {}; addSectionJSON(vm_json["RAW"],scope); // remove empty elements vm_json = removeEmptyObjects(vm_json); //wrap it in the "vm" object vm_json = {vm: vm_json}; Sunstone.runAction("VM.create",vm_json); $('#create_vm_dialog').dialog('close'); return false; }); //Handle manual forms $('button#create_vm_form_manual').click(function(){ var template = $('#textarea_vm_template').val(); //wrap it in the "vm" object template = {"vm": {"vm_raw": template}}; Sunstone.runAction("VM.create",template); $('#create_vm_dialog').dialog('close'); return false; }); //Reset form - empty boxes $('button#reset_vm_form').click(function(){ $('select#disks_box option',section_disks).remove(); $('select#nics_box option',section_networks).remove(); $('select#inputs_box option',section_inputs).remove(); return true; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupCreateVMDialog(){\n\n dialogs_context.append('<div id=\"create_vm_dialog\" class=\"reveal-modal large max-height\"\" data-reveal></div>');\n //Insert HTML in place\n $create_vm_dialog = $('#create_vm_dialog')\n var dialog = $create_vm_dialog;\n dialog.html(create_vm_tmpl);\n $(docu...
[ "0.739921", "0.722267", "0.7138077", "0.62642473", "0.59334445", "0.570519", "0.5648445", "0.55482817", "0.5546366", "0.54914606", "0.54853386", "0.539934", "0.5396468", "0.53915685", "0.53880733", "0.5354786", "0.5298222", "0.526186", "0.5246961", "0.52328557", "0.52280325",...
0.8001461
0
Prepares a dialog to saveas a VM
function setupSaveasDialog(){ //Append to DOM $('div#dialogs').append('<div id="saveas_vm_dialog" title="VM Save As"></div>'); //Put HTML in place $('#saveas_vm_dialog').html('\ <form action="javascript:alert(\'js error!\');">\ <div id="saveas_tabs">\ </div>\ <div class="form_buttons">\ <button id="vm_saveas_proceed" value="">OK</button>\ <button id="vm_saveas_cancel" value="">Cancel</button>\ </div>\ </fieldset>\ </form>'); $('#saveas_vm_dialog').dialog({ autoOpen:false, width:600, modal:true, height:350, resizable:true, }); $('#saveas_vm_dialog #vm_saveas_proceed').click(function(){ var elems = $('#saveas_vm_dialog #saveas_tabs div.saveas_tab'); var args = []; $.each(elems,function(){ var id = $('#vm_id',this).text(); var disk_id = $('#vm_disk_id',this).val(); var image_name = $('#image_name',this).val(); var type = $('#image_type',this).val(); if (!id.length || !disk_id.length || !image_name.length) { notifyError("Skipping VM "+id+ ". No disk id or image name specified"); } else { var obj = { vm_id: id, disk_id : disk_id, image_name : image_name, type: type }; args.push(id); Sunstone.runAction("VM.saveas",obj); } }); if (args.length > 0){ notifySubmit("VM.saveas",args); } $('#saveas_vm_dialog').dialog('close'); return false; }); $('#saveas_vm_dialog #vm_saveas_cancel').click(function(){ $('#saveas_vm_dialog').dialog('close'); return false; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupCreateVMDialog(){\n\n //Helper functions for the dialog operations\n\n // Called when changing tabs. Since we use the same form for both\n // KVM, XEN and others we need to do some operation to update it\n var vmTabChange = function(event,ui){\n\t// ui.tab // anchor element of the sel...
[ "0.6874691", "0.6678162", "0.63578963", "0.63165873", "0.6210132", "0.61156183", "0.59956414", "0.5838574", "0.58229744", "0.5815366", "0.5786203", "0.5741251", "0.5688118", "0.56705844", "0.56518734", "0.5649996", "0.5644049", "0.55912274", "0.55795413", "0.5563367", "0.5553...
0.75459
0
expands form, adds size text field and requires user to fill them, deletes unnecessary information from other special attribute fields
function AddSize(){ specAttribute.style.cssText = "height: 85px;"; weight.style.cssText = "height:0; opacity:0;"; dimentions.style.cssText = "height:0; opacity:0;"; size.style.cssText = "height: 85px; width:100%; opacity:1; overflow: visible;"; size.getElementsByTagName("input")[0].required = true; weight.getElementsByTagName("input")[0].required = false; weight.getElementsByTagName("input")[0].value= ""; for (let i=0; i<3; i++) { dimentions.getElementsByTagName("input")[i].required = false; dimentions.getElementsByTagName("input")[i].value= ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddWeight(){\n specAttribute.style.cssText = \"height: 85px;\";\n\n size.style.cssText = \"height:0; opacity:0;\";\n dimentions.style.cssText = \"height:0; opacity:0;\";\n weight.style.cssText = \"height: 85px; width:100%; opacity:1; overflow: visible;\";\n weight.getElementsByTagName(\"inp...
[ "0.6785042", "0.6486951", "0.6212623", "0.6144074", "0.6134383", "0.60120076", "0.592569", "0.5892042", "0.58847326", "0.58453375", "0.5786673", "0.5761173", "0.57452166", "0.57281154", "0.56815", "0.5663966", "0.5663302", "0.56429875", "0.56210345", "0.55534685", "0.55493355...
0.74570316
0
expands form, adds weight text field and requires user to fill them, deletes unnecessary information from other special attribute fields
function AddWeight(){ specAttribute.style.cssText = "height: 85px;"; size.style.cssText = "height:0; opacity:0;"; dimentions.style.cssText = "height:0; opacity:0;"; weight.style.cssText = "height: 85px; width:100%; opacity:1; overflow: visible;"; weight.getElementsByTagName("input")[0].required = true; size.getElementsByTagName("input")[0].required = false; size.getElementsByTagName("input")[0].value= ""; for (let i=0; i<3; i++) { dimentions.getElementsByTagName("input")[i].required = false; dimentions.getElementsByTagName("input")[i].value= ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddSize(){\n specAttribute.style.cssText = \"height: 85px;\";\n \n weight.style.cssText = \"height:0; opacity:0;\";\n dimentions.style.cssText = \"height:0; opacity:0;\";\n size.style.cssText = \"height: 85px; width:100%; opacity:1; overflow: visible;\"; \n size.getElementsByTagName(\"i...
[ "0.6305594", "0.60754585", "0.5890428", "0.5782913", "0.5700883", "0.55894965", "0.5537865", "0.5537865", "0.5520302", "0.5497091", "0.54859084", "0.5480256", "0.5443797", "0.5398244", "0.53912246", "0.53907955", "0.53668606", "0.53138655", "0.53126913", "0.53119385", "0.5308...
0.7354713
0
expands form, adds dimentions text fields and requires user to fill them, deletes unnecessary information from other special attribute fields
function AddDimentions(){ specAttribute.style.cssText = "height: 255px;"; size.style.cssText = "height:0; opacity:0;"; weight.style.cssText = "height:0; opacity:0;"; dimentions.style.cssText = "height: 255px; width:100%; opacity:1; overflow: visible;"; for (let i=0; i<3; i++) { dimentions.getElementsByTagName("input")[i].required = true; } size.getElementsByTagName("input")[0].required = false; size.getElementsByTagName("input")[0].value= ""; weight.getElementsByTagName("input")[0].required = false; weight.getElementsByTagName("input")[0].value= ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showAddNewDiyForm() {\n cleanUp();\n show($addOrEditDiy);\n $(\"#diy-form-title\").text(\"Add New DIY Recipe\");\n $recName.val(\"\");\n $imgURL.val(\"\");\n $recIngredients.val(\"\");\n $recDescription.val(\"\");\n $(\"#submitNewDiyBtn\").removeClass('d-none');\n $(\"#submitEdi...
[ "0.62845707", "0.6024696", "0.60170025", "0.59756494", "0.5959312", "0.5957083", "0.5930834", "0.59245354", "0.59096295", "0.58968514", "0.58865166", "0.58341485", "0.57784957", "0.57455975", "0.5739284", "0.5728475", "0.57268864", "0.5724205", "0.5718826", "0.5706926", "0.57...
0.6287291
0
EX Some handy functions, objects and classes
function isdef(value) { return !(value === undefined); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Tools(){}", "function Utils() {}", "function Utils() {}", "function Utils(){}", "function ExtraMethods() {}", "function AeUtil() {}", "function NXObject() {}", "function ea(){}", "function Obj() {}", "function BasicObject() {}", "function Xa(){}", "function Expt() {\r\n}", "functio...
[ "0.675703", "0.6662062", "0.6662062", "0.66150224", "0.65568316", "0.6483398", "0.6352194", "0.62800986", "0.6271764", "0.6264298", "0.623526", "0.6210356", "0.6167872", "0.6167872", "0.6153663", "0.6151569", "0.6150916", "0.61415297", "0.6097766", "0.60412204", "0.6024443", ...
0.0
-1
Constructor with state add a state property called "newItem" set the value of "this.state.newItem" to an empty string
constructor() { super(); this.state = { newTodo: "" }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this.state = {\n todoList: stuffTodo,\n newItem: \"\"\n }\n }", "constructor() {\n super();\n this.state = {\n list: [],\n item: \"\"\n };\n }", "constructor(props) {\n //props are used to export elements from other components\n super(p...
[ "0.7466784", "0.7226457", "0.7204065", "0.7023335", "0.7007274", "0.69689626", "0.68983495", "0.6880619", "0.6871177", "0.68507516", "0.6779069", "0.6775926", "0.67593366", "0.67571825", "0.6733959", "0.6697884", "0.66947407", "0.66805786", "0.66418684", "0.66284883", "0.6627...
0.6788256
10
Close If Outside Click
function outsideClick(e) { if (e.target == modal) { modal.style.display = 'none'; } if (e.target == productsModal) { productsModal.style.display = 'none'; } if (e.target == cartModal) { cartModal.style.display = 'none'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clickedOutside(event) {\n if (this.isActive) {\n if (Array.isArray(this.autoClose)) {\n if (this.autoClose.indexOf('outside') >= 0) {\n if (!this.isInWhiteList(event.target)) this.isActive = false;\n }\n\n if (this.autoClose.indexOf('inside') >= 0) {\n i...
[ "0.74750227", "0.73975295", "0.7295363", "0.7199779", "0.7121231", "0.7109714", "0.71084017", "0.7094833", "0.709388", "0.70858735", "0.7085688", "0.7076124", "0.7059874", "0.7055857", "0.7040531", "0.7039619", "0.7032651", "0.70199317", "0.7007524", "0.6997384", "0.6986928",...
0.0
-1
when createRoom is clicked
onButtonClick(event) { event.preventDefault(); if (!this.state.showPopUp) { if (this.state.term) { let dbCon = this.props.db.database().ref('/numPeople'); const dbConRef = dbCon.push({ numPeople: parseInt(this.state.term, 10), votes: 0, inputs: 0 }); // display popup this.setState({ ...this.state, showPopUp: true, roomKey: dbConRef.key }); } } else { const goToRoom = document.getElementById('go_to_room'); if (goToRoom) { goToRoom.click(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createNewRoom() {\n console.log(nextRoomId);\n createRoomDOM(nextRoomId);\n signalRoomCreated(nextRoomId);\n\n nextRoomId++;\n}", "function createRoomButton(){\n clearErrors();\n if(newRoomName.length > 1){\n createNewRoom(newRoomName)\n .then(res => {\n ...
[ "0.7778433", "0.7753087", "0.7641488", "0.75875217", "0.7524991", "0.7465164", "0.7339679", "0.733509", "0.7302368", "0.72955555", "0.723079", "0.72036064", "0.71502423", "0.7139635", "0.7071025", "0.70219576", "0.70207417", "0.69101757", "0.68317354", "0.67796034", "0.672233...
0.0
-1
Fin $(document).ready Esta funcion devuelve la posicion en el eje x y
function ubicar(event){ var posicion = { x : event.clientX, y : event.clientY }; return posicion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calElementPos(){\n\t\tcalSize();\n\t\tcalPie();\n\t\tcalGraph();\n\t}", "function controllo_posizione(loc)\n{\n\t/*var body = document.body;\n\tvar width = body.offsetWidth;\n\tvar heigth = body.offsetHeight;\t/*\n\ty -> 0 e 981\n\tx -> 0 e 910\n\t*/\n\t//console.log( \"Altezza: \" + heigth + \"; Larghe...
[ "0.68862975", "0.68580794", "0.6816212", "0.68004346", "0.6564543", "0.6539968", "0.65021354", "0.64684117", "0.6463408", "0.6345221", "0.622689", "0.6196255", "0.61940247", "0.6168001", "0.61559576", "0.61443174", "0.61443174", "0.61266327", "0.6124163", "0.6122897", "0.6114...
0.6051862
27
Esta funcion vuelve a dibujar el punto caundo se reorganizan los id o se consulta de la BD
function ubicarPunto(posX, posY, idPunto) { $("#"+idPunto).css({ top : posY+"%", left : posX+"%" }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function guardarDatosDetalles( id_proceso_masivo ){\n\t\t\tlet data_det = {};\n\t\t\tlet tblProcesosDetalles = sql.define({\n\t\t\t name: 'procesos_masivos_detalles',\n\t\t\t columns: [\n\t\t\t 'numero_remito',\n\t\t\t 'numero_lote',\n\t\t\t 'cantidad_actas',\n\t\t\t 'notificada',\n\t\t\t 'zona',\...
[ "0.67847264", "0.63129574", "0.6265478", "0.62389195", "0.6029188", "0.60002947", "0.59812117", "0.5953537", "0.5951905", "0.5950849", "0.59452206", "0.5920281", "0.5895031", "0.5884369", "0.5881501", "0.5878099", "0.58583957", "0.58457154", "0.58437186", "0.58411634", "0.581...
0.0
-1
Esta funcion dibuja un punto con las cordenadas especificadas
function punto(posX , posY){ // Almacena la cantidad de puntos que hay en el cuerpo canLesiones++; // Arma la estructura del #id var idLesion = 'Puntolesion_' + canLesiones; // Ancho y alto del contenedor del cuerpo var ancho = $("#cont_cuerpo").width(); var alto = $("#cont_cuerpo").height(); // Distancia del scroll con respecto a la parte superior de la ventana var scroll = $(window).scrollTop(); // Calculo de la posición para el punto , teniendo en cuenta la posición del scroll y los 60px de alto de la bara de navegación de la página. var totalY = (posY + scroll) - 133; // Creación de un punto en el DOM $("#cont_cuerpo").append("<div class='lesion' id='"+idLesion+"' onclick='consultarLesion("+ lesiones.length +" , this.id, event)'></div>"); // Ubicaciones en el eje x - y para el punto var puntoX =( (posX * 100)/ancho) - 0.4; var puntoY = (totalY * 100)/alto; // Ubicar el punto en las cordenadas correspondientes $("#" + idLesion).css({ top : puntoY + "%", left : puntoX + "%" }); // Crear objeto temporal para almacenar la información del punto var tempLesion={ 'infoPunto':{ 'posX':puntoX, 'posY':puntoY }, 'infoLesion':infoLesion }; // Agreagar tempLesion al final del arreglo lesiones lesiones.push(tempLesion); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function formarCuartoCuarto(tonalidad){\n\tvar Bajo=[\"2AS\",\"2BN\",\"3CN\",\"3CS\",\"3DN\",\"3DS\",\"3EN\",\"3FN\",\"3FS\",\"3GN\",\"3GS\",\"3AN\"];\n\tvar Tenor=[\"4DN\",\"4DS\",\"4EN\",\"4FN\",\"4FS\",\"4GN\",\"4GS\",\"4AN\",\"4AS\",\"4BN\",\"5CN\",\"5CS\"];\n\tvar Contra=[\"4FN\",\"4FS\",\"4GN\",\"4GS\",\"4AN...
[ "0.60816604", "0.59366095", "0.59167296", "0.5866127", "0.5768626", "0.5768", "0.57433873", "0.57122254", "0.57122254", "0.57122254", "0.57122254", "0.5695692", "0.5693993", "0.56884825", "0.56809855", "0.5678943", "0.5651127", "0.56170434", "0.5562376", "0.5512123", "0.54962...
0.5434791
28
Esta funcion se encarga de obtener informacion relevante sobre la lesion
function InfoLesion(cie10, id, elemento){ // Consulto el indice del arreglo por medio de la propiedad id var indice = buscarLesion(id); // Con el #id del elemento consulto el texto de la etiqueta <p>, // el cual es el nombre de la lesión var nombreLesion = $('#' + elemento + ' .item_text > p').text(); var codigoLesion = $('#' + elemento + ' .item_codigo > p > span').text(); // Valido si la lesión existe en el arreglo infoLesion if (buscarLesion(id) != -1) { // Elimino la lesión si existe en el arreglo infoLesion infoLesion.splice(indice , 1); // Animación para item que emulan las lesiones seleccionadas // en la barrar superior. $("#fracturaSelect_" + id).animate({ width:'0px', opacity: 0 }, 200 , function() { // Cuando termina la animación se elimina el elemento del DOM $("#fracturaSelect_" + id).remove(); }); // Setear la variable global seleccion = false; } // Si la lesión no esta en el arreglo infoLesion else { // Agragar clase lesionActiva a la lesion seleccionada, // esto da el efecto de selección de color verde $('#' + elemento).addClass('lesionActiva'); // Objeto temporal con la información de la lesión seleccionada var tempInfoLesion = { 'nombre': nombreLesion, 'cie10' : cie10, 'id' : id, 'especificacion' : '' }; // Agrego al final del arreglo infoLesion el objeto temporal infoLesion.push(tempInfoLesion); // Crear y imprimir en la barra superior un nuevo item // el cual representa a una lesión $("#cont-barraFracturasSelectId").append("\ <li class='fracturaSelect' id='fracturaSelect_"+ id +"' title='"+ nombreLesion +"'>\ <p>"+ codigoLesion +"</p>\ <i class='fa fa-times' onclick=\"InfoLesion(null , "+ id +" ,'"+ elemento +"')\"></i>\ </li>\ "); // Setear la variable global seleccion = true; } // Actualizar cantidad de lesiones seleccionadas var bola_plus = document.getElementById('bola_plus'); bola_plus.setAttribute('fracturasSeleccionadas' , infoLesion.length); // Validar si no hay lesiones seleccionadas y remover clase lesionActiva if (seleccion === false) { $('#'+elemento).removeClass('lesionActiva'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getGeneralData(){\n\t\t// Idioma\n//\t\tfind(\"//script[@type='text/javascript']\", XPFirst).src.search(/\\/([^\\/]+)?3.js$/);\n\t\tfind(\"//img[contains(@src, 'plus.gif')]\", XPFirst).src.search(/\\/img\\/([^\\/]+)\\//);\n\t\tidioma = RegExp.$1;\n\n\t\t// Ruta al pack grafico\n\t\tfind(\"//link[@rel='sty...
[ "0.573228", "0.5619732", "0.56003505", "0.557517", "0.55060774", "0.5276326", "0.52639526", "0.5252856", "0.5230472", "0.52227426", "0.521749", "0.52115333", "0.51557773", "0.51550436", "0.513706", "0.5119364", "0.51142657", "0.5109821", "0.5104478", "0.51001614", "0.5097218"...
0.0
-1
Fin EliminarLesion Esta funcion se encarga de limpiar el efecto de seleccion de las lesiones
function quitarSeleccion(mensaje){ // Remueve la clase lesionActiva de cada elemento <li> de la lista #listaLesiones // Esto elimina el efecto de selección de la lesión $('.body_m_lesiones > .item_lesion').each(function (indice , elemento) { $(elemento).removeClass('lesionActiva'); }); // Remueve la clase lesionActiva de cada elemento <li> de la lista // #cont-barraFracturasSelectId // Elimina de la barra superior todas las lesiones $('#cont-barraFracturasSelectId li').each(function (indice , elemento) { $(elemento).remove(); }); // Setear variable global seleccion = false; var msjExito = false; // Si no hay ninguna selección no saco el mensaje de exito if (infoLesion.length > 0) { msjExito = true; } // Vaciar información de la selección infoLesion = []; // Actualizar valor de la cantidad de lesiones seleccionadas var bola_plus = document.getElementById('bola_plus'); bola_plus.setAttribute('fracturasSeleccionadas' , '0'); // Muestra la alerta si la variable mensaje es true // Esta condición se ejecuta cuando elimino toda la selección if (mensaje) { if (msjExito) { // alerta de exito de eliminación Notificate({ tipo: 'success', titulo: 'Operación exitosa', descripcion: 'Se a eliminado la seleccion de las lesiones correctamente.', duracion: 4 }); }else { // alerta de información cuando no hay seleccion Notificate({ tipo: 'info', titulo: 'Informacion:', descripcion: 'No hay ninguna selección.', duracion: 4 }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function excluyentes(seleccionado) {\n programador_web.checked = false; \n logistica.checked = false;\n peon.checked = false;\n \n seleccionado.checked = true; \n}", "function Borrar(){\n\tcalGuiasRemoveSelection();\n}", "function limpiarSelect() {\n\n var select = document.getElem...
[ "0.6733838", "0.6644322", "0.6587408", "0.6581415", "0.6547555", "0.6535818", "0.652854", "0.65043336", "0.64959097", "0.6420103", "0.64094985", "0.6389427", "0.63650835", "0.63551235", "0.63526905", "0.63354415", "0.62689686", "0.6264455", "0.6242365", "0.623861", "0.6229017...
0.7190645
0
Esta funcion se encarga localizar un punto en el cuerpo
function localizarPunto(id) { // Desactivar la localización del punto anterior $('#' + puntoAnteriorLocalizado).css({ 'background':'#1F95D0', 'animation': 'punto 2s infinite' }); // Cerrar menu lateral $('.menu_lesiones').css({right: '-1000px'}); // Activar localización del punto solicitado $('#' + id).css({ 'background':'rgba(57, 194, 52, .89)', 'animation': 'localizar 2s infinite' }); // Después de 10 segundos se desactiva la localización del punto solicitado setTimeout(function(){ $('#'+id).css({ 'background':'#1F95D0', 'animation': 'punto 2s infinite' }); },10000); // Setear var global con el id del punto solicitado puntoAnteriorLocalizado = id; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function punto(posX , posY){\n\n // Almacena la cantidad de puntos que hay en el cuerpo\n canLesiones++;\n\n // Arma la estructura del #id\n var idLesion = 'Puntolesion_' + canLesiones;\n\n // Ancho y alto del contenedor del cuerpo\n var ancho = $(\"#cont_cuerpo\").width();\n var alto = $(\"#c...
[ "0.6018731", "0.5746477", "0.57370365", "0.56019825", "0.557643", "0.5536943", "0.552137", "0.54669344", "0.54539996", "0.54470146", "0.5428967", "0.5364386", "0.53192747", "0.5284713", "0.52659667", "0.52154636", "0.52071077", "0.51953536", "0.5189412", "0.51864463", "0.5173...
0.62235516
0
Esta funcion se encarga de listar todos los puntos del cuerpo
function listarPuntos(event) { whichWorkMode.then(function (esModoConsulta) { // Valida que hayan puntos en el cuerpo para mostrar if (lesiones.length > 0) { var infoL = ''; var idL; var onclickL; var str; // Si esta función ya se había ejecutado limpia los datos imprimidos en el DOM $(".body_m_lesiones").html(''); // Recorrer los elementos con esta clase .lesion que sean hijos de #cont_cuerpo $('#cont_cuerpo > .lesion').each(function(indice, elemento) { // Recorre el arreglo infoLesion en la lesión seleccionada y arma la estructura // Html para concatenar en la estructura siguiente. for (var i = 0; i < 3; i++) { if (lesiones[indice].infoLesion[i]) { var Imprimir = (i == 2) ? 'CONSULTAR PARA VER EL RESTO.' : lesiones[indice].infoLesion[i].nombre; if (lesiones[indice].infoLesion[i]) { infoL += '<p>'+ Imprimir +'</p>\n'; } } } // Almacena el atributo #id del elemeto idL = $(elemento).attr('id'); // Almacena el atributo onclick() del elemeto onclickL = $(elemento).attr('onclick'); // Sustraer el primer argumento de la función onclick() // el cual es un indice que apunta a una posición del arreglo lesiones str = onclickL.substring(16,17); // Contador para completar el titulo Punto # ? var contador = indice + 1; var btnEliminar = "\ <div onclick=\"EliminarLesion("+ str +" , null , '"+ idL +"' , true )\" class='btn btn-eliminar tooltip'>\ <span class='fa fa-trash-o'></span>\ <span class='tooltiptext'>Eliminar</span>\ </div>\ "; if (esModoConsulta) { btnEliminar = ""; } // Estructura de la consulta de un punto $(".body_m_lesiones").hide().append('\ <div class="item_lesion item_punto">\ <div class="item_codigo">\ <p><strong>Punto:</strong><span>#'+ contador +'</span></p>\ </div>\ <div class="item_text">\ <div class="item_list_lesiones">\ '+ infoL +'\ </div>\ <div>\ <div onclick="localizarPunto(\''+ idL +'\')" class="btn btn-consultar tooltip">\ <span class="fa fa-map-marker"></span>\ <span class="tooltiptext">Localizar</span>\ </div>\ <div onclick="consultarLesion('+ str +' , \''+ idL +'\', event, false)" class="btn btn-registrar tooltip">\ <span class="fa fa fa-eye"></span>\ <span class="tooltiptext">Consultar</span>\ </div>\ '+ btnEliminar +'\ </div>\ </div>\ </div>\ ').fadeIn('fast'); // Reseteo de variables infoL = ''; idL = ''; str = ''; }); // Mostrar menu lateral event.stopPropagation(); $('.menu_lesiones').css({right: '0px'}); } else { // alerta de error Notificate({ tipo: 'error', titulo: 'Error:', descripcion: 'No se ha agregado ningun punto.', duracion: 4 }); } }, function (err) { alert('No se pudó obtener el modo de trabajo.'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listarTudo() {\n\t\t\tImpostoService.listarTudo().then(function sucess(result) {\n\t\t\t\tvm.impostos = result.data;\n\t\t\t}, function error(response) {\n\t\t\t\tvm.mensagemErro(response);\n\t\t\t});\n\t\t}", "function listarTodosPregunta(){\r\n\r\n\tlistarTodosPreguntaGenerico(\"listarTodos\");\r\n\r\...
[ "0.62621474", "0.6146964", "0.60900176", "0.60528743", "0.59480006", "0.5918126", "0.58872664", "0.5880806", "0.57854414", "0.57742465", "0.573589", "0.5722995", "0.57195395", "0.56953496", "0.56894636", "0.5675567", "0.5640799", "0.5620165", "0.5613276", "0.55941296", "0.559...
0.56070256
19
Esta funcion se encarga crear un arreglo unico, eliminando los valores repetidos
function uniqBy(a, key) { var seen = {}; return a.filter(function(item) { var k = key(item); return seen.hasOwnProperty(k) ? false : (seen[k] = true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ArrayToRemoveIniObeya(elements, idRida) {\r\n\r\n\tvar ids = Array();\r\n\tfor (var i in elements) {\r\n\t\tids.push(elements[i].id);\r\n\t}\r\n\t\r\n\t//stats(idRida); // TODO: code commenté, pas clair.... ???\r\n\t\t\r\n\treturn ids;\r\n}", "function crearniveles() {\n let niveles = [];\n ...
[ "0.5949633", "0.5919352", "0.58210367", "0.58210367", "0.57665735", "0.57453716", "0.5741975", "0.57230705", "0.57055706", "0.5648191", "0.563448", "0.5580528", "0.55615", "0.5546339", "0.55381614", "0.5532934", "0.550717", "0.550717", "0.5502772", "0.54964256", "0.54825985",...
0.0
-1
Esta funcion se encarga consultar la informacion de un punto(lesion)
function consultarLesion(indice , idElemento, event, agregar){ whichWorkMode.then(function (esModoConsulta) { var consulta = lesiones[indice]; var info1 = consulta.infoPunto; var info2 = consulta.infoLesion; agregar = typeof agregar !== 'undefined' ? agregar : true; /** * Si el usuario previamente ha seleccionado * lesiones y le da click a un punto * esta parte del código valida que las lesiones que se pretenden * agregar a dicho punto no esten ya agregadas. * Por tanto solo se agregan las lesiones que no esten. */ if(seleccion && agregar){ info2.forEach(function(el, i) { infoLesion.forEach(function(el2, i2) { if (el.id == el2.id) { infoLesion.splice(i2, 1); } }); }); infoLesion.forEach(function(el, i) { info2.push(el); }); info2 = info2.sort(deMenorAMayor); quitarSeleccion(); seleccion = false; } /** * Aquí lo que se hace es recorrer el array de infoLesion que obtuvimos * de la consulta de lesiones[indice] y armar la estructura en html para * imprimirla en la vista. */ var i = 0; var idElement = "'"+ idElemento +"'"; var idTxtInput = ''; $(".body_m_lesiones").html(''); $(".head_m_title b").text('Punto #' + idElemento.charAt(12)); $('.head_m_buscar').hide(); $('.body_m_lesiones').css({top:'48px'}); info2.forEach(function (element, index, array) { i++; idTxtInput = 'idTxtInput-' + indice + '-' + index; var btnEliminar = '<button class="btn btn-eliminar" onclick="EliminarLesion('+ indice +','+ element.id +','+ idElement +')">\ <span class="fa fa-trash"></span>\ Eliminar\ </button>'; var onclickEspecificacion = '<button class="btn btn-registrar" onclick="agregarEspecificacion('+ indice +' , '+ index +' , \''+ idTxtInput +'\')">\ <span class="fa fa-commenting"></span>\ Especificar\ </button>'; var soloLectura = ""; if (esModoConsulta) { btnEliminar = ""; onclickEspecificacion = ""; soloLectura = 'readonly disabled class="bloquear" '; } $(".body_m_lesiones").hide().append('\ <div class="item_lesion consultar" id="'+ idTxtInput +'">\ <div class="item_codigo">\ <p><strong>Código:</strong><span>'+ element.cie10 +'</span></p>\ </div>\ <div class="item_text block">\ <p class="block">'+ element.nombre +'</p>\ <textarea rows="2" cols="2" '+soloLectura+' placeholder="Agregar Especificación">'+ element.especificacion +'</textarea>\ </div>\ '+ onclickEspecificacion +'\ '+ btnEliminar +'\ </div>\ ').fadeIn('fast'); }); // Para abrir el menu lateral if (event) event.stopPropagation(); $('.menu_lesiones').css({right: '0px'}); $('.footer_m_lesiones').hide(); }, function (err) { alert('No se pudó obtener el modo de trabajo.'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function consultarDatosPuntos() {\n $.ajax({\n type: 'POST',\n dataType: 'json',\n url: url + \"ReporteAPH/ctrlLocalizacionLesiones/ListarDatosPuntos\",\n data: {\"idReporteAPH\": idReporteAPH}\n }).done(function (res) {\n\n var puntoTemp = [];\n\n // Recorro el json res por ca...
[ "0.67729276", "0.6334451", "0.6201558", "0.61910564", "0.61675984", "0.6082365", "0.6070138", "0.60579085", "0.604639", "0.60296285", "0.60191244", "0.6005577", "0.5993452", "0.5953851", "0.5951653", "0.59503543", "0.59456587", "0.5943136", "0.5930586", "0.5927875", "0.592469...
0.60551155
8
Cuando no se encuentran resultados al filtro solicitado
function noResult (msm) { $('.body_m_lesiones').html(''); var structure = '\ <div class="n_flex n_justify_center n_align_center whole_wrapper">\ <div class="n_flex_col50 md_flex_col30 lg_flex_col60 block">\ <img class="whole_wrapper img_no_data" src="'+ url +'Public/Img/ReporteAPH/no-results.png" alt="No hay reportes disponibles." />\ </div>\ <div class="n_flex n_flex_col100 n_justify_center">\ <h3 style="text-align:center; opacity:.6;">'+ msm +'</h3>\ </div>\ </div>'; $('.body_m_lesiones').hide().append(structure).fadeIn('slow'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "filtrarSugerencias(resultado, busqueda){\n \n //filtrar con .filter\n const filtro = resultado.filter(filtro => filtro.calle.indexOf(busqueda) !== -1);\n console.log(filtro);\n \n //mostrar los pines\n this.mostrarPines(filtro);\n }", "filtro() {\n\t\tlet filtr...
[ "0.6833122", "0.6531022", "0.64700264", "0.6460829", "0.63216007", "0.62932485", "0.62786055", "0.6272913", "0.62142366", "0.62142366", "0.6186466", "0.61794835", "0.61401343", "0.61306816", "0.6129652", "0.6128915", "0.6124984", "0.6093804", "0.6056895", "0.6052044", "0.6036...
0.0
-1
Crear e imprimir los datos paginados de los CIE10
function ListarCIE10(res) { // Llenar var global para los cie10 listadoCIE10 = res; // Limpiar la lista la lista #listaLesiones antes de imprimir los nuevos datos $('.body_m_lesiones').html(''); // Recorro el json res por cada iteración imprimo en el DOM // la estructura de una lesión $.each(res , function (index , valor) { $('.body_m_lesiones').hide().append('\ <div class="item_lesion" onclick="InfoLesion(\''+ valor.codigoCIE10 +'\', '+ valor.idCIE10 +', this.id)" id="InfoLesion'+ valor.idCIE10 +'" >\ <div class="item_codigo">\ <p><strong>Código:</strong><span>' + valor.codigoCIE10 + '</span></p>\ </div>\ <div class="item_text">\ <p>'+ valor.descripcionCIE10 +'</p>\ </div>\ </div>').fadeIn('fast'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _pagination_setPageData() {\r\n var _pagination = _data['pagination'];\r\n\r\n var _startIdx = _pagination['currentPage'] * _pagination['numElementsPerPage'];\r\n\r\n _pagination['current']['elyos'].empty().pushAll(_data['elyos'].slice(_startIdx, _startIdx + _pagination['numElementsPerPage'...
[ "0.6974234", "0.6927463", "0.66889584", "0.6596137", "0.64784193", "0.646878", "0.6459356", "0.63199943", "0.6316185", "0.63129765", "0.6215316", "0.621175", "0.62066424", "0.62028474", "0.6198586", "0.6197779", "0.61933815", "0.6166811", "0.61565685", "0.61288327", "0.611051...
0.0
-1
listar los datos de los puntos
function consultarDatosPuntos() { $.ajax({ type: 'POST', dataType: 'json', url: url + "ReporteAPH/ctrlLocalizacionLesiones/ListarDatosPuntos", data: {"idReporteAPH": idReporteAPH} }).done(function (res) { var puntoTemp = []; // Recorro el json res por cada iteración creo un objeto temporal // y lo agrego al arreglo de lesiones $.each(res , function (indexPunto , valorPunto) { var lesionesTemp = []; var datosLesiones = valorPunto.datosLesiones; // Se encarga de recorrer las lesiones y agregarlos a lesionesTemp $.each(datosLesiones , function (indexLesiones , valorLesiones) { var objLesiones = { 'nombre': valorLesiones.descripcionCIE10, 'cie10' : valorLesiones.codigoCIE10, 'id' : valorLesiones.idLesion, 'especificacion' : (valorLesiones.especificacionLesion != null) ? valorLesiones.especificacionLesion : '' }; lesionesTemp.push(objLesiones); }); // Construye objeto con las lesiones y las cordenadas x - y del punto var objPunto = { "infoLesion" : lesionesTemp, "infoPunto" : { 'posX' : valorPunto.datosPunto.posX, 'posY' : valorPunto.datosPunto.posY } }; // Agrego al arreglo puntoTemp el objeto temporal objPunto puntoTemp.push(objPunto); // Almacena la cantidad de puntos que hay en el cuerpo canLesiones++; // Arma la estructura del #id var idLesion = 'Puntolesion_' + canLesiones; // i apunta al indice de la lesion ==> lesion[i] var i = puntoTemp.length - 1; // Creación de un punto en el DOM $("#cont_cuerpo").append("<div class='lesion' id='"+ idLesion +"' onclick='consultarLesion("+ i +" , this.id, event)'></div>"); // Ubicar el punto en las cordenadas correspondientes $("#" + idLesion).css({ top : objPunto.infoPunto.posY + '%', left : objPunto.infoPunto.posX + '%' }); }); // Setear arreglo lesiones con puntoTemp lesiones = puntoTemp; }).fail(function () { // alerta de error Notificate({ tipo: 'error', titulo: 'Error $Ajax', descripcion: 'ReporteAPH/ctrlLocalizacionLesiones/ListarDatosPuntos', duracion: 4 }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generarDatos() {\n let librosPrecargados = [{\n \"titulo\": \"Bullying y abuso infantil\",\n \"autor\": \"Tere Vale\",\n \"año\": \"2020\"\n },\n {\n \"titulo\": \"Marinka una rusa niña vasca\",\n \"autor\": \"Rodolfo Luna Almeida\",\...
[ "0.6266648", "0.6093826", "0.59284407", "0.58388484", "0.5750883", "0.5745983", "0.57337487", "0.5716126", "0.5710363", "0.5701917", "0.56878847", "0.5642429", "0.5634016", "0.56333935", "0.56148326", "0.5611046", "0.56052196", "0.56012", "0.5599632", "0.55637574", "0.5555934...
0.621935
1
Validar si hay un localStorage con info y si la hay la mustra en la vista
function ListarPuntosLocal() { // Consultar información del diagnostico de localStorage var lesionesLS = JSON.parse(localStorage.getItem("ReporteAPH-Lesiones")); // Validar que si hay datos en localStorage if (lesionesLS != null) { $.each(lesionesLS , function (index , valor) { canLesiones++; // Arma la estructura del #id var idLesion = 'Puntolesion_' + canLesiones; // i apunta al indice de la lesion ==> lesion[i] var i = index; // Creación de un punto en el DOM $("#cont_cuerpo").append("<div class='lesion' id='"+ idLesion +"' onclick='consultarLesion("+ i +" , this.id, event)'></div>"); // Ubicar el punto en las cordenadas correspondientes $("#" + idLesion).css({ top : valor.infoPunto.posY + '%', left : valor.infoPunto.posX + '%' }); }); // Setear arreglo de lesiones lesiones = lesionesLS; }else { //console.log("No hay lesiones en localStorage"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CheckStorage() {\n if (localStorage.getItem(\"nominees\").length !== 0) {\n let stored = localStorage.getItem(\"nominees\");\n setNominees(stored.split(\",\"));\n }\n }", "function validacion()\n{\n\t//debugger;\n\t//localStorage['usuarios'] = JSON.stringify(User);\n\tvar storedNames =J...
[ "0.71755075", "0.71127456", "0.7051236", "0.6928585", "0.6891076", "0.68629706", "0.68105143", "0.6773528", "0.6750324", "0.67270947", "0.67199934", "0.6716326", "0.67044157", "0.6673046", "0.6651046", "0.66117156", "0.65925926", "0.65912896", "0.65500325", "0.6511792", "0.64...
0.0
-1
Compara las lesiones guardadas en infoLesion y las que se estan paginadas y si son iguales les coloca la clase lesionActiva
function ValidarSeleccion() { listadoCIE10.forEach(function(el, i) { infoLesion.forEach(function(el2, i2) { if (el.idCIE10 == el2.id) { $('.body_m_lesiones').find('#InfoLesion' + el.idCIE10).addClass('lesionActiva'); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "comprobarSolicitud() {\n const { solicitudes, location: { state }, userId } = this.props;\n // Si no utilizaramos localStorage, habríamos hecho un get inicial que nos lo habría guardardo en el store, 'solicitudes' esta información de entrada, ahora solo funciona si llevamos un rato dentor del mismo usuario y...
[ "0.5720784", "0.5672621", "0.56427485", "0.56427485", "0.5628258", "0.55627346", "0.5462579", "0.54129684", "0.54051137", "0.5391163", "0.53659105", "0.53533626", "0.53376615", "0.53359187", "0.532344", "0.5273274", "0.52656627", "0.5265314", "0.5259503", "0.5244784", "0.5220...
0.54282874
7
Ordenar con la propiedad id los CIE10 dentro de un puento de manera ASC
function deMenorAMayor(elem1, elem2) {return elem1.id - elem2.id;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function idsort(a, b) { return a.id() < b.id() ? -1 : 1 }", "_alphabetizeIds(ids) {\n return ids.sort((a, b) => {\n return this.getWord(a).title.localeCompare(this.getWord(b).title);\n });\n }", "orderByID() {\n this.sort = { fieldPath: '_id', desc: false };\n return t...
[ "0.66293025", "0.64290047", "0.6264531", "0.60963666", "0.6041664", "0.6029972", "0.6001897", "0.59706634", "0.59368414", "0.58621943", "0.58406", "0.5839221", "0.5786857", "0.574015", "0.5730806", "0.5730806", "0.572772", "0.57210654", "0.5706692", "0.5643084", "0.5640712", ...
0.0
-1
Write password to the password input
function writePassword() { var password = generatePassword(); var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {}", "function writePassword() {\n var password = getPasswordOptions();\n var passwordText = document.querySelector('#password');\n \n passwordText.value = password;\n }", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.qu...
[ "0.88605946", "0.85434437", "0.8511256", "0.8500835", "0.84896296", "0.84846", "0.84719414", "0.84686357", "0.8454292", "0.8443738", "0.8431387", "0.8419759", "0.8418786", "0.8406216", "0.8403772", "0.8400314", "0.8392802", "0.83758265", "0.8370068", "0.83642554", "0.836013",...
0.0
-1