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
=========================== 7. Validate forms ==========================
function validateFormCons2() { var name = document.forms["cons2"]["name"].value; var phone = document.forms["cons2"]["phone"].value; if (name == "") { alert("Заполните Имя"); return false; } if (phone == "") { alert("Заполните Телефон"); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidForm() {\n var mainTextValid = isValidRequiredTextAreaField(\"main_text\");\n var articleKeywordCategoryValid = isValidRequiredField(\"article_keyword_category\");\n var articleKeywordsValid = isValidRequiredKeywordsField(\"article_keywords\");\n var originalSourceURLValid = isValidUrlF...
[ "0.77663404", "0.7680214", "0.7641938", "0.75574666", "0.745958", "0.74075925", "0.7387387", "0.7375239", "0.7369232", "0.72942215", "0.7291866", "0.72850144", "0.72816", "0.7257996", "0.72522587", "0.7246838", "0.72438323", "0.7233917", "0.72313005", "0.72135985", "0.7205324...
0.0
-1
creates a badge for some container jQuery is required for this plugin
function RT_Badge(userOpts) { this.$badge = null; this.z = 0; this.opts = { container : $("body")[0], position : "topright", theme : "red", offsetX : -10, offsetY : -10, animate : "blink", shape : "round", x : 0 }; // add the badge to the page this.apply = function(userOpts) { this.opts = $.extend(this.opts,userOpts); var $container = $(this.opts.container); if(!this.$badge) { this.$badge = $("<div class='rt_badge'></div>"); // determine where to put the badge var left = $container.offset().left; var top = $container.offset().top; this.$badge.css({ left:left + $container.outerWidth() + this.opts.offsetX, top:top + this.opts.offsetY }); if(this.opts.shape == "square") this.$badge.addClass("square"); $("body").append(this.$badge); // update badge info this.update(this.opts.x); } } // blink the object this.blink = function() { if(this.$badge.css("display") == "none") { this.$badge.stop().fadeIn().fadeOut().fadeIn(); } else { this.$badge.stop().fadeOut().fadeIn(); } } // show the object this.show = function() { switch(this.opts.animate) { case "blink": this.z ? this.blink() : this.hide(); break; case "none": default: this.z ? this.$badge.show() : this.hide(); break; } } // hide it this.hide = function() { if(this.$badge) { this.$badge.fadeOut(); } } // update the text this.update = function(x) { this.opts = $.extend(this.opts,userOpts); if(this.$badge) { // allow for +1 and -1 x = x.toString(); var y = parseInt(x.substr(1,x.length)); if(x.charAt(0) == "+") { this.z += y; } else if(x.charAt(0) == "-") { // protect against neg numbers this.z = this.z <= 0 ? 0 : this.z - y; } else { this.z = parseInt(x); } // set the text this.$badge.text(this.z); // show the badge this.show(); // if there is no badge, add it } else { this.apply({x : x}); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createFloatingBadge(mode, status, ht = 160) {\n const iconUrl = \"https://kkapuria3.github.io/images/KK.png\";\n const iconUrl1 = \"https://i.pinimg.com/600x315/cd/28/16/cd28168e19f7fdf9c666edd083921129.jpg\"\n const iconUrl2 = \"https://brandlogovector.com/wp-...
[ "0.59173167", "0.5785946", "0.5717268", "0.5693721", "0.568547", "0.559854", "0.55637395", "0.5508648", "0.5456458", "0.5445251", "0.5441511", "0.5347231", "0.5330223", "0.5285532", "0.5285411", "0.5273717", "0.5269101", "0.5268989", "0.5258898", "0.51993954", "0.51597714", ...
0.61223
0
notify object that gets created when you call the plugin
function RT_Notify(userOpts) { this.$el = null; this.destroyTimer = null; this.opts = { theme : "google", duration : 2000, position : "bottomright", animate : "fade", title : "", msg : "" }; this.die = function(msg) { clearTimeout(this.destroyNotify); this.$el.stop().remove(); } // destroy the notify box this.destroyNotify = function(self) { // this needs to be the object self.$el.stop().fadeOut(function() { self.die(); }); } // show the notify box this.show = function(userOpts) { this.opts = $.extend(this.opts,userOpts); // clear any existing timer clearTimeout(this.destroyTimer); // create element if it doesnt exist if(!this.$el) { this.$el = $("\ <div class='notifyBox'>\ <div class='notifyTitle'></div>\ <div class='notifyBody'></div>\ </div>\ "); $("body").append(this.$el); } var self = this; // stay on hover this.$el.hover(function() { clearTimeout(self.destroyTimer); }, function() { self.destroyTimer = setTimeout(self.destroyNotify,self.opts.duration,self); }); // put the text in this.$el.find(".notifyTitle").html(this.opts.title); this.$el.find(".notifyBody").html(this.opts.msg); // trick for icons if(!this.opts.title) { this.$el.find(".notifyTitle").css("float","left"); } else { this.$el.find(".notifyTitle").css("float","none"); } // theme this.$el.addClass(this.opts.theme); // refresh this.$el.css({ "bottom":"auto", "top":"auto", "right":"auto", "left":"auto" }); // place it switch(this.opts.position) { case "bottomright": this.$el.css({ "bottom":0, "right":0 }); break; case "bottomleft": this.$el.css({ "bottom":0, "left":0 }); break; case "topright": this.$el.css({ "top":0, "right":0 }); break; case "topleft": this.$el.css({ "top":0, "left":0 }); break; case "top": this.$el.css({ "top":0, "left":0, "max-width":"none", "width":"100%", "margin":"0px" }).addClass("full"); break; case "bottom": this.$el.css({ "bottom":0, "left":0, "max-width":"none", "width":"100%", "margin":"0px" }).addClass("full"); break; default: break; } // animate in clearTimeout(this.destroyTimer); self = this; switch(this.opts.animate) { case "fade": this.$el.stop().fadeIn(function() { self.destroyTimer = setTimeout(self.destroyNotify,self.opts.duration,self); }); break; case "slide": this.$el.stop().slideToggle(function() { self.destroyTimer = setTimeout(self.destroyNotify,self.opts.duration,self); }); break; default: break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onConstructed() {}", "onConstructed() {}", "createdCallback() {}", "function createNotify()\n{\n\n\t\tif( get[ 'msg' ] == 'insert' )\n\t\t{\n\n\t\t\t\tnotifySuccess( 'El menú <b>' + get[ 'element' ] + '</b> ha sido creado correctamente.' );\n\n\t\t}\n\n}", "create() {\n\t}", "afterCreate(result) {}", "...
[ "0.6902134", "0.6902134", "0.6621747", "0.64504045", "0.6387139", "0.63606274", "0.6359962", "0.6359962", "0.63494164", "0.62965804", "0.6286886", "0.6279907", "0.6230027", "0.6199827", "0.6179049", "0.61629844", "0.61342055", "0.6060661", "0.6044944", "0.60363925", "0.603639...
0.0
-1
========================================================================================== Testing helper functions
function runTest(testName, f, input, output, expectFail) { if (output === void 0) { output = undefined; } if (expectFail === void 0) { expectFail = false; } try { console.log("test " + testName); console.log(" input: " + input.toString()); var result = f(input); console.log(" result: " + result.toString()); var success = !result || (result && !expectFail || !result && expectFail); console.log(success ? " passed" : " FAILED"); } catch (e) { if (expectFail) { console.log(" passed: expected fail, error caught: " + e.message); } else { console.log(" FAILED: error caught = " + e.message); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "expected(_utils) {\n return 'nothing';\n }", "function sharedTests() {\n var result;\n beforeEach(function (done) {\n result = txtToIntObj.getIntObj(this.txtdata);\n done();\n });\n it('check for existence and type', function (done) {\n expect(result).to.exist;\n e...
[ "0.62763774", "0.6242734", "0.6218219", "0.57459897", "0.57459897", "0.56912947", "0.56694794", "0.5645008", "0.56223613", "0.5574177", "0.55618995", "0.5545621", "0.5538197", "0.5513998", "0.5489837", "0.5464236", "0.54594535", "0.54523635", "0.544861", "0.5445681", "0.54404...
0.0
-1
nothing in the textbox
function clearScreen() { document.calculator.resultbox.value=""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function emptyBoxes(){\n inputBox.val(\"\")\n }", "function form_raz(txt, initial_value) {\n\n if(txt.value == initial_value) txt.value = '';\n \n }", "function textboxhastext(id){\n\treturn !(id.length === 0 || !id.trim());\n}", "function clairtxtBoxAmAut(){\n document.getElementById(\"txt...
[ "0.69003224", "0.68426996", "0.68396264", "0.68312436", "0.68013006", "0.67483205", "0.6722218", "0.67139494", "0.67133504", "0.6646603", "0.6634525", "0.6605064", "0.6583088", "0.6559398", "0.6557453", "0.6549761", "0.6548784", "0.65420127", "0.6540705", "0.6532717", "0.6517...
0.0
-1
calculate resule using eval()
function calculateResult() { try { //eval(string) will work for */+- (https://www.w3schools.com/jsref/jsref_eval.asp) var input = eval(document.calculator.resultbox.value); document.calculator.resultbox.value=input; } catch(err) { document.calculator.resultbox.value="Err"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Evaluate() {}", "function calculate() {\r\n\teval();\r\n\tstopAll();\r\n}", "function calculate(){}", "function evaluate(payload) {\n const { rule, mainData, dataKey } = payload;\n\n // string expressions of the rule evaluation.\n const conditions = {\n eq: \"==\",\n neq: \"!=\",\n ...
[ "0.66440064", "0.6313008", "0.6188879", "0.61792415", "0.6131308", "0.6063179", "0.60355437", "0.59934026", "0.5905516", "0.58724314", "0.58305293", "0.5818957", "0.58027273", "0.5801989", "0.57844806", "0.57700217", "0.5768657", "0.5754404", "0.572538", "0.5719303", "0.57165...
0.5662911
24
sqrt and ^2 will immediately display result once button is pressed
function doSqrt() { var input2 = document.calculator.resultbox.value; try { var result2 = Math.sqrt(input2); document.calculator.resultbox.value = result2; } catch (err) { document.calculator.resultbox.value="Err"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function squareRoot()\n {\n current_input = Math.sqrt(current_input);\n displayCurrentInput();\n }", "function squareRoot() {\ncurrentInput = Math.sqrt(currentInput);\ndisplayCurrentInput();\n}", "function sqrt(){\n\tif (!this.classList.contains(\"disabled\")){\n\t\tevaluate();\n\t\tvar inputScreen...
[ "0.77701765", "0.7674613", "0.764238", "0.7073108", "0.67948544", "0.67832655", "0.67496145", "0.657851", "0.6577292", "0.6559996", "0.6517264", "0.6485672", "0.63884056", "0.63780576", "0.6376439", "0.63609415", "0.62917024", "0.6281794", "0.6215785", "0.61818063", "0.615307...
0.79958236
0
return HTML iframe display for the Gantt in the Database spreadsheet
function getEntireGanttSheet(width, height) { var widthScalar = 0.75; var heightScalar = 0.85; var html = `<div> <div> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#centeredFullGantt"> View Full Gantt </button> <div class="modal fade" id="centeredFullGantt" tabindex="-1" role="dialog" aria-labelledby="centeredFullGantt" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-content" style="width: ` + width * widthScalar * 1.1 + `px; height: ` + height * heightScalar * 1.1 + `px"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body" style="width: ` + width * widthScalar + `px; height: ` + height * heightScalar + `px"> <iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vQ21BbKSgpjzx-GgFu8OymjbgaaWcp-VnTcNdeFYiMmcib_LTpYQcs4229ZvGBwUNrB8zBpOqzYvF7v/pubhtml?gid=100811517&amp;single=true&amp;widget=true&amp;headers=false" style="width: ` + width * widthScalar + `px; height: ` + height * heightScalar + `px"> </iframe> </div> </div> </div> </div> </div> <div class="big-gantt"> <iframe src="https://docs.google.com/spreadsheets/d/e/2PACX-1vQ21BbKSgpjzx-GgFu8OymjbgaaWcp-VnTcNdeFYiMmcib_LTpYQcs4229ZvGBwUNrB8zBpOqzYvF7v/pubhtml?gid=100811517&amp;single=true&amp;widget=true&amp;headers=false" style="width: 100%; height: 700px"> </iframe> </div> </div>`; return html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Calendar() {\n return (\n <>\n <h5>Calendar</h5>\n <iframe\n title=\"Calendar Title\"\n src=\"https://calendar.google.com/calendar/embed?src=jonpchristie%40gmail.com&ctz=America%2FNew_York\"\n width= \"100%\"\n height= \"100%\"\n frameborder=\"0\"\n scrolling=\"yes\...
[ "0.5806583", "0.57869035", "0.56300116", "0.5610308", "0.55983096", "0.5590144", "0.5587809", "0.5543368", "0.5543", "0.54806256", "0.5463755", "0.54394054", "0.5430979", "0.5423943", "0.54152936", "0.5410391", "0.5397799", "0.53975356", "0.5396913", "0.5387686", "0.5382666",...
0.6852637
0
these are the definitions for the serial events:
function openPort() { serialPort.on('open', openPort); // called when the serial port opens var brightness = 'H'; // the brightness to send for the LED console.log('port open'); //console.log('baud rate: ' + SerialPort.options.baudRate); // since you only send data when the port is open, this function // is local to the openPort() function: function sendData() { // convert the value to an ASCII string before sending it: serialPort.write(brightness.toString()); console.log('Sending ' + brightness + ' out the serial port'); } // set an interval to update the brightness 2 times per second: //setInterval(sendData, 1500); var x = 0; var intervalID = setInterval(function () { // Your logic here sendData(); if (++x === 2) { clearInterval(intervalID); } }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function serialEvent(){\n\n}", "function serialEvent() {\n inData = Number(serial.read());\n}", "function serialEvent() {\n inData = serial.readLine();\n let splitData = split(inData, '|');\n if (splitData.length === 7) {\n b1 = int(trim(splitData[0]));\n b2 = int(trim(splitData[1]));\n slider = in...
[ "0.71352947", "0.6472466", "0.6117559", "0.5978452", "0.58761066", "0.58573383", "0.58573383", "0.58545065", "0.58094406", "0.58094406", "0.58094406", "0.57856935", "0.5711684", "0.5696215", "0.56145036", "0.56056106", "0.56056106", "0.56056106", "0.56056106", "0.56056106", "...
0.0
-1
console.log('baud rate: ' + SerialPort.options.baudRate); since you only send data when the port is open, this function is local to the openPort() function:
function sendData() { // convert the value to an ASCII string before sending it: serialPort.write(brightness.toString()); console.log('Sending ' + brightness + ' out the serial port'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showPortOpen() {\n console.log(\"port open. Data rate: \" + myPort.baudRate);\n}", "function openPort() {\n\tconsole.log('port open');\n\tconsole.log('baud rate: ' + myPort.options.baudRate);\n}", "function showPortOpen() {\n console.log('port open. Data rate: ' + myPort.baudRate);\n}", "function ...
[ "0.83013713", "0.827232", "0.825203", "0.825203", "0.80018634", "0.7850609", "0.76897776", "0.7666061", "0.75112784", "0.74730825", "0.72880846", "0.7275577", "0.71368736", "0.70893687", "0.7045895", "0.699966", "0.69972616", "0.6989601", "0.693551", "0.6915174", "0.6894452",...
0.6674045
25
turns a 2D path into an indexed 3D mesh
function meshify(path) { var mesh2d = stroke.build(path) mesh2d.positions = mesh2d.positions.map(function(p) { return [p[0], p[1], p[2]||0] }) return mesh2d }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "path(x, y, path) {\n\t\t//let vertices = Matter.Vertices.fromPath(path);\n\t\tlet vertices = this.matter.vertices.fromPath(path);\n\t\tvar poly = this.add.polygon(x, y, path, COLOR.OUTER);\n\n\t\treturn this.matter.add.gameObject(poly, {\n\t\t\tisStatic: true,\n\t\t\tshape: {\n\t\t\t\ttype: 'fromVerts',\n\t\t\t\tv...
[ "0.5992161", "0.58979166", "0.5884936", "0.58274984", "0.5763738", "0.56672543", "0.56551665", "0.55506104", "0.54741466", "0.5468343", "0.54658914", "0.54273283", "0.5415273", "0.5412148", "0.53630483", "0.53531784", "0.53108186", "0.527755", "0.5251173", "0.52357954", "0.52...
0.74383754
0
$("a[title='Show details']").css( "border", "3px double red" );
function createLink(label,link){ var newLink=$("<a>", { title: label, href: link, class: "toolbox_button" }).append( label ); return newLink; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightCorrect(elem)\n{\n $(elem).css(\"border-color\", \"green\");\n}", "function BorderClick(){\n \tjQuery (\".boxes\").css(\"border-bottom\", \"6px solid black\")\n }", "function highlightMissing(elem)\n{\n $(elem).css(\"border-color\", \"red\");\n}", "function questionSixAc...
[ "0.6178891", "0.59507513", "0.588144", "0.5837314", "0.55046815", "0.54362494", "0.5434831", "0.5361209", "0.5326422", "0.5293821", "0.52601355", "0.5210352", "0.51999545", "0.51972544", "0.5179408", "0.5177637", "0.51709926", "0.51616627", "0.51509416", "0.5146306", "0.51347...
0.0
-1
$("tr:has( > td > a[title='Show details'])").css( "border", "3px double green" );
function processFailureRow(row){ // $(row).css( "border", "3px double brown" ); var testLink=$(row).find("td:first-child a[href]"); var testInfo=createTestInfo(testLink.text()); var newLinks=[ createLink("L",relatedTicketsSearch(testInfo)), createLink("R",buildJobInvocationUri('hive-check',testInfo)), createLink("B",buildJobInvocationUri('hive-bisect',testInfo)), ]; newLinks.each(function (item) { item.insertBefore(testLink); }); // testLink.css( "border", "3px double blue" ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showHistory(){\n if ($('tbody').has(\"tr\").length) {\n $(\"#history-wrapper\").css(\"opacity\",\"1\");\n }\n}", "function letsJQuery(){ \r\n\top = $('A[class=bigusername]:first').html();\r\n\t$('A[class=bigusername]').each(function(i){\r\n\t\tif($(this).html()==op){\r\n\t\t\t$(this).parents('table...
[ "0.5757953", "0.5625711", "0.536601", "0.5303977", "0.5269391", "0.52478164", "0.522248", "0.51975113", "0.5172034", "0.5129417", "0.5095272", "0.50109905", "0.49764884", "0.49693224", "0.49129876", "0.49041867", "0.49019963", "0.48914182", "0.48213682", "0.48213416", "0.4803...
0.44212735
76
Retrieves chosen answers from the dom
_processDOMResult() { // retrieve the checked input qyuizify elements let res = document.querySelectorAll('input[name=quizify_answer_option]:checked').length > 0 ? document.querySelectorAll('input[name=quizify_answer_option]:checked') : document.querySelectorAll('input[name=quizify_answer_option]'); // for jest testing... // get the selection of the user let chosenOptions = []; for (let i = 0; i < res.length; i++) if (res[i].checked === true) chosenOptions.push(res[i].value); if (chosenOptions.length <= 0) throw new Exceptions.QuizNoAnswerSelectedException(); // pass it to the processing function this.processUserAnswer(chosenOptions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAnswers() {\n const answers = [];\n const items = document.querySelectorAll('#ballot .object_item');\n for (const item of items) {\n const q = item.querySelector('.object_question').innerText;\n const a = item.querySelector('.ballotChoiceBox').innerText;\n ...
[ "0.6990564", "0.6951023", "0.67626506", "0.6757923", "0.67193496", "0.66857815", "0.6649642", "0.65865886", "0.6501033", "0.6465727", "0.6458935", "0.6397727", "0.6389243", "0.6375311", "0.6374095", "0.63699275", "0.63460535", "0.63460535", "0.63460535", "0.63460535", "0.6346...
0.64544886
11
Grades the question answers of the user
_gradeQuestions() { let totalPossible = 0; // total possible score of quiz let totalScored = 0; // total points scored let totalPenalised = 0; // total penalisation points (incorrect selections on multiples) let totalFinal = 0; // the final score for (let i = 0; i < this._data.length; i++) { let question = this._data[i]; totalPossible += question.weight; let scored = 0; let penal = 0; // get total correct for (let j = 0; j < question.answers.length; j++) { let answer = question.answers[j]; if (answer.is_correct && question._selectedAnswers.indexOf(answer.id.toString()) !== -1) scored += question.weight / question.answers.filter(ans => ans.is_correct === true).length; // penalise on multiple choice for incorrect selection else if (question.has_multiple_answers && !answer.is_correct && question._selectedAnswers.indexOf(answer.id.toString()) !== -1) { // we need to make sure that th penal += question.weight / question.answers.filter(ans => ans.is_correct === true).length; } } // make sure we dont remove points from the total if the penalisation points are larger than the scored points if (scored >= penal) { totalScored += scored; totalPenalised += penal; } } totalFinal = totalScored - totalPenalised; let resData = { totalPossibleScore: totalPossible, totalAchievedScore: totalScored, totalPenalisedScore: totalPenalised, totalFinalScore: totalFinal, percentageAchieved: Math.round(totalFinal / totalPossible * 100), dom_node: null }; return this._constructResultsDOMNode(resData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function grade() {\n\n//question 1 answer r1\nif (answer1 === \"r1\") {\n correct++;\n } else if ((answer1 === \"r2\") || (answer1 === \"r3\")) {\n incorrect++;\n } else {\n unanswered++;\n }\n\n//question 2 answer r3\nif (answer2 === \"r3\") {\n correct++;\n } else if ((answer2 ===...
[ "0.70739365", "0.69831365", "0.69819385", "0.6911157", "0.68497247", "0.6846021", "0.6685604", "0.6646871", "0.6642258", "0.6623925", "0.66044986", "0.6559508", "0.6553108", "0.6531467", "0.6524902", "0.64788014", "0.64725673", "0.6448671", "0.64433736", "0.6415571", "0.63948...
0.67578584
6
Retrieve the next step in the quiz, either a question or a result
getNext() { if (this._position > -1 && !this._data[this._position]._selectedAnswers) throw new Exceptions.QuizNoAnswerSelectedException(); this._position++; let nextQuestion = this._data[this._position]; if (nextQuestion) { // check if there are multple correct answers or not let possibleAnswerCount = nextQuestion.answers.filter(answer => answer.is_correct === true).length; nextQuestion.has_multiple_answers = possibleAnswerCount === 1 ? false : true; // construct the dom node nextQuestion.dom_node = this._constructQuestionDOMNode(nextQuestion); // return the question data return new QuizifyQuestion(nextQuestion); } else { let results = this._gradeQuestions(); return new QuizifyResult(results); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextQuestion() {\n const isQuestionOver = (triviaQuestions.length - 1) === currentQuestion;\n if (isQuestionOver) {\n displayResult();\n }else{\n currentQuestion++;\n loadQuestion();\n }\n\n }", "function nextQuestion() {\n currentQuesti...
[ "0.7197843", "0.7099756", "0.7055396", "0.6944611", "0.68791986", "0.67972666", "0.67965084", "0.6787657", "0.6782662", "0.67815286", "0.677654", "0.675929", "0.6755195", "0.67465687", "0.6692765", "0.6681112", "0.66695", "0.6658128", "0.6654292", "0.6642181", "0.6640567", ...
0.6596039
26
funcion de mensaje de succes
function vamos() { Swal.fire({ icon: "success", title: "¡Vamos!", text: "Todo a salido bien :)", confirmButtonText: "Cerrar pestaña", }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t\tnotif(\"success\", \"Brief envoyé avec <strong>succès</strong> !\");\n\t\t}", "success(message) {\n return this.sendMessage(MessageType.Success, message);\n }", "function Success(msg, devmsg) {\n success(msg);\n $log.in...
[ "0.7595283", "0.7076018", "0.7046274", "0.7010905", "0.69970345", "0.6987952", "0.6926352", "0.6926352", "0.6926352", "0.6926352", "0.6926352", "0.6926352", "0.6926352", "0.6926352", "0.6908995", "0.6897187", "0.674808", "0.6707035", "0.6694319", "0.66782093", "0.66721964", ...
0.0
-1
function to get the selected id from table
function getSelectedNetMdId(pgTableName) { var netmdId=""; if($j(pgTableName).dataTable().fnGetData().length>0) { var selNetMd = $j(pgTableName + ' tbody tr[selected]'); if(selNetMd.length==0){ updateTipsNew("select atleast one netmd",$j('#errorDivData'),$j('#errorDivHeader')); } else if(selNetMd.length>1) updateTipsNew("select only one netmd",$j('#errorDivData'),$j('#errorDivHeader')); else netmdId=selNetMd.attr('id'); } return netmdId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_id_selection () {\n return $.map($table.bootstrapTable('getSelections'), function (row) {\n return row.id;\n })\n}", "selectId() {\n return this.id ? this.id : this._uid; // eslint-disable-line no-underscore-dangle\n }", "selectFriend (rowId) {\n\n }", "function fnGetSelect...
[ "0.77054846", "0.6874063", "0.678539", "0.668275", "0.6632723", "0.66003734", "0.65655893", "0.65271795", "0.6497005", "0.64847237", "0.64712465", "0.64539504", "0.6421429", "0.6364018", "0.63632745", "0.6358161", "0.63525355", "0.63245887", "0.63199544", "0.63189983", "0.630...
0.69430244
1
This is for http interceptor
function httpServiceFactory(backend, options) { return new __WEBPACK_IMPORTED_MODULE_11__providers_http_service_service__["a" /* HttpService */](backend, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function interceptor($q) {\n return {\n 'request': function(config) {\n // do something on success\n console.log(\"Intercepter, request \", config.url);\n var url = config.url.toString();\n console.log(url);\n\n if (url.indexOf(\"special-api\") > -1)...
[ "0.70661414", "0.68868506", "0.68868506", "0.68868506", "0.68868506", "0.68868506", "0.6664952", "0.65963316", "0.6553913", "0.649558", "0.64951473", "0.6475253", "0.6437685", "0.64230907", "0.6414247", "0.63993824", "0.63648355", "0.63594586", "0.6279924", "0.6275586", "0.62...
0.0
-1
isSubmited: boolean = false;
function ForgotPasswordComponent(fb, userService, router) { this.fb = fb; this.userService = userService; this.router = router; this.data = []; this.isSubmited = false; this.msgs = []; this.forgotPasswordForm = this.fb.group({ email: [null, __WEBPACK_IMPORTED_MODULE_1__angular_forms__["Validators"].required] }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set isSubmit(value) {\n this.data.set('submit', value);\n }", "set isSubmit(value) {\n this.data.set('submit', value);\n }", "enableSubmit() {\n this.wasChange = true;\n }", "enableSubmit() {\n this._disableSubmit = false;\n }", "function enableSubmitEvent() {\r\n $(\"#sub...
[ "0.754355", "0.754355", "0.72813183", "0.7166593", "0.69735515", "0.69401044", "0.6938561", "0.6898109", "0.6886757", "0.68463147", "0.68433774", "0.6742062", "0.6720877", "0.6702317", "0.6676985", "0.66761696", "0.659592", "0.65885967", "0.6578654", "0.65744793", "0.65628463...
0.0
-1
vuex v3.1.0 (c) 2019 Evan You
function r(t){var e=Number(t.version.split(".")[0]);if(e>=2)t.mixin({beforeCreate:r});else{var n=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[r].concat(t.init):r,n.call(this,t)}}function r(){var t=this.$options;t.store?this.$store="function"===typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFieldVuex() {\n return store.getters.dataField;\n }", "function vuexInit(){var options=this.$options;// store injection\n\tif(options.store){this.$store=options.store;}else if(options.parent&&options.parent.$store){this.$store=options.parent.$store;}}", "function U(He){Le&&(He._devtoolHook=Le,Le.emit('v...
[ "0.7099906", "0.6993732", "0.6736782", "0.6719839", "0.66230166", "0.661622", "0.661622", "0.661622", "0.6585128", "0.6483413", "0.6353763", "0.6346337", "0.6339407", "0.6339407", "0.6339407", "0.6339407", "0.6339407", "0.6328541", "0.6301164", "0.62952876", "0.62822306", "...
0.0
-1
! vuerouter v3.0.2 (c) 2018 Evan You
function r(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "func...
[ "0.60415715", "0.5918748", "0.5844924", "0.5757533", "0.5714492", "0.5661645", "0.56571835", "0.557702", "0.5551288", "0.5537155", "0.5529827", "0.5528053", "0.5526852", "0.5525806", "0.5488529", "0.54618627", "0.5449665", "0.54413414", "0.54372483", "0.5416988", "0.5402368",...
0.0
-1
Apply the icon and edge overlay for notebooks
function applyOverlay(overlay) { image.scan(0, 0, image.bitmap.width, image.bitmap.height, (x, y, idx) => { if(overlay.data[idx+3]) { image.bitmap.data[idx] = overlay.data[idx]; image.bitmap.data[idx+1] = overlay.data[idx+1]; image.bitmap.data[idx+2] = overlay.data[idx+2]; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getIcon() {\n return \"document-cook\";\n }", "function setDesktopIcons(){\t}", "function adjustIconColorDocument() {\n $('.oi-icon').each(function(e) {\n if(!$(this).hasClass('colored')) {\n $(this).css('fill', '#3E2F24');\n $(this).addClass('colored');\n }\n });\n }",...
[ "0.61194587", "0.5649992", "0.56415045", "0.5597871", "0.55948776", "0.55948776", "0.55651", "0.5488496", "0.54465544", "0.5419494", "0.5375075", "0.53739434", "0.53674793", "0.53476316", "0.53421384", "0.5298013", "0.52397525", "0.52383924", "0.521763", "0.52105266", "0.5199...
0.0
-1
2 things that the reducer needs to run properly
function cartReducer(state = initialState, action) { switch(action.type) { case 'ADD_TO_CART': // check if payload is already in the cart, and use the new one. return [...state, action.payload]; case 'REMOVE_FROM_CART': default: return state; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reducer(){\n\n}", "reducer(res) {\n return res;\n }", "function reducer(a,b) {\n return a + b;\n}", "function greetingReducer() {}", "reduce(state, payload) {\n let {action, data} = payload;\n\n switch(action) {\n case 'moveTo':\n state = state.wi...
[ "0.7632389", "0.65508217", "0.63679755", "0.633189", "0.6183542", "0.6078669", "0.60338074", "0.5911004", "0.5856217", "0.5832969", "0.5764617", "0.57486224", "0.5740887", "0.57302856", "0.57111716", "0.5704796", "0.5702329", "0.56231606", "0.5610277", "0.55913013", "0.558919...
0.0
-1
Crea un nuevo autor
CreateAuthor(name, lastname) { let connection = new Connection(); connection = connection.createTheConnection(); let query = connection.query('INSERT INTO author(name, lastname) VALUES (?, ?)', [name, lastname], (err, res) => { if (err) { return callback(false); } else { return callback(null, true); } }); connection.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createUser() {}", "function createUser(cedula,apellido,email, nombre, telefono, pass){\n const password = pass;\n var userId=\"\";\n \n auth.createUserWithEmailAndPassword(email, password)\n .then(function (event) {\n user = auth.currentUser;\n userId = user.uid;\n co...
[ "0.6477068", "0.61429596", "0.5997959", "0.59943604", "0.59704065", "0.5959004", "0.5959004", "0.59505993", "0.5930008", "0.58665365", "0.5854698", "0.58485836", "0.5841949", "0.58324105", "0.58209676", "0.5803009", "0.5798466", "0.5784537", "0.5751182", "0.5748544", "0.57458...
0.0
-1
Obtiene la informacion de todos los autores
ReadAllAuthors() { let connection = new Connection(); connection = connection.createTheConnection(); let query = connection.query('SELECT * FROM author', (err, res) => { if (err) { return callback(false); } else if (res.length <= 0) { return callback(false); } else { return callback(null, res); } }) connection.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mostrarAutores(){\r\n console.log('Estos son los autores de los libros: ');\r\n var autores = [];\r\n for (var libro of arrayLibros) {\r\n autores.push(libro.obtAutor());\r\n }\r\n\r\n // Ese atributo de \"sort\" se usa para acomodarlos en orden alfabetico\r\n console.log(autores....
[ "0.6746726", "0.63638836", "0.6344408", "0.62609273", "0.59965193", "0.5806011", "0.55198395", "0.54933554", "0.54217774", "0.5330804", "0.5274624", "0.5273494", "0.52241516", "0.516689", "0.51622593", "0.5161412", "0.5156986", "0.5153989", "0.515312", "0.5117778", "0.5100869...
0.0
-1
Elimina a un autor de forma permanente
DeleteAuthor(id_author) { let connection = new Connection(); connection = connection.createTheConnection(); let query = connection.query('DELETE FROM author WHERE id_author = ?', [id_author], (err, res) => { if (err) { return callback(false); } else { return callback(null, true); } }) connection.end(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deletarAgendamento() {\n\tfirebase.database().ref('users/' + uid).remove();\n\t$('#mdlVerAgendamento').modal('toggle');\n}", "function eliminarPersona(user,res){\n tb_persona.connection.query(\"DELETE FROM persona WHERE id=\" + user.id);\n res.send();\n}", "function eliminarContacto() {\n\n v...
[ "0.6655156", "0.66509795", "0.6445108", "0.63258016", "0.62967265", "0.62295526", "0.6170273", "0.6165797", "0.6147298", "0.61373544", "0.6123039", "0.6098199", "0.6079469", "0.60413927", "0.6024179", "0.60149723", "0.60099196", "0.60044533", "0.5968627", "0.59415555", "0.594...
0.0
-1
=== ES6 class , === instead of providing a separate getInitialState method, === set up your own state property in the constructor.
constructor(props) { //=== Clock.propTypes = { cw: PropTypes.number.isRequired, ch: PropTypes.number.isRequired, istyle: PropTypes.object }; //=== props Clock.defaultProps = { cw: 350, ch: 350, istyle: { hmsColor: { h: 'red', m: 'cyan', s: 'red' }, fontSize: 20, backgroundColor: 'white', labelColor: 'orange', hSize: { w: 40, h: 90 }, mSize: { w: 20, h: 140 }, sSize: { w: 10, h: 160 } } }; // external props will override the defaultProps? super(props); if (!props.istyle) props.istyle = Clock.defaultProps.istyle; //if (!props.istyle.position) props.istyle.position = Clock.defaultProps.istyle.position; if (!props.istyle.hSize) props.istyle.hSize = { w: props.cw / 20, h: (props.ch / 2) * 0.65 }; if (!props.istyle.mSize) props.istyle.mSize = { w: props.cw / 30, h: (props.ch / 2) * 0.75 }; if (!props.istyle.sSize) props.istyle.sSize = { w: props.cw / 40, h: (props.ch / 2) * 0.85 }; if (!props.istyle.fontSize) props.istyle.fontSize = 20; if (!props.istyle.backgroundColor) props.istyle.backgroundColor = 'cyan'; if (!props.istyle.labelColor) props.istyle.labelColor = 'orange'; //=== initial state this.state = { cw: props.cw, ch: props.ch, // hVal: 0, // mVal: 0, // sVal: 0 hmsVal:{hour:0, min:0, sec:0} }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(props) { // be promoted into a class\n super(props);\n this.state = {}; // defines initial state\n }", "constructor() {\n this.state = undefined\n }", "constructor() {\n // Run super\n super();\n\n // Bind private methods\n this.state = this.state.bind(this);\n }", "...
[ "0.8099104", "0.78394103", "0.78181684", "0.7782156", "0.77612954", "0.7757197", "0.7735324", "0.7635433", "0.7609939", "0.7600566", "0.7592889", "0.75672233", "0.74645805", "0.7440463", "0.74289197", "0.7412397", "0.73982376", "0.73736376", "0.7369459", "0.73577625", "0.7352...
0.0
-1
resize clock when div size changed
resizeClock() { //const th = this; //let elm = ReactDOM.findDOMNode(th); //let size = Math.min(window.width, window.height); //console.log("resizeClock: " + size) /*th.setState({ cw: size, ch: size })*/ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateClockSizes() {\n EventFactory.events.forEach(function(e){EventFactory.setSize(e, window.innerWidth/(isMobile?2.5:13))});\n \n EventFactory.setSize(MainEvent, (isMobile?0.95:.6)*windowHW());\n}", "function repaintClock() {\r\n\t\t\t\tif (selectionMode == 'HOUR') {\r\n\t\t\t\t\trepaintClock...
[ "0.70080316", "0.66039807", "0.6589867", "0.6363707", "0.621936", "0.6183913", "0.6150003", "0.61463803", "0.612782", "0.6108592", "0.60831994", "0.60551375", "0.6032234", "0.6031214", "0.60196763", "0.6014489", "0.6008291", "0.5998556", "0.598506", "0.5978489", "0.59771335",...
0.707742
0
Write a function that returns a boolean indicating whether or not a string is a palindrome.
function palinChecker(string){ var backword = string.split('').reverse().join(''); console.log(backword); if (backword == string){ console.log("You have a palindrome."); return true; } else{ console.log("Not a palindrome."); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function palindrome(str) {\n return true;\n}", "function palindrome(str) {\r\n // Good luck!\r\n return true;\r\n}", "function palindrome(str) {\n // Compare if original string is equal with reversed string\n return str === reverse(str)\n}", "function palindrome(str){\r\n return reverseString(str...
[ "0.86665916", "0.85041326", "0.84377784", "0.83795154", "0.8357682", "0.8331101", "0.8313112", "0.8280678", "0.8265561", "0.82470965", "0.8241521", "0.82032156", "0.8177709", "0.8172808", "0.81659514", "0.8157817", "0.8136953", "0.81322205", "0.81254363", "0.8121037", "0.8120...
0.0
-1
Takes a string that is a sentence, and returns the number of words and average word length.
function sentenceInfo(sentence){ var numLetters = sentence.replace(/ /g,"").length; var numWords = sentence.split(" ").length; var avgWrdLength = numLetters/numWords; console.log("There are "+numWords+" words in this sentence, and the average word length is "+avgWrdLength+" words.") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findAvgWordLength(txt) {\n let words = getWords(txt);\n let count = 0;\n for (let i = 0; i < words.length; i++) {\n \tcount += words[i].length;\n }\n\n return count / words.length;\n}", "function averageWordLength (words) {\n var totalLength = words.join(\"\").length;\n return (totalLength / wor...
[ "0.7539853", "0.7374321", "0.72900426", "0.72513944", "0.7120894", "0.7067416", "0.70612097", "0.70395035", "0.7038953", "0.7012962", "0.700803", "0.70080245", "0.6939312", "0.69013464", "0.6893938", "0.68596846", "0.6774027", "0.6746693", "0.6745428", "0.6714068", "0.6687568...
0.82989645
0
create prototype of Child, that created with Parent prototype (without making Child.prototype = new Parent()) __proto__ < __proto__ ^ ^ | | Parent Child
function Surrogate(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function applyPrototype(parent,child){\n\tchild.prototype = Object.create(parent.prototype);\n\tchild.prototype.constructor = child;\n}", "function subclass(child, parent) {\n child.prototype.__proto__ = parent.prototype;\n}", "function inheritPrototype(childObject, parentObject) {\n var copyOfParent = O...
[ "0.7548634", "0.7137564", "0.69749093", "0.6892633", "0.6832302", "0.67413795", "0.67216116", "0.66736656", "0.66182935", "0.66182935", "0.65928453", "0.65928453", "0.6586049", "0.6561189", "0.6554661", "0.6533801", "0.6530078", "0.65265024", "0.6518368", "0.6509167", "0.6498...
0.0
-1
method to render the train schedule call
function renderTrains () { $('tbody').empty(); // looping through the array of trains for (var i=0; i < trainSchedule.length; i++) { // set the row in html var row = $("<tr>"); // set the first column to populate train name var td1 = $("<td>").text(trainSchedule[i].trainName); // set the second column to populate train destination var td2 = $("<td>").text(trainSchedule[i].destination); // set a start variable of the first train of the day var tStart = trainSchedule[i].firstTrainTime; // set the frequency for each train var tFrequency = trainSchedule[i].frequency // convert the start time to minutes and make it in the past so you can analyze it without errors var tStartConverted = moment(tStart, "HH:mm").subtract(1, 'years') // sets the current time var currentTime = moment() // calculates the difference in time from the start time to now var diffTime = moment().diff(moment(tStartConverted), "minutes") // calculates the remainder of the difference in time divided by the frequency of the trains var tRemainder = diffTime % tFrequency // calculates the time remaining until the next train var tMinutesTilTrain = tFrequency - tRemainder // sets the time the next train will arrive var nextTrain = moment().add(tMinutesTilTrain, "minutes").format('HH:mm') // populates the third column with frequency of train arrival var td3 = $('<td>').text(tFrequency) // populates the fourth column with the time the next train will arrive var td4 = $('<td>').text(nextTrain) // populates the fifth column with the time until the next train arrives var td5 = $('<td>').text(tMinutesTilTrain) //append all columns to the table row.append(td1).append(td2).append(td3).append(td4).append(td5); $("tbody").append(row); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n\tconsole.log(\"Re-rendering\")\n\tif (selectedTopicID != \"\" && selectedTopicID != null) {\n\t\tdocument.title = \"Work Log - \" + topicsDictionary[selectedTopicID].name;\n\t\t$(\"#time-elapsed-header\").html(formatCounter(topicsDictionary[selectedTopicID].time));\n\t}\n\trenderTopics();\n\t...
[ "0.59909433", "0.58976144", "0.5891908", "0.5891722", "0.5852336", "0.5830973", "0.57998675", "0.57507503", "0.5747022", "0.5734968", "0.5723215", "0.56842685", "0.5664556", "0.5657985", "0.56468445", "0.56430423", "0.560802", "0.558859", "0.5573398", "0.55627066", "0.5533108...
0.6137099
0
Function for displaying animal data
function renderButtons() { // preventing repeat $("#animals-button").empty(); for (var i = 0; i < animals.length; i++) { var a = $("<button>"); a.addClass("animal"); a.attr("data-name", animals[i]); a.text(animals[i]); $("#animals-button").append(a); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayAnimalInfo() {\n\n\t\tvar animal = $(this).attr(\"data-name\");\n\t\tconsole.log(\"animal= \" + animal);\n\t\tvar queryURL = \"https://api.giphy.com/v1/gifs/search?q=\" + animal + \"&api_key=dc6zaTOxFJmzC&limit=10\";\n\t\tconsole.log(\"queryURL= \" + queryURL);\n\t\t\t//creating AJAX call for speci...
[ "0.7203563", "0.70514053", "0.67474014", "0.6629687", "0.6607811", "0.6543826", "0.64710593", "0.64496416", "0.6402128", "0.63760084", "0.6364072", "0.6310598", "0.63053083", "0.62978953", "0.628696", "0.6271424", "0.62701595", "0.62427247", "0.62411225", "0.62229145", "0.621...
0.0
-1
TODO: Add sorting functionality
renderSorting() { return (<div className="search-bar__sort"> <span>Sort by: </span> <i className="search-bar__sort-icon"></i> <i className ="search-bar__arrow-down"></i> </div>); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sort() {}", "sort() {\n\t}", "sort() {\n\t}", "function sortJson() {\r\n\t \r\n}", "function sortResults(){\n return sort.sortCustomerRecords(result);\n}", "sort(){\n\n }", "Sort() {\n\n }", "sortProducts() {}", "getOrderBy() {}", "sortedListings() {\n return this.state.data....
[ "0.6634282", "0.66133404", "0.66133404", "0.6498647", "0.64679635", "0.64645666", "0.6387402", "0.63607615", "0.63265496", "0.6305758", "0.6275738", "0.6266211", "0.6252127", "0.622554", "0.620018", "0.6185742", "0.61510754", "0.6140837", "0.6131251", "0.6130222", "0.61281455...
0.0
-1
Usa WebSocket per inviare il messaggio al server
function onSendMessage(){ var msg = document.getElementById("usermsg").value; if(msg == "") alert("assicurati di inserire il testo da inviare"); else { if(sex == "lui") msg = "newMsg " + name + ": <div style='background-color:lightblue;display:inline-block;box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);border-radius: 5px'>" + document.getElementById("usermsg").value + "</div>"; else msg = "newMsg " + name + ": <div style='background-color:pink;display:inline-block;box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);border-radius: 5px'>" + document.getElementById("usermsg").value + "</div>"; //alert(msg); connection.send(msg); document.getElementById("usermsg").value=""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendMessage() {\r\n let content = document.getElementById(\"msg\").value;//recupere le message de l'input\r\n document.getElementById(\"msg\").value = \"\";//on vide l'élément\r\n websocket.send(\"[\"+login+\"] \"+content);//on envoie le msg au serveur + login de la personne\r\n}", "function br...
[ "0.71629256", "0.71394575", "0.71254086", "0.7046015", "0.69793725", "0.69706637", "0.68876296", "0.68816143", "0.68699855", "0.6803276", "0.6787835", "0.6771053", "0.6757966", "0.67429477", "0.6709441", "0.6709295", "0.6692104", "0.6691715", "0.6673603", "0.6667317", "0.6646...
0.6305127
67
Automatically indent the Chat Window
function overflowFix(){ var element = document.getElementById("chatBox"); element.scrollTop = element.scrollHeight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateChatWindow(str){\n $(\"#chatWindow\").prepend( str + \"\\n\" )\n}", "function chatWindow (settings) {\n function draw (selection) {\n var messages = selection.selectAll('div.message')\n .data(settings.messages, function (d) { return d.id })\n messages\n .classed('mess...
[ "0.59158736", "0.5746999", "0.573626", "0.5684531", "0.5594022", "0.548549", "0.54789877", "0.54735273", "0.5453367", "0.53605527", "0.5331817", "0.5316855", "0.5314494", "0.5304399", "0.5295936", "0.5258274", "0.5228602", "0.5215712", "0.5211028", "0.5169184", "0.515939", ...
0.0
-1
quando viene premuto il tasto ENTER/INVIO su tastiera, invia messaggio
function onEnterSendMessage(e) { if (e.keyCode === 13) { onSendMessage(sex, name); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tastoInvio(event) {\r\n if (event.which == 13) {\r\n inviaMessaggio();\r\n }\r\n }", "function invioTasto(e){\r\n var key = e.which;\r\n var inputCercaFilm = inputFilm.val();\r\n if(key == 13){ // 13 tasto invio\r\n ricercaTitolo();\r\n }\r\n }", "function PremiInvio(even...
[ "0.8452439", "0.7159661", "0.7050387", "0.68797225", "0.6662516", "0.6651202", "0.6587322", "0.6563563", "0.65477324", "0.6506453", "0.6471627", "0.6415464", "0.63980526", "0.6384608", "0.6382589", "0.6364818", "0.6337972", "0.6326123", "0.63210106", "0.6305891", "0.6303539",...
0.6432059
11
Helper Functions Checks if input is a valid number.
function _isValidNumber(number) { var errorMessage = ""; if (number.length == 0) { errorMessage = "Must enter a valid number"; } else if (Math.sign(number) == -1) { errorMessage = "Cannot be negative"; } else if (number == 0) { errorMessage = "Cannot be zero"; } else if (number.toString()[0] == "0") { errorMessage = "Cannot have leading 0"; } else if (number.indexOf('.') !== -1) { errorMessage = "has decimal"; } return errorMessage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidNumber ( input ) {\r\n\t\treturn typeof input === 'number' && isFinite( input );\r\n\t}", "function isValidNumber ( input ) {\r\n\t\treturn typeof input === 'number' && isFinite( input );\r\n\t}", "function isValidNumber(input) {\n return typeof input === 'number' && isFinite(input);\n ...
[ "0.8498495", "0.8498495", "0.8494983", "0.84911335", "0.84911335", "0.8454034", "0.84370553", "0.8434083", "0.8341299", "0.80753624", "0.80330265", "0.7917614", "0.77989614", "0.76512975", "0.76502633", "0.76326776", "0.7621404", "0.75786793", "0.75480574", "0.7543008", "0.74...
0.70356685
88
Checks if inches value is more than 11
function _inchesMoreThan12(number) { var errorMessage = "" if (number > 11) { return errorMessage = "Cannot be more than 11 in"; } return errorMessage; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inchesConvert() {\n var newFt = parseInt($heightInput.val()) || 0;\n var newIn = parseInt($heightInputIn.val());\n while (newIn >= 12) {\n newFt++;\n newIn -= 12;\n }\n $heightInput.val(newFt);\n $heightInputIn.val(newIn);\n }", "function areYouWithinTwentyDigitsOf(integer) ...
[ "0.6157761", "0.60477793", "0.58263224", "0.58233494", "0.5759308", "0.5754653", "0.5723126", "0.57037085", "0.57028764", "0.56930906", "0.5671446", "0.5647488", "0.5646766", "0.5646766", "0.5629582", "0.56227756", "0.5621705", "0.5594497", "0.55896497", "0.5557051", "0.55417...
0.61885566
0
CREATE USER PROFILE FUNCTION Compiles user input into a map to create a "profile", returns a map called User
function createUserProfile() { const user = new Map(); user.set("age", document.getElementById("age").value); user.set("gender", document.querySelector("input[name='gender']:checked").value.toLowerCase()); user.set("weight", document.getElementById("weight").value); user.set("feet", document.getElementById("feet").value); user.set("inches", document.getElementById("inches").value); user.set("activity", document.getElementById("activity-level").value.toLowerCase()); return user; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getUserProfile(user) {\n return {\n coords: [noise(user.longitude), noise(user.latitude)],\n name: user.name,\n location: user.city + ', ' + user.state,\n email: user.email,\n company: user.currentemployer,\n cohort: user.cohort\n };\n}", "createProfile() {}", "function createUserP...
[ "0.6732075", "0.6704106", "0.6523785", "0.62657285", "0.61514395", "0.61436176", "0.6122447", "0.6119022", "0.6116389", "0.61005634", "0.60932815", "0.607823", "0.60726297", "0.6060197", "0.6051151", "0.60453403", "0.6027172", "0.6025027", "0.60161436", "0.599851", "0.5998496...
0.70402855
0
VALIDATE FORM FUNCTION Validates form input; ensures that user inputs all necessary information correctly before calculating results. Deploys error messages instructing user to make corrections where necessary. Fires when user clicks submit form.
function validateForm() { return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processForm() {\n // validate elevation\n if ($('#mtnElevation').val() < 4003 || $('#mtnElevation').val() > 6288) {\n $('#alertMsg').html('Elevation must be between 4,003 and 6,288 feet.');\n $('#mtnElevation').focus();\n $('#alertMsg').show();\n return false;\n }\n\n // va...
[ "0.74749106", "0.74646735", "0.74002945", "0.73236877", "0.7248498", "0.72438556", "0.72245204", "0.7194632", "0.7169855", "0.7137599", "0.71145856", "0.71109533", "0.7103105", "0.706405", "0.704097", "0.7020283", "0.70136404", "0.6997217", "0.69936943", "0.6988188", "0.69803...
0.66912913
55
validateForm() SUB FUNCTIONS CALCULATE RESULTS FUNCTION Calculates results; takes user information from form input, and calculates the user's BMR and TDEE. Uses the appropriate formulas/modifiers based on gender and activity level. Fires when user clicks submit form, and inputs are determined valid based on validateForm().
function calculateResults() { return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculate() {\n\t\t\tlet age = document.getElementById(\"inputAge\").value;\n let sex = document.getElementById(\"selectSex\").value;\n let pregnantOrLactating = document.getElementById(\"selectPregnantLactating\").value;\n\t\t\tlet height = document.getElementById(\"inputHeight\").v...
[ "0.7129552", "0.69248116", "0.6914516", "0.68146706", "0.680093", "0.6701954", "0.65745425", "0.6408853", "0.63911575", "0.62697077", "0.6230799", "0.6220002", "0.6200124", "0.61972755", "0.6182241", "0.6176631", "0.6169938", "0.61676365", "0.6167057", "0.61466616", "0.613880...
0.0
-1
validateForm() SUB FUNCTIONS DISPLAY RESULTS FUNCTION Displays results; sends the BMR and TDEE output from calculateResults() back to the user. Fires when user clicks submit form, and inputs are determined valid based on validateForm() Main Function
function displayResults () { if(validateForm()) { // If all inputs are valid, create a user profile to calculate results const user = createUserProfile(); // TDEE Results document.getElementById("tdee-results").innerHTML = "Your TDEE: results"; // BMR Results document.getElementById("bmr-results").innerHTML = "Your BMR: results"; // Input Results var inputResults = ""; inputResults += "Showing results for a "; inputResults += user.get("activity") + " " + user.get("age") + " year old " + user.get("gender") + " who is " + user.get("feet") + " feet " + user.get("inches") + " inch(es) tall and weighs " + user.get("weight") + " pounds."; document.getElementById("input-results").innerHTML = inputResults; } else { document.getElementById("error-message").innerHTML = "Error"; } return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CalculateResults()\r\n {\r\n var inputsAllValid;\r\n\r\n // Fetch all input values from the on-screen form.\r\n\r\n inputsAllValid = FetchInputValues();\r\n\r\n // If the fetched input values are all valid...\r\n\r\n if (inputsAllValid)\r\n {\r\n // Do the natural gas pressure ...
[ "0.7274176", "0.6891208", "0.68455535", "0.6758833", "0.6714852", "0.667124", "0.66194046", "0.66145086", "0.65784657", "0.6570059", "0.6562505", "0.6532438", "0.651918", "0.6418197", "0.63812256", "0.63282543", "0.63188857", "0.6238029", "0.62064457", "0.6204553", "0.6203649...
0.7807186
0
add getters to be able redraw item on scroll
get parentTop () { return self.parentRect.top }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n\t\tthis.scroll.update();\n\t}", "updateData() {\n this._heightSetter.style.height = this.students.length * ITEM_HEIGHT + 'px';\n this._hideItems();\n this.changeFocus(null)\n }", "onScroll_() {\n const scrollTop = this.scrollTop;\n if (scrollTop > 0 && this.ins...
[ "0.61827755", "0.6083896", "0.6005804", "0.59467065", "0.59060645", "0.5851346", "0.57493025", "0.5744736", "0.57304657", "0.56875217", "0.5679275", "0.5617453", "0.5568289", "0.55670774", "0.55633044", "0.55514693", "0.5548961", "0.55476177", "0.5539459", "0.55282134", "0.55...
0.0
-1
enqueues a new value at the end of the queue
enqueue(value) { const lastIndex = this._length + this._headIndex; this._storage[lastIndex] = value; this._length++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "enqueue(val) {\n this._queue.push(val);\n }", "enqueue(value) {\n if (!this.queueIsFull()) {\n this.queue.push(value)\n }\n }", "enQueue(value) {\n this._dataStore.push(value);\n this._length++;\n }", "enqueue(value) {\r\n return this.data.addToBack(value);\r\n }", "enqueue...
[ "0.8306082", "0.82394886", "0.785545", "0.78353226", "0.780036", "0.7773354", "0.76745576", "0.76106006", "0.7516432", "0.75021976", "0.7462355", "0.7443069", "0.7441978", "0.7441809", "0.741165", "0.7354497", "0.7302385", "0.7302385", "0.7257569", "0.7232349", "0.72298944", ...
0.80286324
2
dequeues the value from the beginning of the queue and returns it
dequeue() { const firstValue = this._storage[this._headIndex]; delete this._storage[this._headIndex]; this._length--; this._headIndex++; return firstValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dequeue(){\n return queue.shift();\n }", "dequeue() {\n try {\n if(this.isEmpty) return null\n\n const firstValue = this._storage[this._head]\n delete this._storage[this._head]\n this._head++\n this._length--\n return firstValue\n } catch(err) {\n throw new E...
[ "0.8206041", "0.8094191", "0.80746645", "0.8055837", "0.80022115", "0.7993854", "0.797259", "0.79612017", "0.79229575", "0.7908534", "0.79070646", "0.7903664", "0.78886545", "0.78661275", "0.7855471", "0.7844776", "0.7840722", "0.78196096", "0.78067094", "0.77841955", "0.7772...
0.792789
8
returns the value at the beginning of the queue without removing it from the queue
peek() { return this._storage[this._headIndex]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function peek(){\n return queue[0];\n }", "function dequeue(){\n return queue.shift();\n }", "peek(){\n return queue[queue.length -1]\n }", "peek() {\n if(this.queue.length) return this.queue[0]; \n else return null; \n }", "peek() {\n return this.queue[0]\n}", "peek (...
[ "0.8130133", "0.7743013", "0.77359235", "0.7701163", "0.7637453", "0.7606839", "0.7557013", "0.75062275", "0.75062275", "0.74636436", "0.74636436", "0.7462822", "0.7422986", "0.74203724", "0.7416103", "0.74112743", "0.7403634", "0.73791283", "0.73768806", "0.73679686", "0.735...
0.6777053
84
value:2 for default vallue:1 for waiting value:0 for printed
function getFile(file) { fakeAjax(file,function(text){ // what do we do here? if(text=="The first text"){ console.log("The first text"); status[text]=0; if(status["The middle text"]==1){ console.log("The middle text"); status["The middle text"]=0; if(status["The last text"]==1){ console.log("The last text"); status["The last text"]=0; } } } else if(text=="The middle text"){ if(status["The first text"]==2){ status["The middle text"]=1; } else{ console.log("The middle text"); status["The middle text"]=0; if(status["The last text"]==1){ console.log("The last text"); status["The last text"]==0; } } } else{ if(status["The middle text"]==0){ console.log(text); status["The last text"]=0; } else { status["The last text"]=1; } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printVal(value) {\n console.log(value);\n // return 1; // error\n}", "static get PAUSE() { return 4; }", "function print(value){ // => the word value here is a parameter/placeholder/passenger\r\n console.log(value);\r\n }", "function next() {\n setValue(()=>{\n r...
[ "0.5916579", "0.58305335", "0.58298475", "0.58161443", "0.5808925", "0.56767595", "0.56534946", "0.5634155", "0.56337607", "0.56108195", "0.55911165", "0.55774146", "0.5572823", "0.5553151", "0.5546801", "0.5533161", "0.5516638", "0.55052686", "0.54891646", "0.5472748", "0.54...
0.0
-1
highlight the given sequence
function hSeq(seq) { /** unhighlight all others */ for (var i=0; i<sequences.length; i++) hmatch(sequences[i], false); /** highlight selected sequence */ hmatch(sequences[seq], true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "highlight(on) { }", "function highlight() {\n if (window.getSelection) {\n var selection = window.getSelection();\n if (selection.rangeCount) {\n var range = selection.getRangeAt(0).cloneRange();\n var highlightNode = document.createElement(\"span\");\n highlight...
[ "0.70990103", "0.66774166", "0.66539", "0.657652", "0.6483792", "0.64282423", "0.64135957", "0.63620836", "0.635916", "0.63515896", "0.6324142", "0.63159174", "0.63112307", "0.6219677", "0.61696327", "0.61276925", "0.61201197", "0.6114018", "0.6084117", "0.6083986", "0.608185...
0.74495226
1
highlight all occurrences of the given cipher letters
function highlightLetters(letters) { unhighlightAll(); for (var row=0; row<cipher[which].length; row++) { for (var col=0; col<cipher[which][row].length; col++) { id = row + "_" + col; letter = cipher[which][row].substring(col,col+1); for (var i=0; i<letters.length; i++) { if (letter == letters.substring(i,i+1)) { h(id); break; } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightLetters() {\n textContentSplit = log.textContent.split('')\n for (var i = 0; i < randomWordSplit.length; i++) {\n if (randomWordSplit[i] === textContentSplit[i]) {\n document.getElementById(i).setAttribute('class', 'text-color');\n }\n if (randomWordSplit[i] !== textContentSplit[i...
[ "0.69809395", "0.65275204", "0.6464697", "0.64588654", "0.6416339", "0.6395215", "0.63820565", "0.63819623", "0.6255993", "0.620108", "0.6179255", "0.6098701", "0.60863984", "0.6066258", "0.5990375", "0.59819627", "0.5973279", "0.59144324", "0.58898747", "0.58893126", "0.5886...
0.8016309
1
clear all letter highlighting
function unhighlightAll() { for (var row=0; row<cipher[which].length; row++) { for (var col=0; col<cipher[which][row].length; col++) { u(row+"_"+col); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearAll() {\n if (activeHighlight && activeHighlight.applied) {\n activeHighlight.cleanup();\n }\n activeHighlight = null;\n }", "clearHighlight() {\n\n //TODO - your code goes here -\n }", "function clearAllHighlighted() {\n var canvas = document.getEl...
[ "0.74931645", "0.73942155", "0.7329344", "0.7296067", "0.7280655", "0.7263434", "0.71119285", "0.71032435", "0.7080586", "0.69316155", "0.69220114", "0.69005716", "0.68827707", "0.68760043", "0.68590003", "0.6858664", "0.68261915", "0.68254304", "0.6809151", "0.6797355", "0.6...
0.766301
1
for each letter, map it to list of positions of all its appearances in the cipher.
function makeIndex() { // var s = ""; var index = {}; for (var row=0; row<cipher[which].length; row++) { for (var col=0; col<cipher[which][row].length; col++) { var key = cipher[which][row].charAt(col); // s += "("+row+","+col+","+key+") "; if (index[key]) { index[key][index[key].length] = [row, col]; } else { index[key] = [[row, col]]; } } } // alert(s); return index; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function letterInWord(letter) {\n // the array that will contain the char positions in the currentWord that has the\n var positions = new Array();\n for (i = 0 ; i < currentWord.length; i++) {\n if (currentWord[i] === letter)\n positions.push(i);\n }\n r...
[ "0.6755013", "0.66422486", "0.6616428", "0.6574098", "0.65410936", "0.65210015", "0.64767396", "0.6461616", "0.6398678", "0.6392144", "0.6272142", "0.6270464", "0.6260817", "0.62469214", "0.622445", "0.61895114", "0.61468196", "0.6142121", "0.6118236", "0.6077209", "0.6074336...
0.0
-1
find all repeated sequences
function repeatsfind() {repeats(cipher[which])}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function repeats(arr){\n var arrRepeted = arr.filter ((v,i,a) => a.indexOf(v) < i);\n return arr.filter(el => !(arrRepeted).includes(el)).reduce((a, b) => a + b);\n}", "function isThereRepeted () {\n var repeatedNumbers = []; //Array para ir guardando los repetidos.\n\n for (let i = 0, j, isOnARRAY; i < ARR...
[ "0.66973406", "0.6563953", "0.6534063", "0.6279213", "0.6227788", "0.61428845", "0.6120168", "0.6046153", "0.60188544", "0.5967285", "0.5966341", "0.59513086", "0.59499645", "0.594715", "0.5937324", "0.59275925", "0.5912165", "0.5903671", "0.58881706", "0.5887738", "0.5869731...
0.5833896
25
find all repeated sequences for strings starting at [row, col]
function repeatsFor(index, row, col) { var r = new Array(); var directions = new Array( new Array(0, 1), // right new Array(1, 1), // right-down new Array(1, 0), // down new Array(1, -1), // left-down new Array(0, -1), // left new Array(-1, -1), // left-up new Array(-1, 0), // up new Array(-1, 1) // right-up ); /* inspect each direction */ var key = get(row, col); var candidates = index[key]; if (candidates) { for (var c=0; c<candidates.length; c++) { for (var i=0; i<directions.length; i++) { for (var j=0; j<directions.length; j++) { var result = new Array(); result[0] = ""; result[1] = new Array(); result[2] = new Array(); if (row == candidates[c][0] && col == candidates[c][1] && i==j ) { ; // do nothing, because we don't want to match the sequence at (row,col) with itself. } else { matches(result, row, col, directions[i][0], directions[i][1], candidates[c][0], candidates[c][1], directions[j][0], directions[j][1]); r[r.length] = new Array(result[0], result[1], result[2], i, j); } } } } } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function repeatedSubstringPatterm(string) {\n let subStr = '';\n\n for (let i = 1; i < string.length; i += 1) {\n subStr = string.slice(0, i);\n let substrings = [];\n [...string].reduce((str, char) => {\n if (str !== subStr) {\n str += char;\n } else {\n substrings.push(str)\n ...
[ "0.64090353", "0.6310678", "0.6158158", "0.6131276", "0.6004883", "0.5901247", "0.58641255", "0.5836641", "0.5804886", "0.5804886", "0.5772457", "0.57702786", "0.5694318", "0.5652316", "0.56475806", "0.5642972", "0.5632896", "0.56316215", "0.5631294", "0.5619154", "0.5592194"...
0.68606716
1
look for string match for sequences beginning at [r0,c0] and [r1,c1]. direction of sequences is determined by (dr0, dc0) and (dr1, dc1). "result" is an array that tracks the maximum matched sequence and occurrence positions.
function matches(result, r0, c0, dr0, dc0, r1, c1, dr1, dc1) { var ch1 = get(r0, c0); var ch2 = get(r1, c1); // alert("r0 " + r0 + " c0 " + c0 + " dr0 " + dr0 + " dc0 " + dc0 + " r1 " + r1 + " c1 " + c1 + " dr1 " + dr1 + " dc1 "+ dc1 + " ch1 " + ch1 + " ch2 " + ch2); if (ch1 == ch2) { result[0] += ch1; result[1][result[1].length] = new Array(getR(r0), getC(c0)); result[2][result[2].length] = new Array(getR(r1), getC(c1)); matches(result, (r0+dr0), (c0+dc0), dr0, dc0, (r1+dr1), (c1+dc1), dr1, dc1); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "findNextMatchSync(string, startPosition) {\r\n if (startPosition == null) {\r\n startPosition = 0;\r\n }\r\n startPosition = this.convertToNumber(startPosition);\r\n let onigNativeInfo = cache.get(this);\r\n let status = 0;\r\n if (!onigNativeInfo) {\r\n ...
[ "0.64182967", "0.62951267", "0.62951267", "0.6201219", "0.59356546", "0.5885474", "0.58198744", "0.57690024", "0.57289577", "0.5691932", "0.56858134", "0.56737226", "0.5673231", "0.5602287", "0.5567311", "0.5566176", "0.5563941", "0.5563941", "0.5497012", "0.5438994", "0.5428...
0.669368
1
get image corresponding to given string of cipher letters
function getImg(s) { var result = ""; for (var i=0; i<s.length; i++) { result += "<img src=\"alphabet/" + getName(s.substring(i,i+1)) + ".jpg\">"; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetImage(letter) {\n if (letter == \"A\") {\n return IMAGES.A;\n } else if (letter == \"B\") {\n return IMAGES.B;\n } else if (letter == \"C\") {\n return IMAGES.C;\n } else if (letter == \"D\") {\n return IMAGES.D;\n } else if (letter == \"E\") {\n return IMAGES.E;\n } else if (lette...
[ "0.70061934", "0.6534171", "0.59344065", "0.5890802", "0.5837095", "0.5800241", "0.577855", "0.5760525", "0.57462704", "0.5721525", "0.56979626", "0.56428576", "0.55858254", "0.5577009", "0.5566507", "0.5536229", "0.5528588", "0.54420495", "0.5419105", "0.5412684", "0.5379764...
0.7113889
0
get cipher character at position (r, c). translate out of bounds values to within bounds values.
function get(r, c) { r=getR(r); c=getC(c); return cipher[which][r].substring(c,c+1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCharFromPosition(pos) {\n var index = pos.row * 5;\n index = index + pos.col;\n return cipher.key.charAt(index);\n}", "function getCharPosition(c) {\n var index = cipher.key.indexOf(c);\n var row = Math.floor(index / 5);\n var col = index % 5;\n return {\n row: row,\n col: col,\n };\n}"...
[ "0.7024991", "0.7024688", "0.6790267", "0.6457656", "0.62811", "0.61889803", "0.61611974", "0.61095667", "0.6102148", "0.60968727", "0.5966746", "0.5907109", "0.59026957", "0.5901869", "0.5901869", "0.5901869", "0.5901869", "0.5895901", "0.5885721", "0.58631426", "0.5852097",...
0.740268
1
highlight/unhighlight the given matches
function hmatch(matches, highlight) { for (var j=1; j<3; j++) { for (var i=0; i<matches[j].length; i++) { var id = getR(matches[j][i][0])+"_"+getC(matches[j][i][1]); // alert(id); if (highlight) h2(id); else u(id); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set highlightMatches(v) {\n this._highlights = v;\n }", "highlightMatches(text, query) {\n const regex = this.toRegex(query);\n if (regex instanceof RegExp) {\n return text.replace(regex, match => `<b>${match}</b>`);\n }\n return text;\n }", "function highlightMatc...
[ "0.74854064", "0.7059232", "0.69366884", "0.6896546", "0.6806591", "0.67445165", "0.6729877", "0.6652738", "0.6623489", "0.65778184", "0.6573902", "0.6482448", "0.64426565", "0.63798726", "0.63251483", "0.625088", "0.6231483", "0.6223302", "0.6188613", "0.6187376", "0.6173059...
0.6758682
6
generate list of all homophones for each unique plaintext letter in the 408 solution
function homophonesFor408() { var d = interestingHash[1][0]["decoder"]; var u = {}; for (i=0;i<alphabet[1].length; i++) { var symbol = alphabet[1][i]; var plaintext = d[i]; if (u[plaintext]) u[plaintext].push(symbol); else u[plaintext] = [symbol]; } return u; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get uniqueLettersInPhrase() {\n let uniqueLetters = \"\";\n\n for (let letter of this.phrase) {\n if (uniqueLetters.indexOf(this.phrase) === -1 && letter !== ' ') {\n uniqueLetters += letter;\n }\n }\n\n return uniqueLetters;\n }", "getLettersTo...
[ "0.61886054", "0.6108243", "0.56711155", "0.5660597", "0.56365174", "0.5630204", "0.56205755", "0.5566037", "0.5561889", "0.55251133", "0.55091715", "0.55090034", "0.5504746", "0.5432786", "0.5431474", "0.5431005", "0.5402302", "0.5346259", "0.5323693", "0.52928305", "0.52874...
0.6928506
1
if we're leaving a node that created a new scope, update the scopeChain so that the current scope is always represented by the last item in the scopeChain array.
function leave(node) { if (createsNewScope(node)) { let currentScope = scopeChain.pop(); printScope(currentScope, node); programScopes.push(currentScope); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "exitScope() {\n // Free up all the identifiers used in the previous scope\n this.scopes.pop().free(this.context);\n this.scope = this.scopes[this.scopes.length - 1];\n }", "function popScopeId() {\r\n currentScopeId = null;\r\n}", "function popScopeId() {\r\n currentScopeId = null...
[ "0.6931558", "0.58581436", "0.58581436", "0.5771105", "0.5771105", "0.5771105", "0.5771105", "0.5771105", "0.5771105", "0.5771105", "0.5709378", "0.53929764", "0.5392312", "0.52479994", "0.5239648", "0.5136417", "0.5017755", "0.50041234", "0.49919394", "0.4937601", "0.4856698...
0.7695766
0
pretty printing for scope information
function printScope(scope, node) { const declaredVars = scope.slice(1); const varsDisplay = declaredVars.length === 0 ? "NONE" : declaredVars.join(", "); if (node.type === "Program") { spprint( "printScope", `Variables declared in the global scope: ${varsDisplay}` ); } else { if (node.id && node.id.name) { spprint( "printScope", `Variables declared in the function ${node.id.name}(): ${varsDisplay}` ); } else { spprint( "printScope", `Variables declared in anonymous function: ${varsDisplay}` ); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "dump() {\n\t\t\tconst lines = [];\n\n\t\t\tlines.push(\"# Scope \" + this.kind);\n\n\t\t\tif (this.globals.size > 0) {\n\t\t\t\tconst filteredGlobals = [];\n\t\t\t\tfor (const name of this.globals) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t___R$$priv$project$rome$$internal$compiler$scope$Scope_ts$globalGlobals.includes(\n\t\...
[ "0.7366412", "0.6223988", "0.5859145", "0.5858953", "0.5725868", "0.5722273", "0.5664104", "0.5657852", "0.5618329", "0.557921", "0.55308086", "0.55182993", "0.5517898", "0.5510549", "0.5502653", "0.54921526", "0.5486849", "0.545588", "0.5449265", "0.5442129", "0.54404306", ...
0.67236197
1
the name of a variable is located in different spots depending on the AST node type. This helper function accesses the name of a variable depending on the node type.
function getVarName(node) { let varName = null; switch (node.type) { case "AssignmentExpression": varName = node.left.name; break; case "VariableDeclarator": varName = node.id.name; break; case "ExpressionStatement": if (node.expression.left.type === "MemberExpression") { if (typeof node.expression.left.name === "string") { varName = node.expression.left.name; } else { varName = node.expression.left.object.name; } break; } else { varName = node.expression.left.name; break; } default: varName = `"DIDN'T CATCH CASE for type ${node.type}"`; } return varName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "determineName() {\r\n\t\t\t\t\tvar message, name, node, ref1, tail;\r\n\t\t\t\t\tif (!this.variable) {\r\n\t\t\t\t\t\treturn null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tref1 = this.variable.properties, [tail] = slice1.call(ref1, -1);\r\n\t\t\t\t\tnode = tail ? tail instanceof Access && tail.name : this.variable.base;\r\n\t\...
[ "0.65794396", "0.64713496", "0.6439784", "0.6422053", "0.6367675", "0.62648726", "0.6194098", "0.61603886", "0.6144756", "0.6092254", "0.6073717", "0.60338247", "0.5874464", "0.5859156", "0.5829449", "0.58287036", "0.5822598", "0.5789694", "0.5788306", "0.57396126", "0.572789...
0.7319142
0
add function inputs to the state manager object. The changing values of inputs needs to be tracked as well as the changing values of variables!
function addInputsToStateManager(node, fxnName) { const params = isAnonymizedFunction(node) ? node.init.params : node.params; for (let param of params) { stateManager[`${fxnName}:${param.name}`] = null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addInput(){\r\n //Here we need to change all the weights which use the input values.\r\n this.Wf = Matrix.addInput(this.Wf);\r\n this.Wi = Matrix.addInput(this.Wi);\r\n this.Wo = Matrix.addInput(this.Wo);\r\n this.Wg = Matrix.addInput(this.Wg);\r\n this.netconfig[0]++;\r\n }", "updateInputs (i...
[ "0.63359284", "0.6324789", "0.61727697", "0.61650825", "0.61217165", "0.60111904", "0.58992976", "0.5634187", "0.56264096", "0.5595174", "0.55694485", "0.5562798", "0.55593246", "0.5555937", "0.5554165", "0.5543934", "0.5524958", "0.5524958", "0.5524958", "0.5524958", "0.5524...
0.686743
0
below are functions that could be used as API return two neighbors's local information (object), different types of routes (arrays)
function getPair(NeighborName1, NeighborName2) { if (NeighborName2 < NeighborName1) { var temp = NeighborName1; NeighborName1 = NeighborName2; NeighborName2 = temp; } var N1 = getNeighborInfo(NeighborName1); var N2 = getNeighborInfo(NeighborName2); var pairRoutes = getPairRoutes(NeighborName1, NeighborName2); var result = {}; result[NeighborName1] = N1; result[NeighborName2] = N2; result["Routes"] = pairRoutes; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRouteInformaton(){\n if(markers.length==2){\n var route = {\n 'start_location':{\n 'latitude': markers[0].position.lat(),\n 'longitude': markers[0].position.lng()\n },\n 'end_location':{\n 'latitude': markers[1].pos...
[ "0.6435899", "0.63308686", "0.61995417", "0.61898124", "0.6103493", "0.60339445", "0.59863466", "0.5973437", "0.5973437", "0.59344316", "0.58836067", "0.58820087", "0.58784443", "0.5858686", "0.58528525", "0.58197165", "0.5819709", "0.57978207", "0.579557", "0.5728887", "0.57...
0.64997625
0
return related neighbors to one particular neighbor
function getRelatedNeighbors(NeighborName) { var result = relatedPairs[NeighborName]; if (result != null) { return result; } else{ window.alert("wrong name"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "neighbors (row, column) {\n let leftColumn = column - 1\n let rightColumn = column + 1\n let upRow = row - 1\n let downRow = row + 1\n \n // Wrap around edges\n if (leftColumn < 1) leftColumn = this.cols\n if (rightColumn > this.cols) rightColumn = 1\n if (upRow < 1) upRow = this.rows\n ...
[ "0.70360017", "0.69515157", "0.6904606", "0.6728604", "0.66022277", "0.658964", "0.65655285", "0.6554215", "0.6554215", "0.653251", "0.6527548", "0.6436163", "0.64205074", "0.63417596", "0.6336554", "0.63360125", "0.63254595", "0.6303912", "0.6288841", "0.62830627", "0.627548...
0.68856156
3
fetch data from game
function getData() { var url1 = 'http://localhost:8080/api/game_view/' + myParam fetch(url1) .then(response => response.json()) .then(response => { let slvGames = response console.log(response) main(slvGames) }) .catch(err => console.log(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getData(){\n pos.board = [];\n fetch(\"/api/games\").then(function(response){if(response.ok){return response.json()}\n}).then(function (json){\n jsongames = json;\n app.player = json.player\n createPos();\n createGames();\n bottons();\n \n });\n }", "async function getGame...
[ "0.75280356", "0.7517257", "0.73830163", "0.73606074", "0.7176202", "0.7150462", "0.7028436", "0.6899854", "0.6895091", "0.6875735", "0.68416965", "0.68074477", "0.67192066", "0.6700201", "0.6659182", "0.66576904", "0.6633427", "0.66072726", "0.6596919", "0.65950954", "0.6525...
0.71849775
4
create game history table
function histTable(slvGames){ var hitArr = [] var hitArrOpp = [] var arr = opponentInfo(slvGames) slvGames.gamePlayer.forEach(elem => { let user = document.getElementById("player") let opponent = document.getElementById("opponent") if(elem.gp_id == myParam){ user.innerHTML = elem.player.name + " " } else if(elem.gp_id != myParam){ opponent.innerHTML = elem.player.name } }) arr.forEach(el => { if(el.gp_id == myParam){ let x = document.getElementById("O" + el.ship) x.innerHTML = el.ship hitArrOpp.push(el.ship) } else if(el.gp_id != myParam){ let y = document.getElementById(el.ship) y.innerHTML = el.ship hitArr.push(el.ship) } }) // set hits on my ships var hitOnSub = 0; var hitOnPT = 0; var hitOnCar = 0; var hitOnDes = 0; var hitOnBat = 0; for(var i=0;i<hitArr.length;i++){ if(hitArr[i] === "Submarine"){ hitOnSub++; if(hitOnSub == 3){ let p = document.getElementById("sSub") p.innerHTML = "Submarine" p.style.color = "red" } } else if(hitArr[i] === "Patrol Boat"){ hitOnPT++; if(hitOnPT == 2){ let p = document.getElementById("sPat") p.innerHTML = "Patrol Boat" p.style.color = "red" } } else if(hitArr[i] === "Carrier"){ hitOnCar++; if(hitOnCar == 5){ let p = document.getElementById("sCar") p.innerHTML = "Carrier" p.style.color = "red" } } else if(hitArr[i] === "Battleship"){ hitOnBat++; if(hitOnBat == 4){ let p = document.getElementById("sBat") p.innerHTML = "Battleship" p.style.color = "red" } } else if(hitArr[i] === "Destroyer"){ hitOnDes++; if(hitOnDes == 3){ let p = document.getElementById("sDes") p.innerHTML = "Destroyer" p.style.color = "red" } } } // set hits on Opponent ships var hitOnOSub = 0; var hitOnOPT = 0; var hitOnOCar = 0; var hitOnODes = 0; var hitOnOBat = 0; for(var i=0;i<hitArrOpp.length;i++){ if(hitArrOpp[i] === "Submarine"){ hitOnOSub++; if(hitOnOSub == 3){ let p = document.getElementById("osSub") p.innerHTML = "Submarine" p.style.color = "red" } } else if(hitArrOpp[i] === "Patrol Boat"){ hitOnOPT++; if(hitOnOPT == 2){ let p = document.getElementById("osPat") p.innerHTML = "Patrol Boat" p.style.color = "red" } } else if(hitArrOpp[i] === "Carrier"){ hitOnOCar++; if(hitOnOCar == 3){ let p = document.getElementById("osCar") p.innerHTML = "Carrier" p.style.color = "red" } } else if(hitArrOpp[i] === "Battleship"){ hitOnOBat++; if(hitOnOBat == 3){ let p = document.getElementById("osBat") p.innerHTML = "Battleship" p.style.color = "red" } } else if(hitArrOpp[i] === "Destroyer"){ hitOnODes++; if(hitOnODes == 3){ let p = document.getElementById("osDes") p.innerHTML = "Destroyer" p.style.color = "red" } } } // set my ships display slvGames.ships.forEach(ship => { let Pt = document.getElementById("patrol boat-hit") let Cr = document.getElementById("carrier-hit") let Sb = document.getElementById("submarine-hit") let Dt = document.getElementById("destroyer-hit") let Bt = document.getElementById("battleship-hit") if(ship.type == "Carrier" && hitOnCar > 0){ document.getElementById("carrier-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "h" + el) div.setAttribute("class", "col-1") div.innerHTML = el Cr.appendChild(div) }) } else if(ship.type == "Battleship" && hitOnBat != 0){ document.getElementById("battleship-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "h" + el) div.setAttribute("class", "col-1") div.innerHTML = el Bt.appendChild(div) }) } else if(ship.type == "Submarine" && hitOnSub != 0){ document.getElementById("submarine-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "h" + el) div.setAttribute("class", "col-1") div.innerHTML = el Sb.appendChild(div) }) } else if(ship.type == "Patrol Boat" && hitOnPT != 0){ document.getElementById("patrol boat-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "h" + el) div.setAttribute("class", "col-1") div.innerHTML = el Pt.appendChild(div) }) } else if(ship.type == "Destroyer" && hitOnDes != 0){ document.getElementById("destroyer-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "h" + el) div.setAttribute("class", "col-1") div.innerHTML = el Dt.appendChild(div) }) } }) // set my Opponents ships display slvGames.ships.forEach(ship => { let Pt = document.getElementById("Opatrol boat-hit") let Cr = document.getElementById("Ocarrier-hit") let Sb = document.getElementById("Osubmarine-hit") let Dt = document.getElementById("Odestroyer-hit") let Bt = document.getElementById("Obattleship-hit") if(ship.type == "Carrier" && hitOnOCar > 0){ document.getElementById("Ocarrier-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "ocar" + ship.ships_locations.indexOf(el)) div.setAttribute("class", "col-1") div.innerHTML = el Cr.appendChild(div) }) } else if(ship.type == "Battleship" && hitOnOBat != 0){ document.getElementById("Obattleship-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "obat" + ship.ships_locations.indexOf(el)) div.setAttribute("class", "col-1") div.innerHTML = el Bt.appendChild(div) }) } else if(ship.type == "Submarine" && hitOnOSub != 0){ document.getElementById("Osubmarine-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "osub" + ship.ships_locations.indexOf(el)) div.setAttribute("class", "col-1") div.innerHTML = el Sb.appendChild(div) }) } else if(ship.type == "Patrol Boat" && hitOnOPT != 0){ document.getElementById("Opatrol boat-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "opat" + ship.ships_locations.indexOf(el)) div.setAttribute("class", "col-1") div.innerHTML = el Pt.appendChild(div) }) } else if(ship.type == "Destroyer" && hitOnODes != 0){ document.getElementById("Odestroyer-hit").style.marginBottom = '10px' ship.ships_locations.forEach(el => { let div = document.createElement("div") div.setAttribute("id", "odes" + ship.ships_locations.indexOf(el)) div.setAttribute("class", "col-1") div.innerHTML = el Dt.appendChild(div) }) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "create_search_history_table(){\n\t\tvar create_search_history_cols = \"(id integer PRIMARY KEY AUTOINCREMENT, project_id integer, keyword varchar, file_name varchar, file_line integer, file_pos integer, user_id integer, created_at datetime, updated_at datetime)\";\n\t\tvar create_search_history_query = \"CREATE T...
[ "0.7091575", "0.63410753", "0.62974286", "0.6253997", "0.6252541", "0.61758024", "0.6136654", "0.6086194", "0.60353076", "0.59864724", "0.5917377", "0.5894084", "0.5888483", "0.5887401", "0.5881616", "0.57965356", "0.57762706", "0.57762706", "0.57762706", "0.5772077", "0.5718...
0.0
-1
Biggie Size Given an array, write a function that changes all positive numbers in the array to the string "big". Example: makeItBig([1,3,5,5]) returns that same array, changed to [1, "big", "big", 5].
function makeItBig(arr) { for(var i = 0; i < arr.length; i++) { arr[i] > 0 ? arr[i] = "big" : false; } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeitbig(arr){\n for (var i=0;i<arr.length;i++){\n if(arr[i]>0){\n arr[i]=\"big\";\n }\n }\n return arr;\n}", "function Bigglesize(arr){\n for(var i=0; i<arr.length;i++){\n if(arr[i]>0){\n arr[i]='big';\n }\n }\n return arr;\n}", ...
[ "0.80811465", "0.7931772", "0.7855325", "0.76918864", "0.767223", "0.7634122", "0.66327494", "0.66052264", "0.63399214", "0.5935498", "0.5913743", "0.59018666", "0.58811533", "0.58640766", "0.5807524", "0.5788728", "0.5755813", "0.56282896", "0.562583", "0.5596072", "0.558147...
0.77790546
3
console.log(makeItBig([1,3,5,5])); Challenge 2 Print Low, Return High Create a function that takes in an array of numbers. The function should print the lowest value in the array, and return the highest value in the array.
function printLowReturnHigh(arr) { var lowest = arr[0]; var hightest = arr[0]; for(var i = 0; i < arr.length; i++) { if(lowest > arr[i]) { lowest = arr[i]; } if(hightest < arr[i]) { hightest = arr[i]; } } console.log(lowest); return hightest; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PrintLowReturnhigh(arr) {\n\tvar min=arr[0], max=arr[0];\n\tfor (var i = 0; i <arr.length; i++) {\n\t\tif (arr[i]>max) {\n\t\t\tmax=arr[i];\n\t\t} \n\t\tif (arr[i]<min) {\n\t\t\tmin=arr[i];\n\t\t}\n\t}\n\tconsole.log(min);\n\treturn max;\n}", "function printLowReturnHigh(arr){\n var low = arr[0];\n ...
[ "0.7929877", "0.7896344", "0.78954214", "0.7884449", "0.7831158", "0.778653", "0.7725738", "0.76373726", "0.76096904", "0.75935966", "0.75906533", "0.75496036", "0.7508173", "0.74610686", "0.7426895", "0.74267435", "0.7412209", "0.7400254", "0.729726", "0.7286153", "0.7244772...
0.7958875
0
console.log(printLowReturnHigh([2,4,5,3,7,9])); Challenge 3. Print One, Return Another Build a function that takes in an array of numbers. The function should print the secondtolast value in the array, and return the first odd value in the array.
function printOneReturnAnother(arr) { console.log(arr[arr.length - 2]) for(var i = 0; i < arr.length; i++) { if(arr[i] % 2 !== 0) { return arr[i]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function print1ReturnAnother(arr){\n console.log(\"Second to last value: \" + arr[arr.length - 2]);\n for(var i = 0; i < arr.length; i++){\n if(arr[i] % 2 != 0){\n return arr[i]\n }\n }\n return \"No odd numbers in array\"\n}", "function print2ndLast_return1stOdd(arr){\n c...
[ "0.7642936", "0.7624414", "0.7436052", "0.7420006", "0.74071157", "0.7366025", "0.7361987", "0.730998", "0.7307953", "0.727087", "0.7248014", "0.7241695", "0.72221017", "0.7147316", "0.7132317", "0.70374286", "0.7017233", "0.6997892", "0.69757503", "0.69545424", "0.692844", ...
0.733342
7
console.log(printOneReturnAnother([2,4,1,5,3])); Challenge 4. Double Vision Given an array (similar to saying 'takes in an array'), create a function that returns a new array where each value in the original array has been doubled. Calling double([1,2,3]) should return [2,4,6] without changing the original array.
function doubleVal(arr) { var newArr = []; for(var i = 0; i < arr.length; i++) { newArr[i] = arr[i] * 2; } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doubleVision(array){\n let newArr = [];\n for(let i = 0; i < array.length; i++){\n newArr.push(array[i] * 2);\n }\n array = newArr;\n return array;\n}", "function doubleVision(arr) {\n var double = [];\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i] * 2;\n ...
[ "0.77172464", "0.7579092", "0.7492879", "0.7491129", "0.7439699", "0.7303694", "0.7303283", "0.7300281", "0.7295633", "0.72907454", "0.727625", "0.72680783", "0.72368765", "0.72162324", "0.7143058", "0.7113988", "0.70902026", "0.70765805", "0.6991664", "0.69311833", "0.691632...
0.65322644
37
console.log(doubleVal([1,2,3])); Challenge 5 Count Positives Given an array of numbers, create a function to replace the last value with the number of positive values found in the array. Example, countPositives([1,1,1,1]) changes the original array to [1,1,1,3] and returns it.
function countPositives(arr) { var count = 0; for(var i = 0; i < arr.length; i++) { arr[i] > 0 ? count++ : false; } arr[arr.length - 1] = count; return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countPositives(array){\n let positiveCount = 0;\n for(var i = 0; i < array.length; i++){\n if(array[i] > 0){\n positiveCount++;\n }\n array[array.length - 1] = positiveCount;\n }\n return array;\n}", "function countPositives(array){\n let counter = 0;\n for(let i = 0; i < array.l...
[ "0.74466234", "0.74009466", "0.73136145", "0.72132874", "0.721074", "0.7201334", "0.7177056", "0.7167274", "0.7138698", "0.7105847", "0.70584285", "0.70579547", "0.69307995", "0.6858204", "0.67553943", "0.663731", "0.6604273", "0.6490382", "0.641734", "0.63671535", "0.6366650...
0.6948823
12
console.log(countPositives([1,1,1,1])); Challenge 6 Evens and Odds Create a function that accepts an array. Every time that array has three odd values in a row, print "That's odd!". Every time the array has three evens in a row, print "Even more so!".
function evensOdds(arr) { var evenCount = 0; var oddCount = 0; for(var i = 0; i < arr.length; i ++) { if(arr[i] % 2 === 0) { evenCount++; oddCount = 0; evenCount >= 3 ? console.log("Even more so!") : false; } if(arr[i] % 2 !== 0) { oddCount++; evenCount = 0; oddCount >= 3 ? console.log("That's odd!") : false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function oddsAndEvens(array){\n let odds = 0;\n let evens = 0;\n for (let i = 0; i < array.length; i++){\n if(array[i] %!2 == 0){\n odds ++;\n evens = 0;\n if(odds > 2){\n console.log(\"That's odd!\");\n }\n } else {\n eve...
[ "0.7476276", "0.7471004", "0.743693", "0.7427957", "0.73168045", "0.72451955", "0.7240907", "0.7191294", "0.71418107", "0.71052617", "0.70968753", "0.70245314", "0.69521034", "0.69327223", "0.6863222", "0.6854219", "0.68385756", "0.6825421", "0.6818481", "0.67447007", "0.6707...
0.7266939
5
evensOdds([2,1,3,5,4,6,4]); Challenge 7 Increment the Seconds Given an array of numbers arr, add 1 to every other element, specifically those whose index is odd (arr[1], arr[3], arr[5], etc). Afterward, console.log each array value and return arr.
function incrementTheSeconds(arr) { for(var i = 1; i < arr.length; i +=2) { arr[i] = arr[i] + 1; } for(var j = 0; j < arr.length; j++) { console.log(arr[j]); } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function incrementOdds(arr){\n for(var i=0;i<arr.length;i++){\n if(i%2!==0){\n arr[i]=(arr[i])+1;\n console.log(arr[i]);\n }\n }\n return arr;\n}", "function incrementOdds(arr){\n for(let i = 1; i<arr.length; i+=2){\n arr[i] = arr[i]+1\n }\n return arr\n}", "fun...
[ "0.84182847", "0.83399564", "0.80222166", "0.79890007", "0.78708595", "0.7870181", "0.78565407", "0.782215", "0.7808198", "0.7667304", "0.76460713", "0.7604281", "0.7527105", "0.74929553", "0.74545234", "0.74070275", "0.74004036", "0.7364648", "0.73496246", "0.7333455", "0.73...
0.7381368
17
console.log(incrementTheSeconds([2,4,2,5,4,3])); Challenge 8 Previous Lengths You are passed an array (similar to saying 'takes in an array' or 'given an array') containing strings. Working within that same array, replace each string with a number the length of the string at the previous array index and return the array. For example, previousLengths(["hello", "dojo", "awesome"]) should return ["hello", 5, 4]. Hint: Can for loops only go forward?
function previousLengths(arr) { for(var i = arr.length - 1; i > 0; i--) { arr[i] = arr[i - 1].length; } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousLengths(arr){\n for(let i = arr.length - 1; i > 0; i--){\n arr[i] = arr[i - 1].length // Loop 1 - arr[2] = arr[1]\n }\n return arr\n }", "function previousLengths(array) {\n for (var i = array.length - 1; i >= 0; i--) {\n console.log(\"array[\" + i + ...
[ "0.70563996", "0.6950846", "0.69185436", "0.68652797", "0.68445075", "0.6233782", "0.6169983", "0.6168231", "0.6058266", "0.60278684", "0.5944811", "0.58830535", "0.5882414", "0.5815312", "0.5780303", "0.5755633", "0.5639378", "0.56136996", "0.56085646", "0.56011456", "0.5558...
0.6862273
4
console.log(previousLengths(["hello", "dojo", "awesome","what"])); Challenge 9 Add Seven to Most Build a function that accepts an array. Return a new array with all the values of the original, but add 7 to each. Do not alter the original array. Example, addSeven([1,2,3]) should return [8,9,10] in a new array.
function addSeven(arr) { var newArr = []; for(var i = 0; i < arr.length; i++) { newArr[i] = arr[i] + 7; } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function previousLengths(arr){\n for(var i=0;i<arr.length-1;i++){\n arr[i+1]=arr[i].length;\n }\n return arr;\n\n}", "function previousLengths(arr){\n for(i=arr.length-1; i>0; i--){\n arr[i] = arr[i-1].length;\n }\n return arr;\n}", "function previousLengths(arr) {\n for(var i = a...
[ "0.72804934", "0.7237461", "0.71827894", "0.70686823", "0.6862755", "0.6730513", "0.6687041", "0.6636175", "0.66083074", "0.6567686", "0.6561311", "0.6548345", "0.63130236", "0.62699515", "0.61957395", "0.615735", "0.61298513", "0.60966927", "0.60307616", "0.6024432", "0.5985...
0.62820715
13
console.log(addSeven([1,2,3])); Challenge 10 Reverse Array Given an array, write a function that reverses its values, inplace. Example: reverse([3,1,6,4,2]) returns the same array, but now contains values reversed like so... [2,4,6,1,3]. Do this without creating an empty temporary array. (Hint: you'll need to swap values).
function reverse(arr) { for(var i = 0; i < arr.length/2; i++) { var temp = arr[i]; arr[i] = arr[arr.length - 1 - i]; arr[arr.length - 1 - i] = temp; } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverse(arr){\n //code\n}", "function reverseInPlace(array) {\n let len = array.length;\n for (let i = len - 1; i >= 0; i -= 1) {\n array.push(array[i]);\n }\n while (len > 0) {\n array.shift();\n len -= 1;\n }\n return array;\n}", "function reverseArrayInPlace (arr) {\n\tvar initLen...
[ "0.71709675", "0.6948195", "0.6929113", "0.692301", "0.6883915", "0.6878862", "0.6856885", "0.684621", "0.6778876", "0.677617", "0.675403", "0.67477715", "0.67211366", "0.6718343", "0.671831", "0.6702483", "0.66729164", "0.66414195", "0.6617382", "0.66086364", "0.65959436", ...
0.6361204
59
console.log(reverse([3,1,6,4,2])); Challenge 11 Outlook: Negative Given an array, create and return a new one containing all the values of the original array, but make them all negative (not simply multiplied by 1). Given [1,3,5], return [1,3,5].
function negative(arr) { var newArr = []; for(var i = 0; i < arr.length; i++) { if(arr[i] > 0) { newArr[i] = arr[i] - arr[i] * 2; }else{ newArr[i] = arr[i]; } } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reverseMinus(array){\n\n}", "function invert(array) {\n var newArr = [];\n for(var i = 0; i < array.length; i++){\n newArr.push(-array[i]);\n }\n return newArr;\n }", "function invert(array) {\n\t//return array.map((element) => (element === 0 ? element : -element));\n\treturn array....
[ "0.78636616", "0.7821786", "0.7661021", "0.76451856", "0.7635298", "0.75784993", "0.7437917", "0.7426829", "0.74070793", "0.7403391", "0.7395724", "0.7367335", "0.73426056", "0.7337558", "0.7262756", "0.7257129", "0.7243493", "0.72382474", "0.7237839", "0.72297835", "0.721216...
0.7371627
11
console.log(negative([1,3,5])); Challenge 12 Always Hungry Create a function that accepts an array, and prints "yummy" each time one of the values is equal to "food". If no array values are "food", then print "I'm hungry" once.
function alwaysHungry(arr) { var food = false; for(var i = 0; i < arr.length; i++) { if(arr[i] === "food") { console.log("yummy"); food = true; } } if(food === false){ console.log("I'm hungry") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function alwaysHungry(arr){\r\n for(var i=0; i<arr.length; i++){\r\n if(arr[i] == \"food\"){\r\n console.log(\"yummy\");\r\n } else if(arr[i] !== \"food\"){\r\n console.log(\"hungry\")\r\n }\r\n }\r\n }", "function hungry(arr){\n v...
[ "0.7211276", "0.7023037", "0.695569", "0.6935531", "0.6932139", "0.69065213", "0.687068", "0.68292034", "0.67541516", "0.67254597", "0.66782475", "0.6672089", "0.6620615", "0.64404887", "0.6432771", "0.63878524", "0.6201085", "0.6180165", "0.6153753", "0.61414564", "0.6114075...
0.67625886
8
alwaysHungry(['food',"cake",'wine','apple']); Challenge 13 Swap Toward the Center Given an array, swap the first and last values, third and thirdtolast values, etc. Example: swapTowardCenter([true,42,"Ada",2,"pizza"]) turns the array into ["pizza", 42, "Ada", 2, true]. swapTowardCenter([1,2,3,4,5,6]) turns the array into [6,2,4,3,5,1]. No need to return the array this time.
function swapTowardCenter(arr){ for(var i = 0; i < arr.length/2; i+=2) { var temp = arr[i]; arr[i] = arr[arr.length - 1 - i]; arr[arr.length - 1 - i] = temp; } console.log(arr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function swapTowardCenter(arr){\n for (let i = 0; i < arr.length/2; i++) {\n var temporaryVarForSwitchingIndex = arr[i]\n arr[i] = arr[arr.length - 1-i] \n arr[arr.length - 1-i] = temporaryVarForSwitchingIndex \n \n }\n return arr \n}", "function swapTowardCenter(arr){\n v...
[ "0.70972925", "0.70154864", "0.6949087", "0.69107425", "0.6877324", "0.67917246", "0.67323375", "0.6472604", "0.6374284", "0.591377", "0.58495134", "0.5780375", "0.5715417", "0.5709263", "0.56621486", "0.56514484", "0.5635146", "0.56259626", "0.5623789", "0.561269", "0.559237...
0.67549497
6
swapTowardCenter([true,42,"Ada",2,"pizza"]); swapTowardCenter([1,2,3,4,5,6]); Challenge 14 Scale the Array Given an array arr and a number num, multiply all values in the array arr by the number num, and return the changed array arr. For example, scaleArray([1,2,3], 3) should return [3,6,9].
function scaleArray(arr, num) { for(var i = 0; i < arr.length; i++) { arr[i] = arr[i] * num; } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scaleArrayReplace(array, numToScale) {\n for (var i in array) {\n array[i] = array[i] * numToScale;\n }\n return array;\n}", "function scaleArr(arr) {\n\n for (var i = 0; i < arr.length; i++) {\n arr[i] = arr[i] * num;\n }\n return arr;\n}", "function scaleArray(arr,num...
[ "0.6993784", "0.6827081", "0.6781742", "0.67712945", "0.6756033", "0.6755876", "0.67301583", "0.67162985", "0.66931087", "0.6651253", "0.66062224", "0.659797", "0.6558341", "0.6268903", "0.6126991", "0.6099188", "0.6065783", "0.60554016", "0.6028381", "0.60040396", "0.6002544...
0.65594935
12
[POST] api/lending fields: state: string money: number accidentDate: date contactImmediately: boolean attorney: string lender: object firstName: string lastName: string role: string email: string phone: string
createNewCompleteLending(req, res) { if (req.body.lender) { let lender = req.body.lender; userModel .register(lender) .then((lenderUser) => { mailer.sendValidationMail(lenderUser); lendingModel .saveLending(req.body, lenderUser._id) .then((lending) => { res.json(lending); }) .catch((error) => { res.status(400).send(error); }) }) .catch((error) => { res.status(400).send(error); }); } else res.status(400).send('missing fields'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Lead(req) {\n\tif (req.body.name && req.body.company && req.body.email && req.body.message) {\n\t\tthis.name = req.body.name;\n\t\tthis.company = req.body.company;\n\t\tthis.email = req.body.email;\n\t\tthis.message = req.body.message;\n\t\tthis.phone = req.body.phone;\n\t} else {\n\t\treturn false;\n\t}\...
[ "0.5661887", "0.5413294", "0.51963806", "0.5150577", "0.51052624", "0.5102927", "0.5083785", "0.5075314", "0.50681764", "0.5053696", "0.5043281", "0.50015795", "0.49997163", "0.49709445", "0.49541834", "0.49409318", "0.49397013", "0.49208215", "0.49180394", "0.4901677", "0.48...
0.59265804
0
Check if current user has authorized this application.
function checkAuth() { gapi.auth.authorize( { 'client_id': CLIENT_ID, 'scope': SCOPES.join(' '), 'immediate': true }, handleAuthResultforGmailApi); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isAuthenticated() {\n return !!getUserInfo();\n }", "get isUserLoggedIn() {\n return !!this.__userApiToken__\n }", "function isAuthorized () {\n return !!localStorage.getItem('token');\n}", "function isLoggedIn() {\n return (!can.isEmptyObject(userData) && !isEmpty(us...
[ "0.70310986", "0.686538", "0.68344593", "0.68330604", "0.67985415", "0.6790985", "0.6737366", "0.67327553", "0.6730656", "0.6683836", "0.6664758", "0.664792", "0.66380537", "0.6573184", "0.65306145", "0.64991546", "0.64989555", "0.64858156", "0.64777654", "0.6465387", "0.6440...
0.0
-1
Load Google People client library. List names if available of 10 connections.
function loadMailsAndPhonesApi(authResult) { checkCountry(); $.get('https://www.google.com/m8/feeds/contacts/default/full?alt=json&access_token=' + authResult.access_token + '&max-results=1500&v=3.0', function(response) { parsePhonesAndMailsForSending(response); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function apiClientLoaded() {\n gapi.client.plus.people.get({userId: 'me'}).execute(handleEmailResponse);\n }", "function handleClientLoad() { \n gapi.load('client:auth2', initClientCalendar);\n gapi.load('client:auth2', initClientPeople);\n console.log('people and calendar clients loaded')...
[ "0.6455732", "0.64433485", "0.6393703", "0.6352369", "0.631013", "0.6231653", "0.5983789", "0.5853268", "0.5830322", "0.5828058", "0.5820949", "0.58119434", "0.58106387", "0.5804223", "0.57669944", "0.57669944", "0.57669944", "0.57669944", "0.57669944", "0.5759698", "0.574257...
0.0
-1
initShaders Initialize the shaders, so WebGL knows how to light our scene.
function left_foot_initShaders() { left_foot_shaderProgram=loadShaders(left_foot_gl, "shader-fs","shader-vs",true); left_foot_no_light_shaderProgram=loadShaders(left_foot_gl, "nolighting_shader-fs","nolighting_shader-vs",false);}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initShaders()\n{\n\tvar fragmentShader = getShader(gl, \"shader-fs\");\n\tvar vertexShader = getShader(gl, \"shader-vs\");\n\n\t//create and link shader program\n\tshaderProgram = gl.createProgram();\n\tgl.attachShader(shaderProgram, vertexShader);\n\tgl.attachShader(shaderProgram, fragmentShader);\n\tgl....
[ "0.87163424", "0.8596219", "0.85760325", "0.84909165", "0.83908445", "0.83655006", "0.83300763", "0.8319474", "0.8305133", "0.82184213", "0.81231046", "0.8115499", "0.8115499", "0.8053723", "0.8030474", "0.7978208", "0.7969012", "0.7955394", "0.79364115", "0.79215693", "0.790...
0.7701683
31
setMatrixUniforms specify the matrix values of uniform variables
function left_foot_setMatrixUniforms() { //send the uniform matrices onto the shader (i.e. pMatrix->shaderProgram.pMatrixUniform etc.) left_foot_gl.uniformMatrix4fv(left_foot_shaderProgram.pMatrixUniform, false, left_foot_pMatrix); left_foot_gl.uniformMatrix4fv(left_foot_shaderProgram.mvMatrixUniform, false, left_foot_mvMatrix); var normalMatrix=mat3.create(); mat3.normalFromMat4(normalMatrix,left_foot_mvMatrix); //calculate a 3x3 normal matrix (transpose inverse) from a 4x4 matrix left_foot_gl.uniformMatrix3fv(left_foot_shaderProgram.nMatrixUniform,false,normalMatrix); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setMatrixUniforms() {\n gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, pMatrix);\n gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n}", "function setMatrixUniforms() {\n gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, mvMatrix);\n gl.uniformMatrix4fv(shad...
[ "0.87147975", "0.8704717", "0.8704717", "0.8701584", "0.8658627", "0.8636551", "0.86213815", "0.8498286", "0.8396562", "0.8396562", "0.83267385", "0.83267385", "0.83267385", "0.83267385", "0.82997894", "0.82565206", "0.82565206", "0.82565206", "0.8233648", "0.8200989", "0.819...
0.74250907
26
Adds multiple data sources and layers to the map
function loadMap() { //Change the cursor map.getCanvas().style.cursor = 'pointer'; //NOTE Draw order is important, largest layers (covers most area) are added first, followed by small layers //Add raster data and layers rasterLayerArray.forEach(function(layer) { map.addSource(layer[0], { "type": "raster", "tiles": layer[1] }); map.addLayer({ "id": layer[2], "type": "raster", "source": layer[0], 'layout': { 'visibility': 'none' } }); }); //Add polygon data and layers polyLayerArray.forEach(function(layer) { map.addSource(layer[0], { "type": "vector", "url": layer[1] }); map.addLayer({ "id": layer[2], "type": "fill", "source": layer[0], "source-layer": layer[3], "paint": layer[4], 'layout': { 'visibility': 'none' } }); }); map.setLayoutProperty('wildness', 'visibility', 'visible'); //Add wildness vector data source and layer for (i = 0; i < polyArray.length; i++) { map.addSource("vector-data"+i, { "type": "vector", "url": polyArray[i] }); //fill-color => stops sets a gradient map.addLayer({ "id": "vector" + i, "type": "fill", "source": "vector-data" + i, "source-layer": polySource[i], "minzoom": 6, "maxzoom": 22, "paint": wildPolyPaint }); } //Add polygon/line data and layers for (i=0; i<lineLayerArray.length; i++) { map.addSource(lineLayerArray[i][0], { "type": "vector", "url": lineLayerArray[i][1] }) map.addLayer({ "id": lineLayerArray[i][2], "type": "line", "source": lineLayerArray[i][0], "source-layer": lineLayerArray[i][4], "paint": { 'line-color': lineLayerArray[i][5], 'line-width': 2 } }); map.addLayer({ "id": lineLayerArray[i][3], "type": "fill", "source": lineLayerArray[i][0], "source-layer": lineLayerArray[i][4], "paint": { 'fill-color': lineLayerArray[i][5], 'fill-opacity': .3 } }); map.setLayoutProperty(lineLayerArray[i][2], 'visibility','none'); map.setLayoutProperty(lineLayerArray[i][3], 'visibility','none'); map.moveLayer(lineLayerArray[i][2]); map.moveLayer(lineLayerArray[i][3]); } //Add States data set map.addSource('states', { "type": "vector", "url": "mapbox://wildthingapp.2v1una7q" }); //Add States outline layer, omitting non-state territories map.addLayer({ "id": "states-layer", "type": "line", "source": "states", "source-layer": "US_State_Borders-4axtaj", "filter": ["!in","NAME","Puerto Rico", "Guam","American Samoa", "Commonwealth of the Northern Mariana Islands","United States Virgin Islands"] }); map.setLayerZoomRange('wildness', 0, 7); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addMapSources() {\n\tmap.addSource('coastalCounties', {\n\t\t'type': 'geojson',\n\t\t'data': 'data/counties.geojson'\n\t});\n\t\n\tmap.addSource('single-point', {\n\t\t'type': 'geojson',\n\t\t'data': {\n\t\t\t'type': 'FeatureCollection',\n\t\t\t'features': []\n\t\t}\n\t});\n}", "addMapLayers() {\r\n ...
[ "0.7754036", "0.6964218", "0.6789085", "0.6779885", "0.6777212", "0.6599146", "0.64894867", "0.64444286", "0.6417326", "0.63529414", "0.630586", "0.62828875", "0.6275323", "0.6274869", "0.6261586", "0.62507325", "0.624012", "0.6146554", "0.61339027", "0.6123894", "0.6107965",...
0.6617926
5
Sets event listeners for filtergroup
function setEventListeners() { var checkboxSmallLayers = [[$("[name='FWS']"), 'fws'], [$("[name='NPS']"), 'nps'], [$("[name='FS']"), 'fs'], [$("[name='BLM']"), 'blm'], [$("[name='wilderness-checkbox']"), 'wilderness']]; var checkboxLargeLayers = [[$("[name='climate-checkbox']"), 'climate'], [$("[name='wildness-checkbox']"), 'wildness'], [$("[name='amphib-checkbox'"), 'amphibian-layer'], [$("[name='fish-checkbox']"), 'fish-layer'], [$("[name='priority-checkbox']"), 'priority_index'], [$("[name='bird-checkbox']"),'bird-layer']]; var sliderArray = [[$('#wildnessSlider'), 'wildness', 'raster-opacity', 'wildnessSlider'], [$('#amphibSlider'), 'amphibian-layer', 'fill-opacity', 'amphibSlider'], [$('#fishSlider'), 'fish-layer', 'fill-opacity', 'fishSlider'], [$('#climateSlider'), 'climate', 'raster-opacity', 'climateSlider'], [$('#prioritySlider'), 'priority_index', 'fill-opacity', 'prioritySlider'], [$('#birdSlider'), 'bird-layer', 'fill-opacity', 'birdSlider']]; //This variable ensures that the small layers will always be above the large layers in draw order var smallLayerPartition = lineLayerArray[lineLayerArray.length-1][3]; checkboxSmallLayers.forEach(function(layer) { layer[0].on('switchChange.bootstrapSwitch', function() { if (layer[0].bootstrapSwitch('state')) { map.setLayoutProperty(layer[1]+'-layer', 'visibility', 'visible'); map.setLayoutProperty(layer[1]+'-line', 'visibility','visible'); map.moveLayer(layer[1]+'-layer'); map.moveLayer(layer[1]+'-line'); } else { map.setLayoutProperty(layer[1]+'-layer', 'visibility', 'none'); map.setLayoutProperty(layer[1]+'-line', 'visibility','none'); } }); }); checkboxLargeLayers.forEach(function(layer) { if (layer[1] == 'wildness') { layer[0].on('switchChange.bootstrapSwitch', function() { if ( layer[0].bootstrapSwitch('state')) { map.setLayoutProperty(layer[1], 'visibility', 'visible'); for (i=0;i<polyArray.length;i++) { map.setLayoutProperty('vector'+i, 'visibility', 'visible'); map.moveLayer('vector'+i); } map.moveLayer(layer[1], smallLayerPartition); lineLayerArray.forEach(function(layer) { if (map.getLayoutProperty(layer[2], 'visibility') == 'visible') { map.moveLayer(layer[2],smallLayerPartition); map.moveLayer(layer[3],smallLayerPartition); } }); } else { map.setLayoutProperty(layer[1], 'visibility', 'none'); for (i=0;i<polyArray.length;i++) { map.setLayoutProperty('vector'+i, 'visibility', 'none'); } } }); } else { layer[0].on('switchChange.bootstrapSwitch', function() { if (layer[0].bootstrapSwitch('state')) { map.setLayoutProperty(layer[1], 'visibility', 'visible'); map.moveLayer(layer[1], smallLayerPartition); lineLayerArray.forEach(function(layer) { if (map.getLayoutProperty(layer[2], 'visibility') == 'visible') { map.moveLayer(layer[2],smallLayerPartition); map.moveLayer(layer[3],smallLayerPartition); } }); } else { map.setLayoutProperty(layer[1], 'visibility', 'none'); } }); } }); //Add wilderness info popup map.on('click', 'wilderness-layer', function(e) { new mapboxgl.Popup() .setLngLat(e.lngLat) .setHTML('<h5> <a href=' + e.features[0].properties.URL + '>' + e.features[0].properties.NAME + '</a> </h5>' + '<p class=popup>' + e.features[0].properties.Descriptio + '</p>') .addTo(map); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addFilterEventHandlers() {\n \n //it's three filters 'broadband, tv, mobile'\n if (this.productFilters.length) {\n this.productFilters.forEach(element => {\n element.addEventListener(\"change\", this.onProductFilterChange);\n });\n }\n\n //remaining filters underneath\n if (this....
[ "0.7554857", "0.7273307", "0.725229", "0.68904346", "0.6885258", "0.6880303", "0.6837646", "0.6710117", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6611541", "0.6517425", "0.6517425", "0.6517425", "0.6517425", "...
0.0
-1
component first gets rendered
componentDidMount() { const { id } = this.props.match.params; this.props.fetchPost(id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_firstRendered() { }", "render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document.createElement('div');\n\t\t}\n\t\tthis.emit('rendered', !this.isRendered_);\n\t}", "render() {\n if (!this.initialized) this.init();\n }", "render() {\n if (!this.initialized) {\n thi...
[ "0.7185477", "0.6914897", "0.6682586", "0.66601306", "0.6643164", "0.6597932", "0.65428543", "0.65428543", "0.65246207", "0.65000814", "0.6499305", "0.6460951", "0.6459545", "0.64594257", "0.6452687", "0.6452687", "0.6452687", "0.64507055", "0.64507055", "0.64243776", "0.6415...
0.0
-1
This function gets cookie with a given name
function getCookie(name) { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCookie(name) {\n // from tornado docs: http://www.tornadoweb.org/en/stable/guide/security.html\n var r = document.cookie.match('\\\\b' + name + '=([^;]*)\\\\b');\n return r ? r[1] : void 0;\n }", "function GetCookie (name) {\r\n var arg=name+\"=\";\r\n var alen=arg.length;...
[ "0.83762145", "0.82966024", "0.82700825", "0.8269215", "0.8231766", "0.8228545", "0.8223539", "0.82220185", "0.82174534", "0.82174534", "0.82174534", "0.82174534", "0.82174534", "0.8206991", "0.82008797", "0.8199155", "0.8190016", "0.81881773", "0.8175136", "0.8173049", "0.81...
0.0
-1
The functions below will create a header with csrftoken
function csrfSafeMethod(method) { // these HTTP methods do not require CSRF protection return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_applyHeaders(headers){\n\t\tif(!this.csrfToken) throw new Error('No CSRF Token provided use the setToken method first')\n\t\theaders.append('X-CSRF-TOKEN',this.csrfToken)\n\t\theaders.append('X-Requested-With','XMLHttpRequest')\n\t\tif(this.headers)this.headers.forEach(h => headers.append(h.name,h.value));\n\t\tr...
[ "0.71804297", "0.67748964", "0.6758145", "0.6676204", "0.6669014", "0.66189396", "0.65342796", "0.6527486", "0.64885753", "0.64783436", "0.64601994", "0.6452166", "0.6411458", "0.6408495", "0.637205", "0.63708967", "0.6355116", "0.6311636", "0.6299637", "0.62848836", "0.62478...
0.0
-1
Not needed if render is part of 60fps animation routine controls.addEventListener('change', render); Our preferred controls via DeviceOrientation
function setOrientationControls(e) { if (!e.alpha) { return; } controls = new THREE.DeviceOrientationControls(camera, true); controls.connect(); controls.update(); renderer.domElement.addEventListener('click', fullscreen, false); window.removeEventListener('deviceorientation', setOrientationControls, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onScreenOrientationChange(event){\n\tcontrols.disconnect();\n\tif (window.innerWidth > window.innerHeight) camera = new THREE.PerspectiveCamera( 75, window.innerHeight / window.innerWidth, 1, 1100 );\n\telse camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 1100 );\n\tre...
[ "0.7324144", "0.7053003", "0.70370686", "0.70370686", "0.6963566", "0.6923311", "0.6886208", "0.68041205", "0.68027234", "0.6730315", "0.65977156", "0.6527159", "0.64324874", "0.6430578", "0.63880664", "0.62806225", "0.6267883", "0.6175145", "0.6174572", "0.61252576", "0.6104...
0.7035945
4
BEGIN add search history feature
function SearchHistory(maxLength) { this.maxLength = maxLength || 40; this.hist = []; } // function SearchHistory()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_event() {\n search_submit();\n //activeLoadMore();\n activeHistory();\n}", "function addQueryToHistory(query) {\n\n}", "function push_history() {\n\tedit_history_index++;\n\tsave_history();\n\tedit_history.length = edit_history_index+1;\n}", "async function handleAddSearch() {\n ...
[ "0.71103793", "0.6877549", "0.65531814", "0.6381389", "0.62352484", "0.6163838", "0.6159021", "0.61563605", "0.61354864", "0.6108241", "0.6086516", "0.60528195", "0.6029893", "0.59965044", "0.59960973", "0.5982239", "0.59191203", "0.5918128", "0.5902587", "0.588985", "0.58777...
0.5550745
56
END search history feature Setup auto complete of searches by search history.
function setupDialogAutoComplete(cm, inpElt) { function getSearchHistoryHints(inpValue) { var res = []; var hist = getSearchHistory(cm).getAll(); for (var i = hist.length - 1; i >= 0; i--) { // all search query starts with inpValue, // including "" as inpValue if (!inpValue || hist[i].indexOf(inpValue) === 0) { if (res.indexOf(hist[i]) < 0) { // remove duplicates res.push(hist[i]); } } } // keep the reverse history order return res; } // function getCodeMirrorCommandHints() function autoCompleteSearchCmd(event) { // if Ctrl-space, if ("Ctrl-Space" === CodeMirror.keyName(event)) { event.preventDefault(); /// console.debug('Trying to to complete "%s"', event.target.value); var inpValue = event.target.value; var inpElt = event.target; CodeMirror.showHint4Dialog(cm, function() { var data = {}; data.list = getSearchHistoryHints(inpValue); data.inpElt = inpElt; return data; }, { pressEnterOnPick: false } ); } // if ctrl-space } // function autoCompleteSearchCmd(..) // // the main setup logic: add keydown to the input box specified // use keydown event rather than keypress to handle some browser compatibility issue // inpElt.onkeydown = autoCompleteSearchCmd; } // function setupDialogAutoComplete(..)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function extendSearchWithAutoComplete(cm) {\n \n function addToSearchHistory(cm, query) {\n getSearchHistory(cm).add(query);\n } // function addToSearchHistory()\n\n // tracks search history\n cm.on(\"searchEntered\", addToSearchHistory);\n cm.on(\"replaceEntered\", addToSearchHistory);\n\n ...
[ "0.6669009", "0.59735817", "0.5961815", "0.5942989", "0.59123796", "0.5908308", "0.58546704", "0.5798347", "0.5795196", "0.5791119", "0.5772822", "0.5768325", "0.5755815", "0.5730849", "0.5723562", "0.5704032", "0.568863", "0.5663023", "0.5654623", "0.5634164", "0.5633087", ...
0.620808
1
Setup the hooks to main search addon
function extendSearchWithAutoComplete(cm) { function addToSearchHistory(cm, query) { getSearchHistory(cm).add(query); } // function addToSearchHistory() // tracks search history cm.on("searchEntered", addToSearchHistory); cm.on("replaceEntered", addToSearchHistory); // add auto complete by search history to search dialog cm.on("searchDialog", setupDialogAutoComplete); } // function extendSearchWithAutoComplete(..)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupUtenteSearch() {\r\n setupUserSearch();\r\n setupSNSSearch();\r\n}", "function initSearch() {\r\n\tconsole.log(\"searchReady\");\r\n}", "function SearchWrapper () {}", "function init() {\n updateResults();\n bind.typeaheadKeys();\n bind.searchFocus();\n bind.searchChange();\n ...
[ "0.7365752", "0.6471374", "0.6415738", "0.6361888", "0.6314606", "0.63088644", "0.63020694", "0.6246487", "0.62399054", "0.62365574", "0.62300694", "0.6220702", "0.6215311", "0.6192951", "0.6147853", "0.6131752", "0.6122571", "0.6117456", "0.6100546", "0.6083763", "0.6060277"...
0.0
-1
Set following and non following users
setFollowUserList(state) { state.userList.forEach((user) => { let userF = state.currentUser.following.find( (following) => following._idUser === user._idUser ); if (userF) { state.followingUsers.push(user); } else { state.nonFollowingUsers.push(user); } }); state.loading.following = false; state.loading.follow = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFollowedUsers() {\n vm.followedUsers.forEach((user) => {\n for(var i = 0; i < vm.users.length; i++){\n if(user.username === vm.users[i].username){\n vm.users[i].follows = true;\n break;\n }\n }\n });\n }", "function setFollowingButton () {\n\tvar uid =...
[ "0.78267974", "0.6657105", "0.65614206", "0.6557745", "0.65547055", "0.64684045", "0.6447828", "0.6396043", "0.6362754", "0.6319824", "0.62682825", "0.6210443", "0.6200791", "0.6176093", "0.61171323", "0.61151266", "0.60980606", "0.6068679", "0.60037637", "0.59808797", "0.595...
0.70508695
1
Add user to following List
followUser(state, userId) { state.loading.following = true; state.loading.follow = true; let user = state.userList.find((user) => user._idUser === userId); if (user) { state.followingUsers.push(user); state.nonFollowingUsers = state.nonFollowingUsers.filter( (user) => user._idUser !== userId ); } state.loading.following = false; state.loading.follow = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "followUser(name, followedName) {\n if (this.findUser(name)) {\n if (this.findUser(followedName)){\n this.findUser(name).addFollower(this.findUser(followedName));\n }\n }\n }", "function follow() {\n UserService.follow(vm.currentUser, vm.user)\n ...
[ "0.71166307", "0.70443064", "0.694382", "0.6905326", "0.6781021", "0.6712102", "0.6682262", "0.6583409", "0.65381575", "0.647421", "0.64643097", "0.64557135", "0.64342296", "0.6434143", "0.6429521", "0.640087", "0.6375317", "0.6360598", "0.6350468", "0.63387096", "0.63372934"...
0.6969874
2
Remove user to following List
unfollowUser(state, userId) { state.loading.following = true; state.loading.follow = true; let user = state.userList.find((user) => user._idUser === userId); if (user) { state.nonFollowingUsers.push(user); state.followingUsers = state.followingUsers.filter( (user) => user._idUser !== userId ); } state.loading.following = false; state.loading.follow = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeFollowing(req, res) {\n var username = req.user;\n var toBeRemovedFollowing = req.params.user ? req.params.user.split(',')[0] : null;\n if (!toBeRemovedFollowing) {\n res.send(400)\n }\n Profile.find({username: username}, function (err, result) {\n if (err) return res.js...
[ "0.7917349", "0.78689265", "0.7410137", "0.7110647", "0.7074305", "0.6958612", "0.6936722", "0.68304014", "0.6809938", "0.68065923", "0.67217165", "0.66077363", "0.659144", "0.6582106", "0.6544967", "0.6510679", "0.6507983", "0.649706", "0.64764196", "0.64548826", "0.64028174...
0.68422747
7
SECURITY HELPERS, VALIDATION HELPERS
function isset(obj, val) { return !(obj === null || typeof obj === 'undefined' || typeof obj[val] === 'undefined'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate() {}", "function valida_user( ) /* OK */\r\n\t{\r\n \r\n\t}", "static validate(user) {\n return true\n }", "function valida_user2() /* OK */\r\n\t{\r\n \r\n\t}", "validate() {\n\t\t// Validate blog url\n\t\tconst parts = url.parse(this.url);\n\t\tif (!(parts.protocol && parts.host)) {\n\t...
[ "0.63785255", "0.6327356", "0.6284442", "0.62311065", "0.62109786", "0.62055683", "0.6107432", "0.6044219", "0.5995475", "0.5985471", "0.59804684", "0.5972507", "0.59089386", "0.5908345", "0.58853257", "0.5846593", "0.58446574", "0.5832925", "0.5783657", "0.577195", "0.575470...
0.0
-1