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
Reset the state of the current subunit. The following activities are performed while resetting the state of the current subunit. 1. Set the state of the tutor to READY. 2. Set the number of errors made to 0. 3. Clear the input textarea element.
function resetSubunit() { my.current.state = my.STATE.READY my.current.errors = 0 my.html.input.value = '' log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit) updatePracticePaneState() updatePracticePane() clearAdvice() clearResultTooltips() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n\tstate.questionCounter = 0;\n\tstate.score = 0;\n\tstate.questions = [\n\t\t{\n\t\t\tid: 0,\n\t\t\tpregunta: 'Ets un/a Vilafranquí/ina de Tota la Vida? Prova el test!',\n\t\t\trespostes: [],\n\t\t\tcorrecte: null,\n\t\t},\n\t];\n\tstate.collectedAnswers = [];\n\tstate.comodinsLeft = state.como...
[ "0.643484", "0.6290009", "0.6285774", "0.6202145", "0.62011844", "0.61792785", "0.6145059", "0.6135676", "0.6133065", "0.6085142", "0.60610527", "0.6059029", "0.599889", "0.5981631", "0.59789747", "0.5977937", "0.5974269", "0.5968152", "0.5956023", "0.59373504", "0.59372663",...
0.88482547
0
Set the tutor properties for the specified unit and subunit numbers. Arguments: m Unit number n Subunit number
function setSubunit(m, n) { my.current.unitNo = m my.current.subunitNo = n my.current.unit = unit(m) my.current.subunitTitles.length = 0 for (var subunitTitle in my.current.unit.subunits) { my.current.subunitTitles.push(subunitTitle) } var subunitTitle = my.current.subunitTitles[n - 1] my.current.subunitText = my.current.unit.subunits[subunitTitle] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setUnits() {\n this.units = unitSystem.getUnits();\n }", "function setUnitInfoInfo(stroption) {\n UnitInfo = stroption;\n}", "function setTerreainUniformVariables() {\n // Terrain uniform variables\n terrainDeferred.bindTexToUnit(\"tex_Color\", terrain_diffuse, 0);\n terrainDeferred...
[ "0.54758155", "0.52496386", "0.49302256", "0.49276233", "0.49223965", "0.49028546", "0.49028546", "0.4879682", "0.48509598", "0.4790742", "0.47573644", "0.4746591", "0.46574658", "0.46320707", "0.45933446", "0.45891666", "0.4576543", "0.45003316", "0.44828627", "0.4465418", "...
0.75769377
0
Display the subunit links for the current unit.
function displaySubunitLinks() { // Delete all existing subunit links var linksDiv = my.html.subunitLinks while (linksDiv.firstChild && linksDiv.firstChild.className != 'stretch') { linksDiv.removeChild(linksDiv.firstChild) } // Create new subunit links for the unit m var numberOfSubunits = my.current.subunitTitles.length for (var i = numberOfSubunits - 1; i >= 0; i--) { // Insert whitespaces between div elements, otherwise they // would not be justified var whitespace = document.createTextNode('\n') linksDiv.insertBefore(whitespace, linksDiv.firstChild) var label = my.current.subunitTitles[i] var selected = (i + 1 == my.current.subunitNo) var href = unitHref(my.current.unitNo, i + 1) var subunitDiv = boxedLink(label, selected, href) subunitDiv.id = 'subunit' + (i + 1) subunitDiv.style.width = (95 / numberOfSubunits) + '%' linksDiv.insertBefore(subunitDiv, linksDiv.firstChild) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayUnitLinks()\n {\n // Delete all existing unit links\n var linksDiv = my.html.unitLinks\n Util.removeChildren(linksDiv)\n\n // Create new unit links\n for (var i = 0; i < Units.main.length; i++) {\n var label = 'སློབ་མཚན། ' + (i + 1)\n var ...
[ "0.7663342", "0.68255967", "0.68116045", "0.6465879", "0.6303267", "0.6192426", "0.61063194", "0.5817894", "0.55888015", "0.5503396", "0.54560477", "0.54035646", "0.5357568", "0.5330761", "0.5311307", "0.5309545", "0.5302293", "0.5295641", "0.528613", "0.5247997", "0.52389777...
0.86291367
0
Display title for the current unit.
function displayUnitTitle() { // Parts of the unit title var unitNo = 'སློབ་མཚན། ' + my.current.unitNo + '.' + my.current.subunitNo var space = '\u00a0\u00a0' var title = '[' + my.current.unit.title + ']' Util.setChildren(my.html.unitTitle, unitNo, space, title) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "title() { return this.owner.name + \" - \" + this.label.replace('\\n', ' ') }", "showTitle() {\n this.log(_consts.SEPARATOR);\n\n if (!this.options.title) {\n const title = `${_consts.GENERATOR_NAME} v${_package.version}`;\n const subTitle = 'Add hook to existing API';\n ...
[ "0.69369173", "0.6902636", "0.6851144", "0.68014085", "0.67773896", "0.6727385", "0.6676678", "0.6635912", "0.64873755", "0.6485262", "0.6455869", "0.6447169", "0.6438482", "0.64255977", "0.64178836", "0.6412323", "0.64063", "0.6403999", "0.6394279", "0.6350035", "0.6350035",...
0.8794409
0
Display guide for the current unit.
function displayGuide() { my.html.guide.innerHTML = my.current.unit.guide }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateDisplayString() {\n this.displayString = 'Increase ' + this.name + ' by ' + this.value + ' ' + this.measuringUnit;\n }", "function displayHelpText() {\n console.log();\n console.log(' Usage: astrum figma [command]');\n console.log();\n console.log(' Commands:');\n console.log(' in...
[ "0.59519535", "0.5727213", "0.559132", "0.5571523", "0.55665183", "0.5551647", "0.55430514", "0.55373716", "0.55318224", "0.5527445", "0.55033475", "0.55029726", "0.54797006", "0.5464949", "0.5432987", "0.5432799", "0.54291075", "0.5413121", "0.54024214", "0.5394989", "0.5379...
0.8241103
0
Set the target text to be typed. The target text consits of three parts: 1. Prefix 2. Target character 3. Suffix The target character is the character the user should type to move ahead in the subunit. The prefix and the suffix offer some context around the target character to be typed. These three parts combined, in the specified order above, is a substring from the subunit's text from units.js.
function setTargetText() { // The target text should display at least one character var targetLength = Settings.TARGET_TEXT_LENGTH if (targetLength < 1) { targetLength = 1 } // Length of the target text should be odd as equal number of // characters should be displayed on either side of the // character to be typed if (targetLength % 2 == 0) { targetLength-- } // Number of characters on either side of the character to be // typed, assuming that the character to be typed is at the // centre var prefixLength = (targetLength - 1) / 2 // Calculate the start index and the end index of the substring // to be selected from the subunit text to display as the target // text var i = my.current.correctInputLength var textLength = my.current.subunitText.length if (i <= prefixLength) { var startIndex = 0 } else if (i >= textLength - 1 - prefixLength) { var startIndex = textLength - targetLength } else { var startIndex = i - prefixLength } var endIndex = startIndex + targetLength // Select prefix string var s = my.current.subunitText.substring(startIndex, i) my.current.targetPrefix = Util.visual(s) // Select target character if (i < textLength) { s = my.current.subunitText.charAt(i) my.current.targetChar = Util.visual(s) } else { my.current.targetChar = '' } // Select suffix string s = my.current.subunitText.substring(i + 1, endIndex) my.current.targetSuffix = Util.visual(s) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayTargetText()\n {\n // Create target character element\n var targetCharElement = document.createElement('span')\n var targetChar = document.createTextNode(my.current.targetChar)\n targetCharElement.className = 'targetChar'\n targetCharElement.appendChild(targetC...
[ "0.60048664", "0.5775657", "0.56695825", "0.56505764", "0.55948794", "0.5434984", "0.5434984", "0.5361348", "0.5334576", "0.52660495", "0.518258", "0.5154124", "0.51522535", "0.51208586", "0.51101273", "0.5055028", "0.5045333", "0.50254977", "0.5013132", "0.5006947", "0.49945...
0.83831364
0
Display the current target text
function displayTargetText() { // Create target character element var targetCharElement = document.createElement('span') var targetChar = document.createTextNode(my.current.targetChar) targetCharElement.className = 'targetChar' targetCharElement.appendChild(targetChar) // Set new target text Util.setChildren(my.html.target, my.current.targetPrefix, targetCharElement, my.current.targetSuffix) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayTarget(){\n findTarget();\n if(isPlaying===true){\n $('#target-letter').text(\"'\" + targetLet + \"'\");\n }\n}", "function setTargetText() {\n\n // The target text should display at least one character\n var targetLength = Settings.TARGET_TEXT_LENGTH\n if (ta...
[ "0.7295878", "0.7170134", "0.68684554", "0.6815694", "0.66996807", "0.6583383", "0.6583383", "0.64378256", "0.6414652", "0.6315669", "0.62590045", "0.6213346", "0.6204112", "0.6199924", "0.61949795", "0.61788446", "0.61720175", "0.61701274", "0.6166431", "0.61591864", "0.6146...
0.86897904
0
Update practice pane after evaluating the user's input. The input typed by the user is evaluated for correctness and then the practice pane is updated.
function updatePracticePane() { evaluateInput() setTargetText() displayTargetText() updateProgress() updateSpeed() updateError() updateSmiley() if (my.current.state == my.STATE.COMPLETED) { displayAdvice() setResultTooltips() log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit, 'wpm', my.current.wpm, 'error', my.current.errorRate.toFixed(1)) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function evaluateInput()\n {\n var inputText = my.html.input.value\n var inputLength = inputText.length\n\n // If the tutor is in READY state, and input has been entered,\n // then set it to RUNNING STATE.\n if (my.current.state == my.STATE.READY && inputLength > 0) {\n\n ...
[ "0.72625816", "0.67071354", "0.5888808", "0.5870281", "0.5828073", "0.5824714", "0.58144224", "0.5802231", "0.577422", "0.56987923", "0.56887746", "0.56745684", "0.56663615", "0.5627791", "0.5627436", "0.5613489", "0.55984586", "0.55934066", "0.5570111", "0.5563535", "0.55629...
0.770059
0
Evaluate the input typed by the user and change the practice panel state if necessary.
function evaluateInput() { var inputText = my.html.input.value var inputLength = inputText.length // If the tutor is in READY state, and input has been entered, // then set it to RUNNING STATE. if (my.current.state == my.STATE.READY && inputLength > 0) { my.current.startTime = new Date().getTime() my.current.state = my.STATE.RUNNING updatePracticePaneState() log('state', my.current.state.toUpperCase(), 'unit', my.current.unitNo + '.' + my.current.subunitNo, 'type', my.settings.unit) } // Number of characters correctly typed by the user var goodChars = Util.common(my.current.subunitText, inputText) my.current.correctInputLength = goodChars // Validate the input if (goodChars == inputLength) { // Clear error if any if (my.current.state == my.STATE.ERROR) { my.current.state = my.STATE.RUNNING updatePracticePaneState() } } else { // Set and display error if (my.current.state == my.STATE.RUNNING) { my.current.state = my.STATE.ERROR my.current.errors++ updatePracticePaneState() } else if (my.current.state == my.STATE.ERROR) { processInputCommand() } } // Update error rate if (goodChars == 0) { if (my.current.errors == 0) { my.current.errorRate = 0 } else { my.current.errorRate = Number.POSITIVE_INFINITY } } else { my.current.errorRate = 100 * my.current.errors / goodChars } // Check if the complete target text has been typed successfully if (goodChars == my.current.subunitText.length) { my.current.state = my.STATE.COMPLETED updatePracticePaneState() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePracticePane()\n {\n evaluateInput()\n setTargetText()\n displayTargetText()\n updateProgress()\n updateSpeed()\n updateError()\n updateSmiley()\n\n if (my.current.state == my.STATE.COMPLETED) {\n displayAdvice()\n setR...
[ "0.6807743", "0.669007", "0.63524586", "0.6127466", "0.60732496", "0.5969236", "0.58497804", "0.58126897", "0.58098054", "0.5806892", "0.57868755", "0.5749469", "0.5738369", "0.56831956", "0.5662569", "0.5647252", "0.56438404", "0.56296617", "0.56276786", "0.5623167", "0.5600...
0.79498196
0
Update the state of the practice pane according to the current state of the unit.
function updatePracticePaneState() { switch (my.current.state) { case my.STATE.READY: my.html.practicePane.className = '' my.html.input.disabled = false my.html.input.focus() Util.setChildren(my.html.status, 'READY') my.html.status.title = 'Type in the input box below ' + 'to begin this lesson.' my.html.restartLink.style.visibility = 'hidden' break case my.STATE.RUNNING: my.html.practicePane.className = '' my.html.input.disabled = false my.html.input.focus() Util.setChildren(my.html.status, '') my.html.status.title = '' my.html.restartLink.style.visibility = 'visible' break case my.STATE.ERROR: my.html.practicePane.className = 'error' my.html.input.disabled = false my.html.input.focus() my.html.restartLink.style.visibility = 'visible' Util.setChildren(my.html.status, 'ERROR!') my.html.status.title = 'Fix errors in the input box ' + 'by pressing the backspace key.' break case my.STATE.COMPLETED: my.html.practicePane.className = 'completed' my.html.input.disabled = true my.html.input.blur() my.html.restartLink.style.visibility = 'visible' Util.setChildren(my.html.status, 'COMPLETED') my.html.status.title = 'You have completed this lesson.' break } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatePracticePane()\n {\n evaluateInput()\n setTargetText()\n displayTargetText()\n updateProgress()\n updateSpeed()\n updateError()\n updateSmiley()\n\n if (my.current.state == my.STATE.COMPLETED) {\n displayAdvice()\n setR...
[ "0.8052318", "0.57588446", "0.5743218", "0.56928384", "0.5668989", "0.5660109", "0.55661553", "0.55559504", "0.5511542", "0.55113316", "0.5503733", "0.5496617", "0.5492996", "0.546254", "0.54377234", "0.5434156", "0.54306704", "0.54262424", "0.5418253", "0.5390242", "0.538537...
0.7647987
1
Update remark and advice link according to the current state of the tutor and the performance of the user.
function displayAdvice() { // Calculate error rate (in percent) var error = Math.round(my.current.errorRate) var repeatSubunit = error > 0 // Update remark and advice var anchorElement = document.createElement('a') if (repeatSubunit) { Util.addChildren(my.html.remark, 'Reduce error') my.html.remark.title = 'Your error rate should not ' + 'exceed 0%.' Util.addChildren(anchorElement, 'Try again') anchorElement.href = '#restart' anchorElement.title = 'Please practice this lesson again.' } else { Util.addChildren(my.html.remark, 'Well done!') my.html.remark.title = 'You have satisfactorily ' + 'completed this lesson.' Util.addChildren(anchorElement, 'Next lesson') anchorElement.href = '#next' anchorElement.title = 'Please proceed with the next lesson.' } // Do not display 'Next lesson' advice if the user is at the // last subunit; display advice otherwise if (repeatSubunit || !currentSubunitIsTheLastSubunit()) { my.html.advice.appendChild(anchorElement) anchorElement.focus() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Description(course) {\r\n let initialUpvotes = course.upvotes;\r\n let initialReputation = course.reputation;\r\n const [upvotes, setUpvotes] = useState(initialUpvotes);\r\n const [courseReputation, setCourseReputation] = useState(initialReputation);\r\n const {userDetails,setUserDetail}= useContext(...
[ "0.56383204", "0.56011975", "0.5489353", "0.53817856", "0.51051044", "0.5086419", "0.50818425", "0.5067701", "0.5050999", "0.50234896", "0.501072", "0.49800426", "0.4972275", "0.4959148", "0.4954372", "0.4953436", "0.4937923", "0.4865306", "0.48645613", "0.48570627", "0.48545...
0.53313476
4
Update the typing speed.
function updateSpeed() { // WPM and CPM does not need to be calculated on error if (my.current.state == my.STATE.ERROR) { return } var goodChars = my.current.correctInputLength // Determine the time elapsed since the user began typing var currentTime = new Date().getTime() var timeElapsed = currentTime - my.current.startTime my.current.timeElapsed = timeElapsed // Calculate WPM and CPM var wpm if (timeElapsed == 0) { wpm = goodChars == 0 ? 0 : '\u221e' } else { wpm = Math.round(60000 * goodChars / 5 / timeElapsed) my.current.wpm = wpm my.current.cpm = Math.round(60000 * goodChars / timeElapsed) } // Display WPM Util.setChildren(my.html.speed, wpm + ' wpm') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTyping () {\n if (connected) {\n if (!typing) {\n typing = true;\n socket.emit('typing', {\n target: target,\n });\n }\n lastTypingTime = (new Date()).getTime();\n\n setTimeout(function () {\n var typingTimer = (new Date()).getTime();\n ...
[ "0.7157912", "0.7022486", "0.7008835", "0.69932204", "0.69932204", "0.69932204", "0.69932204", "0.69932204", "0.6932238", "0.66575783", "0.6471192", "0.6457088", "0.6453484", "0.6439646", "0.6439646", "0.6439646", "0.6439646", "0.6439646", "0.6437958", "0.6437958", "0.6437958...
0.7838378
0
Update the error rate.
function updateError() { var goodChars = my.current.correctInputLength var errorRate var errorRateTooltip var accuracyTooltip // Update error rate if (my.current.errorRate == Number.POSITIVE_INFINITY) { errorRate = '\u221e' } else { errorRate = Math.round(my.current.errorRate) } // Display error rate Util.setChildren(my.html.error, errorRate + '% error') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static set updateRate(value) {}", "updateLearningRate() {\n /* history must have more than 2 values */\n if (this.mseHistory.length < 2) {\n return;\n }\n /* MSE went up = bad update then devide by 2*/\n if (this.mseHistory[0] > this.mseHistory[1]) {\n ...
[ "0.68976146", "0.6777766", "0.612367", "0.59151495", "0.590682", "0.5859789", "0.57602364", "0.56785697", "0.5597232", "0.55769384", "0.55600226", "0.548091", "0.54773706", "0.5463604", "0.5435289", "0.5433369", "0.5412823", "0.5403989", "0.53394127", "0.5322566", "0.53169334...
0.7552104
0
Update the smiley to reflect the user's performance.
function updateSmiley() { var errorRate = Math.round(my.current.errorRate) var smiley if (errorRate == 0) { if (my.current.wpm >= 40) { smiley = my.SMILEY.VERY_HAPPY } else { smiley = my.SMILEY.HAPPY } } else if (errorRate > 0 && errorRate <= 2) { smiley = my.SMILEY.UNHAPPY } else { smiley = my.SMILEY.SAD } Util.setChildren(my.html.smiley, smiley) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateEmoji(){\r\n if(this.rating < .2){\r\n this.emoji = \"media/verysad.png\"; \r\n }\r\n else if(this.rating < .4){\r\n this.emoji = \"media/sad.png\"; \r\n }\r\n else if(this.rating < .6){\r\n this.emoji = \...
[ "0.6357531", "0.6007764", "0.58803296", "0.58789414", "0.5813852", "0.5813852", "0.5776564", "0.5775895", "0.57672244", "0.5700112", "0.56986904", "0.56731766", "0.56420135", "0.5633069", "0.5606887", "0.55965483", "0.5571476", "0.5565529", "0.55529016", "0.5541287", "0.55394...
0.78108287
0
Clear the tooltips in the result pane.
function clearResultTooltips() { my.html.speed.title = '' my.html.error.title = '' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear_tooltip() {\n\t$(\"#tooltip_container\").empty()\n\t$(\"#tooltip_container\").hide()\n}", "function hideTooltips() {\n\t\t\t\t\ttooltipObject.remove();\n\t\t\t\t}", "removeAllTooltips() {\n if (!this.activeToolTips?.length) {\n return;\n }\n for (let i = this.activeToolTips.length ...
[ "0.72888374", "0.7272986", "0.71922415", "0.70528156", "0.7044061", "0.6836587", "0.6780974", "0.6755042", "0.67468494", "0.6684047", "0.6585681", "0.65823495", "0.6580139", "0.6493192", "0.6448353", "0.6445565", "0.6445071", "0.6443478", "0.64297915", "0.6418842", "0.6394975...
0.8378526
0
Set the tooltips in the result pane.
function setResultTooltips() { var textLength = my.current.subunitText.length var charNoun = textLength == 1 ? 'character' : 'characters' // Speed tooltip my.html.speed.title = 'You have typed ' + textLength + ' ' + charNoun + ' in\n' + Util.prettyTime(my.current.timeElapsed) + '.\n\n' + 'Your typing speed is\n' + my.current.wpm + ' words per minute, or\n' + my.current.cpm + ' characters per minute.' // Error rate tooltip var errorRateTooltip var accuracyTooltip // Update error rate if (my.current.errorRate == Number.POSITIVE_INFINITY) { errorRateTooltip = '\u221e' accuracyTooltip = 0 } else { errorRateTooltip = parseFloat(my.current.errorRate.toFixed(1)) accuracyTooltip = 100 - errorRateTooltip } var errorNoun = my.current.errors == 1 ? 'error' : 'errors' var title = 'You have typed ' + textLength + ' ' + charNoun + '.\n' + 'You have made ' + my.current.errors + ' ' + errorNoun + '.\n' + 'Your error rate is ' + errorRateTooltip + '%.\n' + 'Your accuracy is ' + accuracyTooltip + '%.\n' my.html.error.title = title }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_addTooltips() {\n $(this.el.querySelectorAll('[title]')).tooltip({\n delay: { show: 500, hide: 0 }\n });\n }", "set tooltip(value) {}", "function initializeTooltips() {\n // Download document link\n $('.download-document').tooltip({\n 'show': true,\n ...
[ "0.7334321", "0.73147136", "0.6849508", "0.68288565", "0.67945063", "0.65687245", "0.65527654", "0.6503227", "0.6503227", "0.6503227", "0.6503227", "0.64765465", "0.6445026", "0.64272773", "0.6391714", "0.6388349", "0.63838303", "0.63723147", "0.6370157", "0.63505405", "0.635...
0.753394
0
Process command entered by the user in the input textarea element when the tutor is in error state. Once the tutor enters the error state, the supported commands are searched at the end of the erroneous input. If a supported command is found at the end of the erroneous input, the command is processed. The following is a list of the supported commands: restart restart the current subunit reset same as the 'restart' command fix remove errors from the input text xxx same as the 'fix' command
function processInputCommand() { var inputText = my.html.input.value var goodChars = my.current.correctInputLength if (inputCommandIs('restart') || inputCommandIs('rst')) { location.href = '#restart' } else if (inputCommandIs('fix') || inputCommandIs('xxx')){ my.html.input.value = inputText.substring(0, goodChars) updatePracticePane() } else if (inputCommandIs('qtpi')) { qtpi() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleError(command, index, error) {\n // Record the reason for the command failure.\n if (command.func.name === 'throwError') {\n historyItem[index].status = 'Unrecognized';\n }\n else if (failHard) {\n historyItem[index].status = 'Skipped';\n }\n else {\n ...
[ "0.5959118", "0.58217865", "0.58019996", "0.5768349", "0.5623921", "0.55826753", "0.552547", "0.54393476", "0.5423634", "0.5421429", "0.5404077", "0.5386142", "0.537462", "0.5317956", "0.53178096", "0.5307177", "0.52626866", "0.52485746", "0.5248293", "0.52112913", "0.5206284...
0.67122287
0
Check if the input entered by the user contains the specified command. The specified command is considered to be contained in the input if the input ends with the specified command. Return: true if the specified command is present in the input; false otherwise
function inputCommandIs(command) { var input = my.html.input.value return input.substring(input.length - command.length) == command }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hasCmd(cmd) {\n return this.parsed._.includes(cmd.name);\n }", "function checkIfValidCommand(command) {\n\n var valid_commands = /df|mf|al[0-9]+|ar[0-9]|none+/i;\n\n if (valid_commands.test(command)) {\n return true;\n } else {\n console.log(\"Unknown command: \" + command);\n r...
[ "0.7033517", "0.6786447", "0.6714409", "0.65853816", "0.6538311", "0.650227", "0.63899565", "0.6280926", "0.6191514", "0.60680556", "0.6061942", "0.60344607", "0.6002469", "0.5984184", "0.5972817", "0.5945315", "0.59247154", "0.58821195", "0.5809269", "0.57636255", "0.5706619...
0.80050147
0
Create an HTML element to display a pink heart and add it to the HTML page. Return: HTML element with containing the heart
function createHeart() { var span = document.createElement('span') span.style.position = 'absolute' span.style.color = '#f52887' span.style.opacity = '0' Util.addChildren(span, '\u2665') document.body.appendChild(span) return span }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heartHeartHeart() {\r\n document.body.appendChild(heartsHome);\r\n heartBlock(); \r\n }", "function createHeart(color) {\r\n const heart = document.createElement(\"div\");\r\n heart.className = \"heart\";\r\n heartsHome.appendChild(hea...
[ "0.76339394", "0.742686", "0.6561861", "0.6505662", "0.6476186", "0.6309439", "0.62926173", "0.6253584", "0.62520117", "0.6244221", "0.62009877", "0.6122166", "0.6114754", "0.60292", "0.6018961", "0.59802157", "0.59791756", "0.58925426", "0.58808786", "0.581332", "0.5811368",...
0.8188092
0
Display growing hearts all over the page.
function growingHearts() { var ox = 0 var oy = 80 var w = document.body.clientWidth - ox - 200 var h = document.body.clientHeight - oy - 200 var newInterval = Util.random(200, 2000) window.setInterval(function() { var heart = createHeart() heart.style.fontSize = '0%' heart.style.left = Util.random(ox, ox + w) + 'px' heart.style.top = Util.random(oy, oy + h) + 'px' var growInterval = Util.random(10, 50) var size = Util.random(200, 2000) var i = 0 var id = window.setInterval(function() { i += 20 heart.style.fontSize = i + '%' if (i < size / 2 ) { heart.style.opacity = '1' } else { heart.style.opacity = (1 - (2 * i - size) / size ) + '' } if (i >= size) { window.clearInterval(id) document.body.removeChild(heart) } }, growInterval) }, newInterval) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function risingHearts()\n {\n var ox = 0\n var oy = 80\n\n var w = document.body.clientWidth - ox - 200\n var h = document.body.clientHeight - oy - 200\n\n var newInterval = Util.random(200, 2000)\n\n window.setInterval(function()\n {\n var x = Util.ra...
[ "0.7028781", "0.69954866", "0.6911459", "0.67804664", "0.66451013", "0.66191816", "0.65603215", "0.6518552", "0.6307231", "0.6275858", "0.62382776", "0.61654353", "0.61185664", "0.60795075", "0.6067219", "0.59611285", "0.5948496", "0.59225917", "0.591076", "0.58987635", "0.58...
0.7471282
0
Display hearts rising across the page
function risingHearts() { var ox = 0 var oy = 80 var w = document.body.clientWidth - ox - 200 var h = document.body.clientHeight - oy - 200 var newInterval = Util.random(200, 2000) window.setInterval(function() { var x = Util.random(ox, ox + w) var y = Util.random(oy + h - 100, oy + h) var heart = createHeart() heart.style.fontSize = Util.random(100, 2000) + '%' heart.style.left = x + 'px' heart.style.top = y + 'px' var riseInterval = Util.random(10, 50) var rise = Util.random(h / 4, h) var drift = Util.random(-1, 1) var i = 0 var id = window.setInterval(function() { i++ if (Util.random(1, 100) <= 1) { drift = (drift == Util.random(-1, 1) ? 1 : 0) } x = Math.min(Math.max(x + drift, ox), ox + w) heart.style.left = x + 'px' heart.style.top = (y - i) + 'px' if (i < rise / 4) { heart.style.opacity = (4 * i / rise) + '' } else if (i < rise / 2 ) { heart.style.opacity = '1' } else { heart.style.opacity = (1 - (2 * i - rise) / rise ) + '' } if (i >= rise) { window.clearInterval(id) document.body.removeChild(heart) } }, riseInterval) }, newInterval) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countHearts() {\n\t\t$(\"#hearts\").html(\"\");\n\t\tfor (let i = 0; i < fullHearts; i++) {\n\t\t\t$(\"#hearts\").append('#');\n\t\t}\n\t\tfor (let j = 0; j < emptyHearts; j++) {\n\t\t\t$(\"#hearts\").append('*');\n\t\t}\n\n\t}", "function hearts() {\n ctx.font = \"20px Times New Roman\";\n //number o...
[ "0.68376845", "0.6826211", "0.67068046", "0.63591355", "0.63379914", "0.6292296", "0.628281", "0.6262421", "0.61563504", "0.60988206", "0.60862625", "0.6055171", "0.60303503", "0.602348", "0.601556", "0.5917671", "0.5907442", "0.5907421", "0.5824928", "0.5818143", "0.5815627"...
0.7237409
0
Return a message selected randomly or a message selected based on time. Return: Randomly selected message
function qtpiLetter() { var pLeft = '<p style="text-align: left">' var pCenter = '<p style="text-align: center">' var pRight = '<p style="text-align: right">' var pEnd = '</p>' var d = new Date() var meridiem = d.getHours() < 12 ? 'a.m.' : 'p.m.' if (d.getMinutes() == 14 && (d.getHours() == 3 || d.getHours() == 15)) { return pLeft + 'Cutie Pai,' + pEnd + pCenter + 'Happy <big style="font-family: serif">&pi;</big> ' + meridiem + pEnd + pRight + '&mdash; Susam' + pEnd } var letters = [ pLeft + 'Cutie Pai,' + pEnd + pCenter + 'I <span style="color: #f52887; font-size: 110%">&#x2764;' + '</span> U!' + pEnd + pRight + '&mdash; Susam' + pEnd, pLeft + 'Cutie Pai,' + pEnd + pCenter + 'I <span style="color: #f52887; font-size: 130%">&hearts;' + '</span> U!' + pEnd + pRight + '&mdash; Susam' + pEnd, pLeft + 'Cutie Pai,' + pEnd + pCenter + 'I love you! <span style="color: #f52887;">' + '<span style="font-size: 60%">&hearts;</span>' + '<span style="font-size: 100%">&hearts;</span></span>' + pEnd + pRight + '&mdash; Susam' + pEnd, pLeft + 'Cutie Pai,' + pEnd + pLeft + 'Your smile is the most beautiful thing in the ' + 'world to me. <big style="color: #a53364">&#x263a;</big>' + pEnd + pRight + '&mdash; Susam' + pEnd, pLeft + 'Cutie Pai,' + pEnd + pLeft + 'Do you know why I got the tiny wine glass for you at ' + 'Purple Haze?' + pEnd + pLeft + 'Because I can go to any length to see you smile.' + pEnd + pRight + '&mdash; Susam' + pEnd, pLeft + 'Cutie Pai,' + pEnd + pCenter + 'You make me want to be a better person.' + pEnd + pRight + '&mdash; Susam' + pEnd ] return Util.random(letters) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomMessage() {\n\tvar index = Math.floor(Math.random() * messages.length); \n\treturn messages[index];\n}", "function randomMessage() {\n return messages[(Math.random() * messages.length) | 0];\n}", "function getRandomMsg(messages) {\n const r = Math.floor(Math.random() * messages.length);\n ...
[ "0.7660767", "0.7650097", "0.6743472", "0.6567896", "0.64238006", "0.62507594", "0.62049794", "0.61180377", "0.6060958", "0.6056758", "0.60522383", "0.60224414", "0.60002166", "0.59629357", "0.5938398", "0.59235996", "0.5898373", "0.5867413", "0.5862219", "0.5828933", "0.5815...
0.0
-1
XXX: handle drafts in some other way. it's better to provide a control mechanism for filtering content based on metadata
draft() { return require.context( 'json!yaml-frontmatter!./drafts', false, /^\.\/.*\.md$/ ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gotContent(data){\r\n let page = data.query.pages; \r\n //console.log(page);\r\n let pageID = Object.keys(data.query.pages)[0];\r\n console.log(pageID);\r\n\r\n let content = page[pageID].revisions[0][\"*\"];\r\n startOfContentChar = \"'''\"\r\n star...
[ "0.57377356", "0.5270778", "0.526762", "0.5255141", "0.5207966", "0.51788485", "0.51779246", "0.51768345", "0.5156462", "0.5125829", "0.5097602", "0.506294", "0.5008472", "0.49900922", "0.4970971", "0.49272928", "0.49175787", "0.49066842", "0.488469", "0.48751068", "0.4848656...
0.53065634
1
init data struct node
constructor(item = null) { this.item = item; this.next = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init(node) {\n const properties = node.props;\n const eid = properties.id;\n const data_node = {\n eid,\n type: node.type,\n name: properties.name,\n children: reduce(properties.children, (acc, child) => { if (is.not.string(child)) {\n ...
[ "0.6700351", "0.66975415", "0.644836", "0.63927436", "0.63778853", "0.6375047", "0.63728285", "0.63598233", "0.6344904", "0.63162774", "0.63127595", "0.6310561", "0.6282381", "0.62780637", "0.6262965", "0.62441224", "0.62425417", "0.623363", "0.623363", "0.6227975", "0.622422...
0.0
-1
persist current state.contacts should move this and have reducers resync
function _saveContacts(c){ Actions.saveContacts(c); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "saveContact(oldContactId, newName, newEmail, newNumber) {\n const {contacts} = this.state\n const foundContact = _.find(contacts, contact => contact.id === oldContactId);\n foundContact.name = newName;\n foundContact.email = newEmail;\n foundContact.number = newNumber;\n this.setState({\n co...
[ "0.68885595", "0.6776804", "0.66792345", "0.6582764", "0.6582764", "0.6346726", "0.6301269", "0.61896855", "0.61066717", "0.6092939", "0.60800844", "0.6060277", "0.5969787", "0.59592855", "0.5931886", "0.58767194", "0.5866361", "0.58570933", "0.58174247", "0.5771048", "0.5770...
0.5941054
14
Creates a new LibraryAtlas
function LibraryAtlas(uid, shapePadding) { if (typeof shapePadding === "undefined") { shapePadding = 4; } this.uid = uid; this.shapePadding = shapePadding; /** * Contains the blocks used in the Binary Packing * @type {Array} */ this.blocks = []; LibraryAtlas.LIBS[uid] = this; // Create the Canvas&Context this.canvas = new Canvas(); this.context = this.canvas.getContext('2d'); // create css template this.cssCompiledTemplate = handlebars.compile(fs.readFileSync(__dirname + '/../templates/LibrarySpriteSheet.tpl', 'utf8'), { noEscape: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createLibrary(name) {\n var denverLibrary = {\n name: name,\n shelves: {\n fantasy: [],\n fiction: [],\n nonFiction: []\n }\n }\n return denverLibrary;\n}", "function NewLibrary() {\n//this.property = value\n this.books = [];\n this.currentCallNumber = 0;\n}", "async libra...
[ "0.64622486", "0.5337491", "0.5260609", "0.525528", "0.52491814", "0.516564", "0.51183516", "0.5086852", "0.506477", "0.5023035", "0.50163406", "0.50099206", "0.50010246", "0.4973214", "0.49606636", "0.49443272", "0.49343997", "0.4902602", "0.48722452", "0.48701003", "0.48535...
0.66683453
0
fecthing notes when the first entry
componentDidMount() { this.mounted = true; if (this.props.notes && this.props.notes.length === 0 && this.mounted) this.getNotes({ start: 0, loadAmount: 20 }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function enterNote() {\n note = {}\n if (checkIfInputIsCorrect()) {\n // create note\n note.InputOfNote = txtArea.value;\n note.dateOfNote = dateEnterded;\n note.timeOfNote = timeEnterded;\n note.noteNum = noteNumber;\n note.secondsComp = dateEnterdedToCompare;\n ...
[ "0.6265579", "0.6251752", "0.6212055", "0.61438537", "0.6026429", "0.6023204", "0.6003627", "0.59873223", "0.5983173", "0.5974314", "0.5947799", "0.5882629", "0.5835221", "0.58303744", "0.5826249", "0.582183", "0.58167374", "0.5805337", "0.57676864", "0.573684", "0.5713743", ...
0.0
-1
update the percent of the scroll indicator bar when finishing fetch
componentDidUpdate(prevProps, prevStates) { if ( this.scrollerDiv.current && this.scrollerDiv.current.scrollHeight !== prevStates.scrollHeight ) { this.setScrolled(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleProgressUpdate() {\n const { body } = document;\n const html = document.documentElement;\n const docHeight = Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight\n );\n const viewportHeight = documen...
[ "0.7429627", "0.726611", "0.71308297", "0.70691985", "0.689935", "0.6895333", "0.6849445", "0.68263537", "0.68130344", "0.678793", "0.6771746", "0.67644036", "0.67606825", "0.6705703", "0.670061", "0.66948634", "0.6657176", "0.66566694", "0.6637112", "0.6627516", "0.66006184"...
0.0
-1
cancel fethcing when changing component
componentWillUnmount() { this.mounted = false; this.getNotes = null; this.props.notesFetchCancelled(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cancel() {\n this.state.cancelRender = true;\n }", "cancel() {\n this._revertInputValueToValue(); // In the next _detectAndDispatchChange() call, the change detection should not pass\n\n\n this._lastCommittedValue = this.value;\n this.close();\n }", "function cancel() {\n\t\t\tfocusedControl.fire...
[ "0.71016383", "0.6754562", "0.66169834", "0.66169834", "0.66169834", "0.65770406", "0.6574968", "0.6495116", "0.6495116", "0.64642906", "0.6447245", "0.6446158", "0.6440962", "0.6440013", "0.64304316", "0.64190793", "0.63867587", "0.63772494", "0.6373597", "0.6367131", "0.635...
0.0
-1
in function 1 in function 2
function func1() { console.log('in function1'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fun1(){} //toda a função de js retorna alguma coisa", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "function fun1( /*parametros opcionais*/ ){ /*retorno opcional*/ }", "function fun1 ( ) {}", "function fun1( ) { }", "function fun1(){}", "function fun1(){}", "...
[ "0.6685216", "0.64166355", "0.64166355", "0.6346534", "0.6324493", "0.62864715", "0.62618065", "0.62618065", "0.62493503", "0.62493503", "0.6214583", "0.6214583", "0.6214583", "0.6214583", "0.6214583", "0.6214583", "0.6214583", "0.6214583", "0.6105682", "0.6081066", "0.606649...
0.5809008
36
This bit of disgustingness is to deal with a bug (28/11/2017) in the Twitch JS Helper. Normally you would call listen for the whisper channel inside onAuthorized when you get your opaque ID, however, calling twitch.listen inside onAuthorise causes the listen function to be registered more than one time for some reason. So we wait for onAuth to be called and then register the listener here.
function whisperHack() { if (!firstTimeOnly) { // Listen to this viewer's private PubSub whisper channel twitch.listen('whisper-'+latestAuth.userId, (target, type, msg) => { // console.log("New Twitch PubSub whisper:", msg); }); } else { setTimeout(whisperHack, 1000); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_registerExternalAuthListeners () {\n this.migration = caller('migration', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.authenticate = caller('authenticate', {postMessage: window.parent.postMessage.bind(window.parent)})\n this.createLink = caller('createLink', {postMessage: window....
[ "0.61958736", "0.58636725", "0.576607", "0.57518506", "0.5557802", "0.5553211", "0.5529361", "0.5524213", "0.55090606", "0.54507405", "0.5442383", "0.5430207", "0.5401749", "0.5368009", "0.5361097", "0.53551096", "0.53515387", "0.53437555", "0.5279312", "0.5274094", "0.527357...
0.6062984
1
Worker that checks the sentiment of comments every 5 seconds
function startWorker(){ (function worker() { var channel_id = getGlobalChannelName(); // console.log("channel_id", channel_id); $.ajax({ type: "POST", url: "https://chat-snitcher-ebs.herokuapp.com/collect_chat_analysis", contentType: 'application/json', data: JSON.stringify({ channel_Id: channel_id}), success: function(data) { // on success write somethibg to HTML // { "average_sentiment": 0.27, "positive_sentiment_percentage":24, .... } var average_sentiment = data.average_sentiment; var positive_sentiment_percentage = data.positive_sentiment_percentage; var negative_sentiment_percentage = data.negative_sentiment_percentage; var neutral_sentiment_percentage = data.neutral_sentiment_percentage; // console.log("average sentiment", average_sentiment); // console.log("sentiment percentages, neg, positive, neutra;", negative_sentiment_percentage, positive_sentiment_percentage, neutral_sentiment_percentage); if (average_sentiment > 0.60){ var mood = "Awesome!!"; var img = document.createElement("IMG"); img.src = "images/awesome.gif"; } else if (average_sentiment >= 0.23 && average_sentiment <= 0.60 ){ mood = "Positive"; img = document.createElement("IMG"); img.src = "images/happy.gif"; } else if (average_sentiment > -0.38 && average_sentiment< 0.22){ mood = "Neutral"; img = document.createElement("IMG"); img.src = "images/neutral.gif"; } else if (average_sentiment <= -0.38 && average_sentiment >= -0.64){ mood = "Miffed"; img = document.createElement("IMG"); img.src = "images/miffed.gif"; } else if (average_sentiment < -0.64){ mood = "Bad"; img = document.createElement("IMG"); img.src = "images/bad.gif"; } else{ mood = "Error"+ average_sentiment ; } // assign values to divs var div = document.querySelector("#viewer_sentiment"); var pos_div = document.querySelector("#pos_percentage"); var neut_div = document.querySelector("#neut_percentage"); var neg_div = document.querySelector("#neg_percentage"); div.innerHTML = "Your chat room is feeling <mark>"+ mood + "</mark>"; pos_div.innerHTML = "Positive " + positive_sentiment_percentage + "%"; neg_div.innerHTML = "Negative " + negative_sentiment_percentage + "%"; neut_div.innerHTML = "Neutral " + neutral_sentiment_percentage + "%"; var image_div = document.querySelector("#imageDiv1"); image_div.innerHTML ='<img id="sentiment_image" src=' + img.src + ' class="img-thumbnail"></img>'; // document.getElementById('imageDiv').style.backgroundImage = img.src; }, complete: function() { // run every 10 seconds setTimeout(worker, 10000); } }); })(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function main(){\r\n const botSubmissions = await r.getUser('autolovepon').getSubmissions()\r\n botSubmissions.forEach(function(submission){\r\n parseThread(submission)\r\n\r\n //if pass certain comment threshold then pass to download function\r\n //or compare with a list of anime ...
[ "0.6835597", "0.5810288", "0.5720304", "0.57178414", "0.55585927", "0.5508826", "0.5481348", "0.54404646", "0.5433081", "0.54156774", "0.5384332", "0.5373829", "0.5351049", "0.53434616", "0.5324132", "0.52862245", "0.5258912", "0.52586526", "0.52499324", "0.52377635", "0.5236...
0.59157854
1
Collect streamers channelId from twitch and send to backend where it will be converted to the streamer name. From backend analysis of chat room will stop.
function stopLogging(auth){ var channel_id = auth.channelId.toString() $.ajax({ type: "POST", url: "https://chat-snitcher-ebs.herokuapp.com/collect_channel_name", contentType: 'application/json', data: JSON.stringify({ channel_Id: channel_id}), success: function(data) { // console.log('message', data.message); }, error: function(jqXHR, textStatus, err) { alert('text status '+textStatus+', err '+err) } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getTwitchChannels() {\n\n try {\n \n let dbResponse, twitchNameArray;\n\n dbResponse = await db.announcerGetUniqueTwitchNames();\n twitchNameArray = dbResponse.map(element => {\n return element.twitch_channel_name;\n });\n \n return TWITCH.getStreamersFromArray(twitchNameA...
[ "0.6181805", "0.6063626", "0.5829279", "0.575058", "0.56496674", "0.5610654", "0.5493258", "0.5431261", "0.5425872", "0.54246515", "0.5409868", "0.540671", "0.5364838", "0.5358927", "0.5321385", "0.5294745", "0.52865297", "0.5280389", "0.5270509", "0.5256866", "0.52472115", ...
0.0
-1
optional, speeds up future uses
function urlParam(name) { var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); return results ? results[1] : ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "function _____SHARED_f...
[ "0.6465426", "0.59911895", "0.59265673", "0.5879232", "0.5751889", "0.57515067", "0.5597826", "0.55638534", "0.5502018", "0.54914093", "0.540573", "0.5384642", "0.5363471", "0.5294214", "0.5280769", "0.52594864", "0.52482", "0.5226643", "0.52142966", "0.518709", "0.5170638", ...
0.0
-1
Finds and selects the first option labelled 'isDefault' from the item object
getDefaultItemOption(item) { item.options.some(option => ( option.isDefault ? !this.setState({ currentOption: option, }) : false )); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setDefaultSelectedOption() {\n var _a, _b;\n\n this.selectedIndex = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.findIndex(el => el.defaultSelected)) !== null && _b !== void 0 ? _b : -1;\n }", "function select_default_menu_item()\r\n{\r\n\tmenu_item_selected(document.getElementById('m...
[ "0.66718537", "0.6311194", "0.6039267", "0.6000806", "0.5955329", "0.59164506", "0.5895007", "0.58630586", "0.57978356", "0.5726508", "0.5656774", "0.56539035", "0.5653307", "0.5616319", "0.5609541", "0.5600866", "0.55922085", "0.55840874", "0.55624026", "0.55548036", "0.5553...
0.7483216
0
this component makes it so that it activates when the component first mounts
componentWillMount() { //string literal => having a variable with a part of a string axios.get(`${apibase}/posts?categories=4`).then(data => { this.setState({ posts: { data: data.data, loading: false } }) }) axios.get(`${apibase}/users`).then(data => { this.setState({ authors: { data: data.data, loading: false } }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n this.componentLoaded = true;\n }", "componenetWillMount() { }", "componentDidMount() {\n\t\tthis.startup();\n\t}", "static activate() {\n \n }", "componenetDidMount() { }", "createdCallback() {\n\t // component will mount only if part of the active doc...
[ "0.6792422", "0.67576414", "0.66770416", "0.6661768", "0.6653347", "0.6596883", "0.6535452", "0.64971936", "0.6484291", "0.6475996", "0.6475131", "0.6460934", "0.64525694", "0.64525694", "0.6447056", "0.6414914", "0.63829505", "0.6374859", "0.6374859", "0.6374859", "0.6350301...
0.0
-1
busca el valor de apertura (de la propiedad OPEN) de cada dia (propiedad DTYYYYMMDD)(el primer valor de apertura de cada dia)
function buscarAperturaDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { arr.push(array[j].OPEN); break; } } } } //console.log('Apertura:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dadosDiaAtual(diasMonitorados) {\n\n\tvar posDiaAtual = diasMonitorados.length - 1;\n\tvar dadosDiaAtual = diasMonitorados[posDiaAtual];\n\n\treturn dadosDiaAtual;\n}", "function diaClave(propie){\n\n\tfor(i=0; i< propie.length; i++){\n\t\tvar info = propie[i].properties;\t\n\n\t\tconst latitud = info.L...
[ "0.5676619", "0.55443245", "0.5450236", "0.5415511", "0.53871185", "0.5380379", "0.53533", "0.53489166", "0.5307834", "0.53009665", "0.52848023", "0.52716637", "0.52353776", "0.5230704", "0.5217601", "0.5216233", "0.5204208", "0.51924366", "0.5186632", "0.5181951", "0.5172368...
0.58460104
0
busca el valor de cierre(de la propiedad CLOSE) de cada dia (propiedad DTYYYYMMDD)(el ultimo valor de cierre de cada dia)
function buscarCierreDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; let res; if (day != date) { day = date; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { res = array[j].CLOSE; } } arr.push(res); } } //console.log('Cierre:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function eq_tempo(){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011.\n // funzione per il calcolo del valore dell'equazione del tempo per la data odierna.\n // algoritmo di P.D. SMITH.\n \nvar njd=calcola_jd(); // giorno giuliano...
[ "0.60623664", "0.6034874", "0.5954636", "0.59204257", "0.5882735", "0.5829991", "0.58076704", "0.5793236", "0.5781888", "0.5752992", "0.5728651", "0.5724688", "0.5695152", "0.5677904", "0.5625867", "0.5623611", "0.5610476", "0.5606206", "0.55969435", "0.5564013", "0.54912454"...
0.58754873
5
busca el valor de maximo (de la propiedad HIGH) de cada dia (propiedad DTYYYYMMDD)(el valor de maximo de cada dia)
function buscarMaxDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; let res; let contador = 0; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { if (contador === 0) { res = array[j].HIGH; } else { res = Math.max(res, array[j].HIGH); } contador++; } } arr.push(res); } } // console.log('Maximos:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getMax() {\n var max = Math.max.apply(null, config.values);\n max += 10 - max % 10;\n return max;\n console.log(max);\n }", "function setMax() {\n var cd = curDay();\n var input = document.getElementById('date');\n input.setAttribute(\"max\", this.value);\n i...
[ "0.68274987", "0.67250717", "0.66997606", "0.6594341", "0.65138334", "0.65106434", "0.64073956", "0.6382986", "0.6377778", "0.6359372", "0.63428384", "0.6298422", "0.6285514", "0.6256145", "0.6250908", "0.6232988", "0.6216029", "0.62050897", "0.6192077", "0.6187974", "0.61835...
0.6782513
1
busca el valor de minimo (de la propiedad LOW) de cada dia (propiedad DTYYYYMMDD)(el valor de minimo de cada dia)
function buscarMinDia(array) { let day; let arr = []; for (let i = 0; i < array.length; i++) { let date = array[i].DTYYYYMMDD; if (day != date) { day = date; let res; let contador = 0; for (let j = 0; j < array.length; j++) { if (array[j].DTYYYYMMDD === day) { if (contador === 0) { res = array[j].LOW; } else { res = Math.min(res, array[j].LOW); } contador++; } } arr.push(res); } } //console.log('Minimos:', arr) return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function milisegundosToMinutos(milisegundos) {\n let minutos = milisegundos / 60000\n return minutos\n}", "function sumaDuracion(){\n \n var sumHrs = parseInt(0), sumMin = parseInt(0);\n var auxHrs = parseInt(0), auxMin = parseInt(0);\n var totalHrs = parseInt(0), totalMin, i=1, ni=0;\n \n ...
[ "0.6305875", "0.6247586", "0.61750144", "0.60922945", "0.6088371", "0.6011467", "0.5953956", "0.59032714", "0.58966565", "0.5886316", "0.58637834", "0.5840592", "0.5825569", "0.5822594", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.58093446", "0.58...
0.6517961
0
crea un array con cuatro array dentro uno por cada propirad
function obtenerValoresPorDias(array) { let res; let dia = diaMes(array) let apertura = buscarAperturaDia(array); let max = buscarMaxDia(array); let min = buscarMinDia(array); let cierre = buscarCierreDia(array); res = [dia, apertura, max, min, cierre]; return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inicializarArrayResultados() {\r\n for(var i=1;i<=totalPreguntas;i++) {\r\n resultadoEncuesta[\"p\"+i+\"-alt\"]=[0,0,0,0];\r\n }\r\n}", "function crearniveles() {\n let niveles = [];\n let fila = 0;\n let columna = 0;\n niveles[0] = [];\n for (let c = 1; c...
[ "0.6856106", "0.6682753", "0.6621137", "0.6497848", "0.6456618", "0.64493555", "0.6391941", "0.6388621", "0.62940025", "0.62698966", "0.6255932", "0.6253484", "0.6247512", "0.6198426", "0.61660445", "0.61577266", "0.61558557", "0.61294526", "0.61233866", "0.61194706", "0.6078...
0.0
-1
end of key press control custom way to get id of a element
function $id(id) { return document.getElementById(id); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function btnDown(){\r\n\tlastBtn = this.id;\r\n\trokupost(\"keydown\",this.id);\r\n}", "handleKeyDown(kCode) {\n console.log(\"handleKeyDown \" + this.id + \" \" + kCode)\n }", "get keyIdInput() {\n return this._keyId;\n }", "function showSavedLetter(){\n var index = event.target.id[6];\n...
[ "0.6286585", "0.62302446", "0.60026014", "0.58470315", "0.580719", "0.580719", "0.580719", "0.5782618", "0.575299", "0.56821084", "0.5671124", "0.56492555", "0.56473863", "0.56473863", "0.56405747", "0.5626527", "0.5625179", "0.5625179", "0.5625179", "0.5625179", "0.5625179",...
0.0
-1
End of ajax handles the selecting and loading the quadrants,locations and activity content
function locload(quad) { var loc=document.getElementById("loc"); if(document.getElementById("quadrant").value!="null") loc.disabled=false; else loc.disabled=true; loc.options.length=1; for(var i=0;i<quad.length;i++) loc.options[loc.options.length]= new Option(quad[i][0], quad[i][3], false, false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _finishedLoading() {\n if ( that.lastFunction ){\n that.lastFunction();\n that.lastFunction = false;\n }\n that.ajaxBusy = false;\n\n // make sure the search menu is completed in error cases\n ...
[ "0.6221699", "0.60419905", "0.5939407", "0.575101", "0.57254285", "0.5719794", "0.5707946", "0.56172913", "0.56141114", "0.56125903", "0.5612564", "0.5610286", "0.5551636", "0.55483323", "0.55476314", "0.55326897", "0.55158186", "0.55039513", "0.54837465", "0.5482504", "0.547...
0.0
-1
makes the content ready so that it can be sent to the server
function up_db(c) { secondlayer(true); var locid=$id("loc").value; keypress(false); var t2={}; t2['a_type']=c.name; var find_radio=[]; for(var i=0;i<c.length;i++) { if(c[i].name!="" && !c[i].disabled && (c[i].getAttribute("c_req")=="true" || c[i].getAttribute("c_req")=="false") ) { if(c[i].type=="radio") { if(find_radio.indexOf(c[i].name)<0) find_radio.push(c[i].name); } else {t2[c[i].name]=c[i].value;} } } for(var i=0;i<find_radio.length;i++) { var s=c[find_radio[i]]; for (x in s) if(s[x].checked) { t2[find_radio[i]]=s[x].value; } } t2['locid']=locid; secondlayer(true,"Uploading Data Please Wait <br>"); t2['file']=new Array(); t2['url']=new Array(); for(var i=0;i<c_alldata.length;i++) { if(c_alldata[i].c_type=="file") { UploadFile(c_alldata[i]); var ttx=new Object(); ttx.name=c_alldata[i].c_name; ttx.title=c_alldata[i].c_title; ttx.type=c_alldata[i].ext; t2['file'].push(ttx); } else { var ttx=new Object(); ttx.name=c_alldata[i].c_url; ttx.title=c_alldata[i].c_title; ttx.type=c_alldata[i].ext; t2['url'].push(ttx); t2[c_alldata[i].c_disp.id]=c_alldata[i].c_type; } } track.send=JSON.stringify(t2); if(c_alldata.length==0||t2['type']=="video"||t2['img']=='imageurl') track.finish(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ready() {\n super.ready();\n const that = this;\n\n that._template = that._handleTemplate();\n\n if (that._template.hasBindings) {\n that.innerHTML = that._processTemplate();\n }\n else if (that.itemTemplate) {\n that.innerHTML = that._template.conten...
[ "0.6192604", "0.6152417", "0.6081952", "0.6045814", "0.5973004", "0.5971583", "0.59261626", "0.5892219", "0.5872687", "0.5861844", "0.5820321", "0.5819373", "0.57933855", "0.5791685", "0.57801795", "0.5752454", "0.5742327", "0.5722428", "0.5707562", "0.5705178", "0.5682829", ...
0.0
-1
form content is sent using this function to the server
function ajax_post(where,caption,content) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { secondlayer(true,"Form content Uploaded "); //alert(xmlhttp.response); } } xmlhttp.open("POST",where,true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(caption+"="+content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitContent()\n{\n\tvar result = mainForm.get(function(item, key, value) {\n\t\tvar args = $(item).data(\"irform\");\n\t\t/* Some items should be removed if they are present */\n\t\tfor (var id in {\"name\":1, \"onchange\":1, \"disabled\":1, \"ignore\":1, \"validate\":1, \"options\":1}) {\n\t\t\tif (typ...
[ "0.6838852", "0.664906", "0.6589881", "0.6575015", "0.6412511", "0.6399322", "0.6383439", "0.63556594", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6347237", "0.6342083", "0.6342083", "0.6339719", "0.6339719", "...
0.63044804
27
var c_data="null"; var c_url="null"; var c_fu="null";
function m_removeall() { while(c_alldata.length>0) { c_alldata[c_alldata.length-1].c_disp.innerHTML=""; c_alldata.pop(); } ref_thumb(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function HTML_AJAX_Serialize_Null() {}", "function getData(requestUrl) {\n \n\n}", "function initializeStatefulVariables() {\n postAction = '';\n postArgument = 'sig_response';\n host = undefined;\n sigRequest = undefined;\n duoSig = undefined;\n appSig = undefined;\n ...
[ "0.5797142", "0.57417", "0.5704281", "0.560942", "0.55760556", "0.5551452", "0.5551452", "0.5551452", "0.5551452", "0.55450845", "0.55106324", "0.5467482", "0.5378713", "0.5364637", "0.536413", "0.5355956", "0.5350828", "0.5339574", "0.5302566", "0.52872974", "0.5278333", "...
0.0
-1
displays the dropped file
function ParseFile(file,dest,dis) { // display an image if (file.type.indexOf("image") == 0) { var reader = new FileReader(); reader.onload = function(e) { if(dis==0 || pars_glob==dis) { if(file.size <= $id("MAX_FILE_SIZE").value) { m_add(file,e.target.result,"file",dest,true);Output('<img src="' + e.target.result + '" />',dest);} else { pars_sizeE++; ref_thumb(); } if(pars_sizeE>0) alert(pars_sizeE+" files has not been accepted because of the file size is greater than 1 mb"); } else if(file.size <= $id("MAX_FILE_SIZE").value) m_add(file,e.target.result,"file",dest,false); else pars_sizeE++; pars_glob++; } reader.readAsDataURL(file); } else { alert("please upload only images"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drop(e) {\n e.stopPropagation();\n e.preventDefault();\n displayFile(e.dataTransfer.files);\n}", "function _handleDrop(e){\n\n var files = e.originalEvent.dataTransfer.files,\n docPath =currentDoc.file._parentPath,\n relativeFilename;\n\n if(files && files.length){...
[ "0.72894186", "0.727713", "0.7140937", "0.7077785", "0.69156796", "0.6882988", "0.68160087", "0.67447686", "0.6662817", "0.6625142", "0.65877557", "0.6571451", "0.6544129", "0.6541286", "0.6481612", "0.64540297", "0.64540064", "0.6381019", "0.63696617", "0.63520384", "0.63464...
0.0
-1
Creates an instance of Updater.
constructor(messenger) { // Initialize. this.autoUpdater = autoUpdater this.messenger = messenger // Wire events. // @see https://www.electron.build/auto-update console.log('asdf') this.autoUpdater.on('checking-for-update', (e, i) => { this.messenger.info('Checking for update.') }) this.autoUpdater.on('download-progress', (e, i) => { // tslint:disable-next-line:no-console console.log('autoUpdater: download-progress: ', e, i) }) this.autoUpdater.on('update-available', (e, i) => { // tslint:disable-next-line:no-console console.log('autoUpdater: update-available: ', e, i) this.messenger.info( 'A new version is available. Downloading in background.' ) }) this.autoUpdater.on('update-not-available', (e, i) => { // tslint:disable-next-line:no-console console.log('autoUpdater: update-not-available: ', e, i) this.messenger.info('Your application is up to date.') }) this.autoUpdater.on('update-downloaded', (e, i) => { this.messenger.info('An update was downloaded.') this.quitAndInstall() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateFactory(model){\n new update(model)\n}", "promoteUpdater() {}", "initialize(){this._saveInstanceProperties();// ensures first update will be caught by an early access of\n// `updateComplete`\nthis._requestUpdate()}", "update(updater) {\n if (typeof updater === \"function\") {\n this...
[ "0.5641583", "0.4933229", "0.48488805", "0.48151898", "0.4755564", "0.47414222", "0.46838057", "0.46585783", "0.45369828", "0.45264116", "0.45264116", "0.44620517", "0.44413695", "0.44035208", "0.4378131", "0.43774065", "0.43724427", "0.43699595", "0.43699595", "0.43699595", ...
0.0
-1
Quits the application and installs the update.
quitAndInstall() { setTimeout(() => { this.autoUpdater.quitAndInstall() }, 5000) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async scheduleInstallOnQuit() {\n this.restart = false;\n await this._rememberInstallAttempt();\n this._setupExitHook();\n }", "function updateApplication() {\r\n\t\t\t\r\n\t\t\ttry{\r\n\t\t\t\tvar updater = new air.Updater();\r\n\t\t\t\tupdater.update(newAppFile, currentVersion);\r\n\t\t...
[ "0.6529961", "0.63500094", "0.6310466", "0.62678844", "0.61116886", "0.59876883", "0.59263605", "0.5832421", "0.5810761", "0.5805487", "0.58005667", "0.5796299", "0.576113", "0.5694946", "0.56922966", "0.55574274", "0.5548117", "0.552466", "0.5483094", "0.5480218", "0.5464473...
0.63585895
1
This is used to load cart values that are stored after refreshing the page
function onLoadCartNumbers() { let productNum = localStorage.getItem('cartNum'); if(productNum) { document.querySelector('.cart span').textContent = productNum; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadCart() {\n productsInCart = JSON.parse(sessionStorage.getItem('shoppingCart'));\n }", "function loadCart(){\n cart = JSON.parse(sessionStorage.getItem('revonicCart')); // fetching original object items using JSON parse. \n }", "function populateCartOnLoad() {\n let cartI...
[ "0.81625164", "0.8090929", "0.7938621", "0.7830751", "0.7762661", "0.77029717", "0.75776607", "0.7565405", "0.753374", "0.74773914", "0.741326", "0.7387352", "0.73023784", "0.7295141", "0.7268452", "0.7234852", "0.723237", "0.7223062", "0.72082615", "0.7201361", "0.7199485", ...
0.7241475
15
This is used to store the amount in a cart
function cartNum(products) { let productNum = localStorage.getItem('cartNum'); productNum = parseInt(productNum); if(productNum) { localStorage.setItem('cartNum', productNum + 1); document.querySelector('.cart span').textContent = productNum + 1; } else { localStorage.setItem('cartNum', 1); document.querySelector('.cart span').textContent = 1; } setItems(products); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateQuantity() {\n let prod = this.closest(\".cart-item\");\n let prod_cost = prod.children[2].innerText.slice(1);\n prod.children[4].innerText = `$${Number(prod_cost)*this.value}`\n\n let z = JSON.parse(localStorage.getItem(\"CartItem\"));\n arr = [];\n for (let k = 0; k < Object.keys(z).length; ...
[ "0.7134825", "0.6897594", "0.6897404", "0.68962795", "0.6887796", "0.682068", "0.68079644", "0.6801724", "0.6786111", "0.67719436", "0.67669487", "0.67305833", "0.67223895", "0.67132324", "0.67067385", "0.66997266", "0.6685919", "0.6678676", "0.6675621", "0.6659142", "0.66518...
0.0
-1
This is used to set which items are being added to the cart
function setItems(products) { let cartItems = localStorage.getItem('productsInCart'); cartItems = JSON.parse(cartItems); if(cartItems != null) { if(cartItems[products.tag] == undefined){ cartItems = { ...cartItems, [products.tag]: products } } cartItems[products.tag].inCart += 1; } else { products.inCart = 1; cartItems = { [products.tag]: products } } localStorage.setItem("productsInCart", JSON.stringify(cartItems)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addItemsToCart() {\n\n Model.addItemsToCart(this.currentItems);\n }", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n let selectedItem = event.target.items.value;\n console.log(selectedItem);\n // TODO: get the quantity\n let quantity = event.target.quanti...
[ "0.7762722", "0.7326693", "0.7265426", "0.7265426", "0.72461456", "0.71997476", "0.7058776", "0.69982564", "0.69665176", "0.6965611", "0.69420576", "0.68941665", "0.6893985", "0.68878645", "0.6875005", "0.6870788", "0.6860676", "0.6849292", "0.68060195", "0.67960274", "0.6791...
0.68060637
18
Tallies up the total cost of items
function totalCost(products) { console.log("The product price is", products.price); let cartCost = localStorage.getItem('totalCost'); console.log("my cartCost is", cartCost); if(cartCost != null) { cartCost = parseInt(cartCost); localStorage.setItem("totalCost", cartCost + products.price); } else { localStorage.setItem("totalCost", products.price); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTotalCost() {\n return this.transactions.map(t => t.cost).reduce((acc, value) => acc + value, 0);\n }", "getTotalSelectedItemsCost() {\n const totalCost = this.itemModelList.data.reduce((prevVal, item) => {\n if (!item.isChecked) {\n return prevVal;\n }\n\...
[ "0.7797716", "0.7496572", "0.7408303", "0.72762775", "0.7254776", "0.7243303", "0.71155304", "0.7102601", "0.70956385", "0.705537", "0.7043262", "0.7038848", "0.7028002", "0.7020986", "0.70182633", "0.6992299", "0.6985358", "0.6973873", "0.69628024", "0.6942091", "0.6939054",...
0.0
-1
Displays the cart in the cart page
function displayCart() { let cartItems = localStorage.getItem("productsInCart"); cartItems = JSON.parse(cartItems); let productContainer = document.querySelector(".products"); if(cartItems && productContainer) { productContainer.innerHTML = ''; Object.values(cartItems).map(item => { productContainer.innerHTML += ` <div class="product"> <ion-icon name="close-circle"></ion-icon> <img src="./images/${item.tag}.jpg"> ${item.name} </div> <div class="price"> Price per: ${item.price} </div> <div class="quantity"> Amount: ${item.inCart} </div> <div class="total"> Total: ${item.inCart * item.price} </div> ` }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "function renderCart() {\n loadCart();\n clearCart();\n showCart();\n}", "fun...
[ "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.8199349", "0.81431025", "0.8133412", "0.80924135", "0.8089521", ...
0.6980044
38
drag_util.js Utility functions for YUI darg and drop applications ///////////////////////////////////// Dependencies from YUI yahoomin.js dommin.js eventmin.js //////////////////// //////////////////////////// selectMultiple Event Handeler Uses Shift or Cmd/Ctrl click to select multiple items in a supplied container element ///// Variables //////////// ev JS Event use_parent Bool apply selected class to the clicked element or it's parent (e.g. for tables event is fired by td but selected class is applied to tr);
function selectMultiple(ev, use_parent){ var Dom = YAHOO.util.Dom, Event = YAHOO.util.Event; var dd = null; var tar = Event.getTarget(ev); if(use_parent){ tar = tar.parentNode; } var kids = tar.parentNode.getElementsByTagName(tar.tagName); //Event.stopEvent(ev); //If the shift key is pressed, add it to the list if (ev.metaKey || ev.ctrlKey) { if (tar.className.search(/selected/) > -1) { Dom.removeClass(tar, 'selected'); } else { Dom.addClass(tar, 'selected'); } }else if(ev.shiftKey) { var sel = false; for (var i = 0 ; i < kids.length ; i++){ if(!sel && kids.item(i).className.search(/selected/) > -1){ sel = true; } if(sel){ Dom.addClass(kids.item(i), 'selected'); } if(kids.item(i) == tar){ // shift clicked elem reached if(!sel){ //selection either below or no other row selected for (var ii = i ; ii < kids.length ; ii++){ if(!sel && kids.item(ii).className.search(/selected/) > -1){ sel = true; }else if(sel && kids.item(ii).className.search(/selected/) == -1){ break; } Dom.addClass(kids.item(ii), 'selected'); } if(!sel){ //no second row selected for (var ii = i + 1 ; i < kids.length ; i++){ Dom.removeClass(kids.item(ii), 'selected'); } } } break; } } }else { for (var i = 0 ; i < kids.length ; i++){ kids.item(i).className = ''; } Dom.addClass(tar, 'selected'); } //clear any highlighted text from the defualt shift-click functionality clearSelection(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initializeMultipleSelectBoxMouseEvent($container) {\r\n\t\tvar $document = $(document);\r\n\t\t/* process container event */\r\n\t\t$container.bind(\"mousedown.\" + PLUGIN_NAMESPACE, function(e) {\r\n\t\t\t/* disable text selection */\r\n\t\t\te.preventDefault();\r\n\t\t\t/* starting row */\r\n\t\t\tvar t...
[ "0.64923054", "0.64745873", "0.6313913", "0.62336046", "0.5861946", "0.5806698", "0.57896096", "0.5698621", "0.5660796", "0.56062526", "0.55689436", "0.5549231", "0.5530512", "0.55174196", "0.549765", "0.546832", "0.5462681", "0.5454696", "0.5427804", "0.5427804", "0.5427804"...
0.77628446
0
Gets the contents of a file.
read(file) { return this[FILES][file] || null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFileContents(filename){\r\n\t\r\n\tvar contents;\r\n\tcontents = fs.readFileSync(filename);\r\n\treturn contents;\r\n}", "function getContents(file) {\n\t// Ensure that the file's name is not null.\n\tif(file === null) {\n\t\tself.fail(\"The File object is null.\");\n\t}\n\tif(! file.exists()) {\n\t\...
[ "0.790714", "0.77232456", "0.75610566", "0.7484739", "0.7429082", "0.7402849", "0.70870584", "0.70229805", "0.69181293", "0.68460333", "0.68416864", "0.67938757", "0.67254823", "0.6645344", "0.6645003", "0.66349036", "0.66026247", "0.6600203", "0.65757376", "0.64575833", "0.6...
0.0
-1
Sets the contents of a file.
write(file, contents) { // validate input if (!isString(file)) throw new TypeError('Expected file to be a string; got: ' + typeof file); if (isString(contents)) contents = new Buffer(contents); else if (contents !== null && !Buffer.isBuffer(contents)) { throw new TypeError('Exected contents to be a buffer, string or null; got: ' + typeof contents); } // check what the old contents was before updating it const oldContents = this.read(file); // update our record of this file's contents if (contents) this[FILES][file] = contents; else delete this[FILES][file]; // decide change type, if any let type; if (oldContents) { if (contents) { if (!bufferEqual(oldContents, contents)) type = 'modify'; } else type = 'delete'; } else if (contents) type = 'add'; // respond with a change object, if it changed if (type) { const change = new Change({file, contents, oldContents, type}); this.emit('change', change); return change; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set file(value) { this._file = value; }", "setFileContent(newValue) {\n this._fileContent = newValue;\n }", "setFile(file) {\n this.file = file;\n }", "set file(value) {\n this._file = value;\n this.renderImage();\n }", "function setFile(url){\n\tfile = url;\n}", "setFileContents...
[ "0.710111", "0.69011784", "0.67491597", "0.60025394", "0.5962338", "0.5741352", "0.5706499", "0.5573751", "0.5539292", "0.54850197", "0.5431247", "0.5369234", "0.529847", "0.52593386", "0.52385753", "0.52270186", "0.5182997", "0.51553184", "0.5150205", "0.5150192", "0.5131616...
0.5394224
11
Returns an array of all the file paths currently in the virtual folder.
getAllPaths() { return Object.keys(this[FILES]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAllFilePaths() {\n \n //holds all the file paths being tracked by storyteller\n var allFilePaths = [];\n \n //go through each file/dir mapping\n for(var filePath in pathToIdMap) {\n if(pathToIdMap.hasOwnProperty(filePath)) {\n \n //if the file exists in th...
[ "0.66810745", "0.62842715", "0.61882734", "0.6179658", "0.6170243", "0.61617494", "0.6159305", "0.6144904", "0.61183137", "0.61148167", "0.6114717", "0.6114136", "0.611184", "0.6051959", "0.6038199", "0.60099494", "0.59697807", "0.595084", "0.5949616", "0.59400827", "0.593931...
0.6898038
0
Close the form if one is currently open Also hide applications list div when adding a new application
function setClose() { if (props.total_results != 0) { if (jobType != null) { setJobType(null); document.getElementById('apps').style.display = 'initial'; } else { document.getElementById('apps').style.display = 'none'; } } else { if (jobType != null) { setJobType(null); } else { } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideListForm() {\n if (!isAddingList) {\n vm.isListFormVisible = false;\n }\n }", "function hideForm() {\n mainForm.style.display = 'none';\n newInfoButton.style.display = 'block';\n}", "hideCreateForm() {\n this.changeFormMode(this.FORM_MODES.LIST);\n ...
[ "0.66123235", "0.65635896", "0.65525305", "0.6478083", "0.64173216", "0.6416694", "0.63985556", "0.63683105", "0.6364733", "0.6262822", "0.6239844", "0.6239844", "0.62326294", "0.62016577", "0.6171097", "0.61555815", "0.6123144", "0.61150104", "0.605529", "0.6045824", "0.6034...
0.64333135
4
read saved data on start
async function loadSavedData() { const newData = await new Promise(resolve => { fs.readFile(TMP_DB_PATH, (err, content) => { if (err) console.log("Error loading saved data from file. ", err); return resolve(JSON.parse(content)); }); }); if (Array.isArray(newData) && newData.length) { data = newData; console.log("Loaded saved data from file."); } else { console.log("No data in the file."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initialize() {\n fs.readFile(\"data.json\", (err, data) => {\n if (err) {\n return console.error(\"FATAL: couldn't restore app state from data.json\");\n }\n var state = JSON.parse(data);\n interactionsHistory = data.interactionsHistory || {};\n engagementH...
[ "0.6337528", "0.6305773", "0.6291212", "0.6202274", "0.6178993", "0.614394", "0.61196107", "0.6113442", "0.60658365", "0.6051222", "0.60293895", "0.60205126", "0.6005231", "0.59646505", "0.59555554", "0.59379375", "0.5937245", "0.59237146", "0.59133095", "0.5900318", "0.58966...
0.6179756
4
Component responsible for present list of all posts
function UserShow(props) { const { match } = props; const [posts, setPosts] = useState([]); const [user, setUser] = useState({}); const [totalItems, setTotalItems] = useState(0); // Default page in pagination const [page, setPage] = useState(1); const [perPage, setPerPage] = useState(0); const [isLoading, setIsLoading] = useState(true); const [errors, setErrors] = useState(""); // Fetch post list from backend with pagination. Refetch data when page change useEffect(() => { setIsLoading(true); userService .show(match.params.id, page) .then(response => { setPosts(response.data.posts); setUser(response.data.user); setTotalItems(response.data.meta.total); setPerPage(response.data.meta.per_page); setIsLoading(false); }) .catch(error => { if (error.response) { let error_messages = ""; if (error.response.status === 500) { error_messages = "Backend not responding"; } else { error_messages = error.response.statusText; } setErrors(error_messages); } else if (error.request) { setErrors("Something went wrong. Try again later."); } setIsLoading(false); }); }, [match.params.id, page]); // Handle page change function onChange(page) { setPage(page); } return ( <React.Fragment> {!isLoading && !errors ? <UserInfo user={user} /> : null} <PostListContainer posts={posts} isLoading={isLoading} errors={errors} /> <Pagination total={totalItems} pageSize={perPage} onChange={onChange} /> </React.Fragment> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function listPosts() {\n\t\tconst p = await API.graphql(graphqlOperation(ListPosts));\n\t\tupdatePosts(p.data.listPosts.items);\n\t}", "async function list(ctx, next) {\n ctx.body = await render('list', { posts: posts})\n}", "getPosts() {\r\n return this.posts;\r\n }", "function PostList({ posts, ...
[ "0.7404693", "0.7352751", "0.7247325", "0.7133187", "0.7089901", "0.70602983", "0.7026492", "0.70116025", "0.69791776", "0.69705784", "0.6962189", "0.6948067", "0.6934963", "0.6923527", "0.69020087", "0.6892614", "0.68825185", "0.6866711", "0.6862716", "0.68602693", "0.685787...
0.0
-1
get parameters from the URL which was navigated to from autogenerated email
function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUrlParams() {\n\n //var my_url_var = window.location.href;\n let my_url_var = (window.location != window.parent.location) ?\n document.referrer :\n document.location.href;\n\n let params_list = my_url_var.split(\"?\");\n\n let final = {};\n\n if (params_l...
[ "0.6902981", "0.67514557", "0.6713892", "0.662862", "0.6604577", "0.65747327", "0.65498495", "0.65119433", "0.65069336", "0.6499713", "0.64825743", "0.6458913", "0.64554983", "0.64527464", "0.64510113", "0.6406078", "0.6378883", "0.6325121", "0.63198483", "0.6311011", "0.6303...
0.0
-1
helper function to display card on successful password reset
function SuccessfullyResetCard() { return ( <Card className="px-5 pt-4"> <Card.Header className="card-header-no-border"><h2 className="font-weight-bold">You've successfully reset your password!</h2></Card.Header> <Card.Body className="px-0"> <Row className="mt-2 px-0"> <Col className="pl-3 py-1"> <CustomButton wide secondary type="button" className="drop-shadow py-2" style={{ backgroundColor: 'var(--primary3)', color: 'var(--gray1)' }} href="/login" > Return to Login </CustomButton> </Col> </Row> </Card.Body> </Card> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ResetCard({ email, onPasswordChange, submitForm, errorCode}) {\r\n return (\r\n <Card className=\"px-5 pt-4\">\r\n <Card.Header className=\"card-header-no-border\">\r\n <h2 className=\"font-weight-bold\">Resetting Password for:</h2 >\r\n <p className=\"mb...
[ "0.7208443", "0.67232597", "0.66359365", "0.6481082", "0.63776284", "0.6299833", "0.6272654", "0.6238553", "0.6217429", "0.6184245", "0.6180472", "0.61693394", "0.616361", "0.6160195", "0.6153026", "0.61497974", "0.6142995", "0.61199033", "0.6092971", "0.6071315", "0.6041526"...
0.6236474
8
helper function to display reset password form
function ResetCard({ email, onPasswordChange, submitForm, errorCode}) { return ( <Card className="px-5 pt-4"> <Card.Header className="card-header-no-border"> <h2 className="font-weight-bold">Resetting Password for:</h2 > <p className="mb-0">{email}</p> </Card.Header > <Card.Body className="px-0"> {errorCode !== '' && <h6 className="text-danger">{ }</h6>} <Form onSubmit={submitForm}> <Form.Group controlId="password"> <Form.Control className="py-4" required type="password" onChange={onPasswordChange} placeholder="New Password" /> </Form.Group> <Row className="mt-2 px-0"> <Col className="pr-3 py-1"> <CustomButton wide type="submit" className="drop-shadow py-2" > Save </CustomButton> </Col> </Row> <Row> <Col className="mt-4"> <p className="main-text">Don't have an account yet? <a href="/">Sign up!</a></p> </Col> </Row> </Form> </Card.Body> </Card > ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async resetPassword({ view, params, antl }) {\n return view.render('user.password', {\n token: params.token,\n key: params.key,\n action: 'UserController.storeResetPassword',\n header_msg: antl.formatMessage('main.change_password'),\n button_msg: antl.formatMessage('main.change_password...
[ "0.72689563", "0.6889321", "0.6628089", "0.6615192", "0.6602431", "0.6446871", "0.6413607", "0.640247", "0.64002264", "0.639404", "0.6392925", "0.631702", "0.63133293", "0.63121516", "0.62927014", "0.627489", "0.62289125", "0.6220985", "0.61990076", "0.619573", "0.61789095", ...
0.6168462
21
fetch weather data from openweathermap api needs auth
async function getWeatherReport() { const apiKey = "6e27a113797392f6dee5a23a3d7cc5ef"; const cityName = "London"; const response = await fetch( `http://api.openweathermap.org/data/2.5/weather?q=${cityName},uk&APPID=${apiKey}` ); const myJson = await response.json(); const temperature = myJson.weather; console.log(temperature); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWeather(data){\n var api_key = '6996386e46f031703c26cea51cac9e6e';\n var url = `https://cors-anywhere.herokuapp.com/http://api.openweathermap.org/data/2.5/weather?units=imperial&APPID=${api_key}&${data}`;\n\n fetch(url).then(response => response.json()).then(json_response => displayWeather(json_res...
[ "0.7700457", "0.76259696", "0.7566452", "0.753374", "0.7515647", "0.7472935", "0.74516594", "0.74449676", "0.7429668", "0.74257815", "0.7421122", "0.74142784", "0.7383334", "0.7372995", "0.73702353", "0.73059416", "0.72946644", "0.72866285", "0.7266296", "0.72584003", "0.7255...
0.70304394
42
used to support hot reloading
_reload() { js2py = require("../../shift-codegen-py/src"); this._generator = new js2py.PyCodeGen({ topLevelComment: false, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_configureHTTP() {\n let source\n\n// Configuring express to serve from example directory...\n app.use('/', express.static(this.options.watchOpts.serve))\n// Setting the port...\n app.set('port', process.env.PORT || this.options.watchOpts.port)\n\n// HMR endpoint...\n app.get('/hot-module', (req, res)=> {\...
[ "0.70286053", "0.6826523", "0.63319314", "0.62796295", "0.6268212", "0.6264822", "0.62478137", "0.616398", "0.61261386", "0.6096019", "0.6022346", "0.59880954", "0.59849447", "0.59617066", "0.5904842", "0.58831954", "0.5882334", "0.5870729", "0.58478725", "0.5840752", "0.5812...
0.0
-1
Copy the entire credentials JSON file from creating a service account in GCP.
function getServiceAccountCreds() { return JSON.parse(scriptProperties.getProperty(SERVICE_ACCOUNT_CREDS)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setUpAuth () {\n const serviceAccount = JSON.parse(fs.readFileSync(program.service_account_json));\n const jwtAccess = new google.auth.JWT();\n jwtAccess.fromJSON(serviceAccount);\n // Note that if you require additional scopes, they should be specified as a\n // string, separated by spaces.\n jwtAc...
[ "0.6189491", "0.592305", "0.5912973", "0.5600258", "0.552147", "0.54972243", "0.54588205", "0.5427297", "0.5414779", "0.54107696", "0.5376043", "0.53433216", "0.5336684", "0.53241897", "0.51938325", "0.51627886", "0.51468563", "0.51287645", "0.5078304", "0.50133926", "0.49798...
0.5785027
3
This function will use the variables to calculate the answers. It should work.
function calculate () { length = document.getElementById('textbox').value width = document.getElementById('textbox').value length = parseInt(length) width = parseInt(width) alert(length * width) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function questionCalculations()\r\n\t{\r\n\t\t// here, calculations for all the above variables should occur\r\n\t}", "function calcDistictAnswers(answers, question) {\n\n //Check if answers contains more than one submission and question is defined\n if (answers.length < 1 || question == undefined) {\n cons...
[ "0.7732249", "0.66374815", "0.6455912", "0.6449502", "0.64194083", "0.63356066", "0.6290932", "0.6209945", "0.6203061", "0.6182897", "0.6172524", "0.6153146", "0.61409616", "0.61293274", "0.61242443", "0.6110876", "0.60848236", "0.6083805", "0.6064427", "0.60345024", "0.60298...
0.0
-1
function for calculating the needed cubic feet wood for given number of chair, table and bad. one chair needs 1 cubic feet wood, one table needs 3 cubic feet wood and one bed needs 5 cubic feet wood. the input order should be first chair, then table and in the end bed.
function woodCalculator(chair, table, bed) { //first condition to check if any valu is negative or not. If negative necessary warnings given if(chair<0 || table<0 || bed<0) { return "Physical entity can not be negative" } //take inputs and multiply it with cubic feet wood needed to make single one and add all three else { var chairWood = chair*1; var tableWood = table*3; var bedWood = bed*5; var totalWood = chairWood + tableWood + bedWood; } return totalWood; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function woodCalculator(chair, table, bed){\n\n var i, totalWood = 0;\n\n //for a chair 1 cubic feet needed.\n for(i = 1; i <= chair; i++){\n totalWood++;\n }\n\n //for a table 3 cubic feet needed.\n for(i = 1; i <= table; i++){\n totalWood = totalWood + 3;\n }\n\n //for a bed...
[ "0.72120124", "0.69677794", "0.68666846", "0.68131447", "0.6808526", "0.6754234", "0.67305523", "0.6717835", "0.6714915", "0.6701545", "0.66820085", "0.6668046", "0.66452867", "0.66440207", "0.6642435", "0.6640691", "0.66372585", "0.66076785", "0.660246", "0.6592661", "0.6572...
0.69362503
2
function for calculating bricks needed to build a multi store building. hight of first ten floor is 15 feet, next 10 floor is 12 feet and after that is 10 feet. bricks neede to build per feet is 1000.
function brickCalculator(floorCount) { //first condition to check if the bulding is more than 20 floors and then calculate needed bricks. for first 20 floor needed bricks are pre-defined. if(floorCount>20) { var excess = floorCount - 20; var feetCount = excess*10; var totalFeet = feetCount + (10*12) + (10*15); var neededBricks = totalFeet*1000; } //second condition to check if the building is more than 10 floors but less than or equal 20 floors. For first 10 floors needed bricks are pre-defined. else if(floorCount>10 && floorCount<=20) { var excess = floorCount - 10; var feetCount = excess*12; var totalFeet = feetCount + (10*15); var neededBricks = totalFeet*1000; } //third condition to check if the bulding is less than or equal 10 floors. else if(floorCount>0 && floorCount<=10) { var feetCount = floorCount*15; var neededBricks = feetCount*1000; } //if input is invalid necessary warnings are given. else { return "Floor can not be negative or you do not need any bricks"; } return neededBricks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function brickCalculator(numOfFloor){\n const brickPerFeet = 1000;\n var totalAmountOfBricks=0;\n for(var floorNo=1; floorNo<=numOfFloor; floorNo++){\n if(floorNo<=10){\n var j=0;\n j++;\n totalAmountOfBricks = totalAmountOfBric...
[ "0.8148356", "0.8072053", "0.8037299", "0.7857096", "0.7629519", "0.76155823", "0.75702214", "0.754358", "0.7465463", "0.74312323", "0.7406452", "0.7400688", "0.73857015", "0.7381502", "0.73701406", "0.73399365", "0.7312891", "0.7286587", "0.71886533", "0.7187406", "0.7149952...
0.75024444
8
function for checking the smallest name from an array. the input shuld be in an array
function tinyFriend(nameArray) { //initial variable are decleared to store the temporary values of string length and sname. Initial values are determined as that do not effect future values. var tinyLength = Infinity; var tinyest = ""; //first condition to check the array have any component in it. if(nameArray.length>0) { //loop is run to itarate the array for(var i = 0; i < nameArray.length; i++) { //nested condition to check if the value is string. if(typeof nameArray[i]=='string') { //another nested condition to find the shortest naame. if(nameArray[i].length<=tinyLength) { tinyLength = nameArray[i].length; tinyest = nameArray[i]; } } //if the value is not string necessary warnings are given. else { return "Digit can not be a Name"; } } //if there are no input then necessary warnings are given. } else { return "No input found"; } return tinyest; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tinyFriend(nameArr){\n /*sometimes array gives me more than one items which may have equal length for being the minimum one.\n for this reason i want to sort the array and Output the first one.........*/\n const sortedArr = nameArr.sort();\n let minName = sortedArr[0];\n\n //test all the n...
[ "0.81436825", "0.7581533", "0.74932206", "0.7441095", "0.7299658", "0.715987", "0.70790493", "0.6970749", "0.690564", "0.6881365", "0.68288213", "0.68105567", "0.67774457", "0.6776542", "0.67218417", "0.67113745", "0.6663169", "0.66568935", "0.6647739", "0.66285014", "0.66010...
0.68323696
10
testSchnorrSignature(); TEST FUNCTIONS ================================================================================================
function testHash() { const steps = fRounds + pRounds + 1; // create control values const hash = utils_1.createHash(field, sBoxExp, fRounds, pRounds, stateWidth, roundConstants); const controls = hash([42n, 43n, 44n, 45n]); // set up inputs and assertions const inputs = [[42n], [43n], [44n], [45n]]; const assertions = [ { step: steps - 1, register: 0, value: controls[0] }, { step: steps - 1, register: 1, value: controls[1] } ]; // generate a proof const proof = hashStark.prove(assertions, inputs); console.log('-'.repeat(20)); // verify the proof hashStark.verify(assertions, proof); console.log('-'.repeat(20)); console.log(`Proof size: ${Math.round(hashStark.sizeOf(proof) / 1024 * 100) / 100} KB`); console.log(`Security level: ${hashStark.securityLevel}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test(){\n\tassert.ok(ostatus.salmon.verify_signature(me, key));\n}", "function verifySignature(msg, signature, pub_key) {\n //return curve.sign.detached.verify(str2buf(msg, 'ascii'), str2buf(signature, 'base64'), pub_key);\n return curve.sign.detached.verify(msg, str2buf(signature, 'base64'), pub_...
[ "0.7091817", "0.6376661", "0.6355904", "0.632866", "0.62962246", "0.62438613", "0.6185131", "0.61671996", "0.61612886", "0.61447453", "0.60907596", "0.6040627", "0.5997651", "0.59582853", "0.59516144", "0.59409165", "0.5826957", "0.5764042", "0.574171", "0.57322925", "0.57119...
0.0
-1
Internal function to perform actions on a user.
function getUserById(id) { var deferred = queue.defer(); var findDeferred = queue.defer(); User.findOne({ _id: mongoose.Types.ObjectId(id) }, findDeferred.makeNodeResolver()); findDeferred.promise.then(resolveOnlyWhenFound(deferred)); return deferred.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set_user(on) { store.dispatch(hpUser(on)); }", "function user()\n {\n\n }", "getUser(state, action){}", "mutateUser ({dispatch}, payload) {\n if (payload.id) {\n dispatch('editUser', payload)\n } else {\n // TODO creating a user from the admin account\n console.log('this u...
[ "0.66447324", "0.6609724", "0.65335166", "0.623834", "0.61780006", "0.6171464", "0.61690974", "0.6145827", "0.61251837", "0.6012342", "0.5987544", "0.5952207", "0.59098077", "0.5875212", "0.58679193", "0.58532405", "0.58496934", "0.5840773", "0.5840561", "0.5818845", "0.58037...
0.0
-1
Callback function which sends the intial get requst to Investopedia
function termLookup(info, tab){ var term = info.selectionText.replace(/\s+/g, '-').toLowerCase(), firstLetter = term.charAt(0); var DOMAIN = 'http://www.investopedia.com', PATH = /terms/+firstLetter+'/'+term+'.asp', URL = DOMAIN+PATH; $.get(URL, parseResponse); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _run() {\n let url = 'https://maker.ifttt.com/trigger/' + this.action + '/with/key/' + this.key;\n\n var xmlhttp = new XMLHttpRequest();\n xmlhttp.open('GET', url, true);\n // xmlhttp.onreadystatechange = (e) => { console.log(e); };\n xmlhttp.send();\n}", "function sendGet(url, params)\n{...
[ "0.5838593", "0.5786786", "0.5786786", "0.5731679", "0.5724769", "0.568553", "0.5683198", "0.5660793", "0.5660567", "0.5562685", "0.5560424", "0.55602425", "0.55554515", "0.5554074", "0.5541787", "0.5529845", "0.5520172", "0.55177546", "0.5509169", "0.5426427", "0.5415939", ...
0.0
-1
Parses response text from Investopedia
function parseResponse(responseText){ //var definition = ''; $(responseText).find('.content-box-term').children().each(function(i, element){ //This condition handles the definition text and needs to be improved if($(this).is('p')){ //$(this).dialog(); <-- This is the method for jQuery UI dialog box but doesn't work yet //definition.concat($(this).text()); <-- This is to avoid multiple alert boxes but doesn't work alert($(this).text()); } else if ($(this).is('div#NextUpBox')){ return false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processResponse(text){\r\n\r\n\t\t\tvar tSplit = text.split('<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>')[1];\r\n\t\t\tvar profile = new XML(tSplit);\r\n\t\t\t/*var jsonTracklist = {\r\n\r\n\t\t\t 'title':'ZOMGBBQ!', \r\n\t\t\t 'tracklist':[]\r\n\r\n\t\t\t}\r\n\r\n\t\t\tvar i=0;\r\n\t\t\tfor each(...
[ "0.6124493", "0.6070044", "0.60401046", "0.601658", "0.594756", "0.5944022", "0.58137923", "0.5715947", "0.5695403", "0.56927407", "0.55704355", "0.552475", "0.55208033", "0.5520296", "0.5505458", "0.5476078", "0.5475715", "0.54719347", "0.543121", "0.54224634", "0.5422113", ...
0.5913698
6
Javascript placed here will be applied to the Wikia skin. / / THEME STYLES / / Fancy background animation (requires styles in Wikia.css)
function renderbganim() { // generate the html var bganimhtml = '<div class="bganim-outer">'; bganimhtml += '<div class="bganim-inner">'; bganimhtml += '</div>'; bganimhtml += '</div>'; // add it to the DOM tree $( "#WikiaPage" ).prepend( bganimhtml ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function theme_script(){\n\n}", "function wintheme() {\t\n\t\t\t\tvar bgColour = new Array(teal,cyan,cobalt,indigo,violet,pink,magenta,crimson,red,orange,amber,yellow);\t\n\t\t\t\t// random colours\n\t\t\t\tvar randNum = Math.random();\n\t\t\t\tvar i = Math.round(randNum * 12);\n\t\t\t\t\t// animate colours over...
[ "0.6463573", "0.6402625", "0.6202073", "0.61521894", "0.6147096", "0.61431485", "0.609275", "0.60239124", "0.5984506", "0.5949651", "0.59165335", "0.5888293", "0.5884749", "0.5867574", "0.58556545", "0.5855622", "0.5847735", "0.5842615", "0.58410823", "0.5840166", "0.5832086"...
0.63592213
2
name ="Salman"; // assigning a value alert(name); var message = "Wlecome "; var name = "Salman"; alert(message + name);// concatinate the two variable
function imgEvent(){ alert('This is Void Link'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function greet(message){\n let name=\"Harendra\"\n alert(message + \" \" + name)\n alert(`${message} ${name}`)\n console.log(`2+2= ${2+2} \"Hello\" , 'Hello'`)\n}", "function\talertName()\t{\n\talert('Hello ' + name); \t\n}", "function showMessage_v2() {\n userName = \"Poster\"\n let alertMes...
[ "0.73478764", "0.71034443", "0.7068263", "0.6941338", "0.6908971", "0.6898502", "0.685678", "0.6751887", "0.6719597", "0.66759884", "0.66648537", "0.6615329", "0.661254", "0.6582621", "0.65777504", "0.6574689", "0.6571808", "0.65597373", "0.65440905", "0.652369", "0.6519997",...
0.0
-1
loop through the list of partialList and call loading
function loadingPartial(id){ if(id){ console.log("loadingPartial with id: %s", id); renderPartialPostHandler(id); } else{ console.log("loading all partial"); for(var i in partialList){ if(!partialList[i].isRendered) renderPartialPostHandler(i); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadLists() {\n\tloadEquipmentSlots();\n\tloadNpcList();\n}", "prepLoadList (list, callback) {\n\n // store here for when loadList gets called.\n this._list = list;\n\n // only want a single instance of this function.\n this._bulkLoadCompleteFn = callback;\n }", "functio...
[ "0.70509964", "0.6913766", "0.6645327", "0.6344031", "0.6333306", "0.6214303", "0.61855173", "0.6167771", "0.61478615", "0.6129641", "0.60915375", "0.60780466", "0.60684747", "0.60531116", "0.59800476", "0.5979282", "0.5971382", "0.597012", "0.59423804", "0.593376", "0.592626...
0.6631401
3
========================private functions ============================ this function called after main body loaded, or when partialView reloaded;
function renderPartialPostHandler(id){ console.log("renderPartialPostHandler | id: %s",id); var partial = partialList[id]; partial.setLoading(); viewRender(partial.route,null,function(content){ // console.log("renderPartialPostHandler callback: %s", content); console.log("renderPartialPostHandler | callback id: %s", id); partial.setLoaded(content); if(partial.refreshTime) { console.log("call autoRefresh for Id: %s", id); partial.autoRefresh(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "afterRender() { }", "afterRender() { }", "function cb_contentLoaded(cb) {}", "onAfterRendering() {}", "function pageFullyLoaded () {}", "function partialLoaded(parentVM) {\n\t\t\tvm.super = vm;\n\t\t}", "function postRender(formmated){\r\n console.log(\"postRender\");\r\n var jObj = $(this);\r\n ...
[ "0.6653066", "0.6653066", "0.6539719", "0.6529072", "0.64586747", "0.64420825", "0.63821435", "0.63804346", "0.637268", "0.6357889", "0.6352046", "0.6352046", "0.6352046", "0.63189566", "0.6303454", "0.6281305", "0.6254545", "0.62267", "0.62267", "0.6222498", "0.6221601", "...
0.6131216
30
handle custom form submission
function formSubmitHandler(event){ console.log("formSubmitHandler"); event.preventDefault(); var form = event.target || event.srcElement; var route = getFormRoute(form); var method = form.method.toLowerCase(); switch(method){ case "get": location.hash = getHashPath(route); break; case "post": case "put": // set cancelHashChange to skip the renderView on hashChange and // then proccess it manually. cancelHashChange = true; location.hash = getHashPath(route); sessionStorage["currentPostParams"] = JSON.stringify(route.postParams); setTimeout(function(){ viewRender(route); cancelHashChange = false; },0); case "path": case "delete": case "option": default: break; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitCustom(form) {\n let data = {};\n data[\"title\"] = form.customTitle.value;\n data[\"ldap\"] = form.customLdap.value;\n data[\"description\"] = form.customDescription.value;\n data[\"reason\"] = form.customReason.value;\n\n // Check for empty title or ldap\n let hasError = false;\n if (data[...
[ "0.7398674", "0.71746373", "0.70603627", "0.69652617", "0.6928645", "0.6925527", "0.6900938", "0.6865389", "0.68645173", "0.68574566", "0.6832717", "0.67941743", "0.67672765", "0.67378545", "0.6727598", "0.66854167", "0.66817355", "0.6678787", "0.6666687", "0.66645914", "0.66...
0.6935953
4
parsing the form to get parameters for get and post
function getFormRoute(form){ var hash = getHashFromUrl(form.action); console.log("getFormRoute | hash: %s", hash); var route = getRoute(hash); var params = {}; for(var i=0;i<form.elements.length;i++){ var e = form.elements[i]; var key = e.name; var type = e.type.toLowerCase(); if(!key || ((type=="radio" || type=="checkbox") && !e.checked)) continue; var value = e.value; updateParamItem(params,key,value,false); } console.log("params: %s", JSON.stringify(params)); $.extend(route.params,params); if(form.method.toLowerCase() == "get"){ $.extend(route.getParams,params); } else{ // create post params route.postParams = params; } console.log("updated route: %s", JSON.stringify(route)); return route; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_get_parameters() {\n if (location.search.length < 1) {\n return null;\n }\n else {\n var parameters = [];\n location.search\n .substr(1)\n .split(\"&\")\n .forEach(function (item) {\n let temp = item.split(\"=\");\n ...
[ "0.64322215", "0.6404169", "0.63484", "0.62563497", "0.62064284", "0.61928874", "0.6158871", "0.6123546", "0.6111088", "0.60739666", "0.6024206", "0.6011635", "0.5980322", "0.59562236", "0.59357077", "0.5934784", "0.588576", "0.5860076", "0.5853899", "0.5852038", "0.584296", ...
0.5986725
12
parsing arguments for calling action with predefined params
function parseArguments(args){ var data,success,dataType; if(typeof(args[1])=="object"){ data = args[1]; if(typeof(args[2])=="function"){ success = args[2]; if(typeof(args[3])=="string"){ dataType = args[3]; } } }else if(typeof(args[1])=="function"){ success = args[1]; if(typeof(args[2])=="string"){ dataType = args[2]; } } else if(typeof(args[1])=="string"){ dataType = args[1]; } return { url:args[0], data: data, success: success, dataType: dataType } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function main(args) {\n // propagate errors\n if (args.error) return args\n // unescape params: { action, state, foo, params: { bar } } becomes { action, state, params: { foo, bar } }\n const action = args.action\n const state = args.state\n const params = args.params\n delete args.action\n ...
[ "0.662924", "0.61538094", "0.60469383", "0.5933523", "0.589596", "0.58123964", "0.5743006", "0.5722535", "0.5717835", "0.5683364", "0.56329304", "0.56009483", "0.5572511", "0.55389535", "0.55096483", "0.5475489", "0.5474218", "0.5430921", "0.5428628", "0.5419558", "0.5391436"...
0.5786146
6
This is the key function or entry point to render a view route, model, callback
function viewRender(route, model, callback){ console.log("viewRender: %s", JSON.stringify(route)); var template = getTemplate(route); loadController(route.controller, function(){ var ret = model; if(!ret){ var handler = controllers[route.controller][route.action] || controllers[route.controller]["_defaultAction"] || defaultOptions.actionHandler; var args = getParamNames(handler); var vals = []; for(var i=0; i<args.length; i++){ var val = route.params[args[i]]; vals.push(val) } ret = handler.apply($.jf,vals); } processAction(ret,template,route,callback); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "view() {\n // console.log('Render called');\n return this._view.renderView();\n }", "render(){}", "render(){}", "function render() {\n var currentAction = $route.current.action || 'list';\n \n switch(currentAction) {\n case 'add': {\n publicMethods.create();\n } break;\n ...
[ "0.7086873", "0.70798975", "0.70798975", "0.68738425", "0.66272753", "0.6625312", "0.6625312", "0.6625312", "0.6560287", "0.6489538", "0.64632446", "0.64632446", "0.6427854", "0.64211416", "0.6405989", "0.63958013", "0.63621193", "0.63380516", "0.63336235", "0.6321515", "0.63...
0.77995634
0
handler call after each view loaded.
function postRender(formmated){ console.log("postRender"); var jObj = $(this); // adding handler for forms jObj.find("form").bind("submit",formSubmitHandler); // adding handler for partial view var id= jObj.attr("id"); console.log("postRender, id: %s", id); if(id == defaultOptions.container){ loadingPartial(); } else if(id in partialList){ loadingPartial(id); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_triggerLoaded() {\n\t if (this._alreadyLoaded) {\n\t // Do not trigger event twice\n\t this._triggerUpdated();\n\t return;\n\t }\n\t this._alreadyLoaded = true;\n\t const registry = storage.getRegistry(this._instance);\n\t const events = registry...
[ "0.711159", "0.6745946", "0.67163956", "0.6515156", "0.64583033", "0.642292", "0.64223933", "0.63748217", "0.6357358", "0.6349494", "0.63411504", "0.6320601", "0.629923", "0.6216456", "0.62116194", "0.61990196", "0.6172037", "0.6172037", "0.610932", "0.6107479", "0.6105994", ...
0.0
-1
this will set the params equal getParams it should only be use to create link for anchor or form.
function getRouteHelper(obj){ var tmpRoute; if(typeof(obj)=="string"){ tmpRoute = {action: obj, controller: currentControllerName}; } else{ tmpRoute = obj; } tmpRoute.getParams = $.extend({},tmpRoute.params); return $.extend({}, defaultRoute, tmpRoute); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setArticleParams() {\n var articleId;\n var versionNumber;\n var runId;\n var url = window.location.pathname;\n if (config.ISPP) {\n // for use in the PP\n url = window.location.search;\n url = url.replace('?', '/');\n }\n\n ...
[ "0.64227766", "0.61190534", "0.61190534", "0.61190534", "0.5958614", "0.5878475", "0.5807637", "0.57913107", "0.57556915", "0.5747033", "0.5643816", "0.5635349", "0.5610925", "0.5591237", "0.55659074", "0.553835", "0.5536452", "0.5535456", "0.55133504", "0.5488656", "0.548422...
0.0
-1
get argument names of a callback function.
function getParamNames(func) { var fnStr = func.toString().replace(STRIP_COMMENTS, '') var result = fnStr.slice(fnStr.indexOf('(')+1, fnStr.indexOf(')')).match(ARGUMENT_NAMES) if(result === null) result = [] return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function argumentNames(fn) {\n\t var names = fn.toString().match(/^[\\s\\(]*function[^(]*\\(([^)]*)\\)/)[1]\n\t .replace(/\\/\\/.*?[\\r\\n]|\\/\\*(?:.|[\\r\\n])*?\\*\\//g, '')\n\t .replace(/\\s+/g, '').split(',');\n\t return names.length == 1 && !names[0] ? [] : names;\n\t}", "function argumentNames(f) {...
[ "0.75850946", "0.6928508", "0.6827934", "0.6582613", "0.63940877", "0.6366113", "0.6350676", "0.60110426", "0.59533465", "0.58827436", "0.5869651", "0.58469486", "0.58403456", "0.58285767", "0.5812033", "0.57768273", "0.57695436", "0.5761976", "0.5671639", "0.5669627", "0.565...
0.6949597
1
fetch the remote controller and keep track of it so it will not be loaded twice.
function loadController(controllerName, callback){ currentControllerName = controllerName; if(controllers[controllerName]!=undefined) { // console.log("controller already loaded"); callback(); return; } controllers[controllerName] = null; var filePath = defaultRoute.baseUrl + "/controllers/" + controllerName + ".js"; var script = document.createElement("script"); script.type="text/javascript"; script.src = filePath; script.onload = function(){ registerController(controllerName); callback(); } document.head.appendChild(script); // var script = $('<script type="text/javascript" src="'+ filePath // +'"></script>'); // script.get(0).load = callback; // $(document.body).append(script); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async retrieveController() {\n this.contr = await Controller.createController();\n }", "function getController() {\n return controller;\n}", "get controller()\n {\n return this._controller;\n }", "get controller()\n {\n return this._controller;\n }", "function load_controller(url, callback...
[ "0.6947303", "0.64765906", "0.622677", "0.622677", "0.6164597", "0.6033011", "0.570248", "0.56610477", "0.56163496", "0.54773855", "0.5402852", "0.5303666", "0.5218258", "0.5218258", "0.5175834", "0.5172983", "0.5159715", "0.51589084", "0.5098989", "0.5034112", "0.5019513", ...
0.50508654
19
when controller script loaded, $.jf.ctrl will be set some value; this function will read the value, set to the controllers, then reset the temporary $.jf.ctrl;
function registerController(name){ controllers[name] = $.jf.ctrl.actions; $.jf.ctrl = { filters: [], actionFilters: {}, actions:{} } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshGui() {\n gui.__controllers.forEach(controller => controller.setValue(controller.initialValue));\n }", "setController(initController) {\n this.controller = initController;\n }", "setController(initController) {\n this.controller = initController;\n }", "function initil...
[ "0.67322004", "0.65495676", "0.65495676", "0.61538666", "0.6131448", "0.60840964", "0.58426356", "0.57253", "0.57253", "0.57248455", "0.5697311", "0.56924", "0.56924", "0.56093794", "0.56092507", "0.5594043", "0.5594043", "0.5572633", "0.5535082", "0.553315", "0.5495676", "...
0.0
-1
return route object base on current url it should answer what is the controller, and the view. format for the hash controller/action?param1=value1&param2=value2
function getRoute(hash){ var hash = hash || window.location.hash.substring(1); if(!hash) { console.log("hash is not defined use defaultRoute: %s", JSON.stringify(defaultRoute)); return defaultRoute; } var i = hash.indexOf("?"); var path = paramStr = ""; var route = $.extend({},defaultRoute); if(i!=-1){ path = hash.substr(0,i); paramStr = hash.substr(i+1); }else{ path = hash; } var pathArr = path.split('/'); console.log("path: %s", path); if(pathArr.length==1){ route.controller = currentControllerName; route.action = pathArr[0] || route.action; }else{ route.controller = pathArr[0] || route.controller; route.action = pathArr[1] || route.action; } route.params = getParams(paramStr); console.log("route: %s", JSON.stringify(route)); return route; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRouteHelper(obj){\r\n var tmpRoute;\r\n if(typeof(obj)==\"string\"){\r\n tmpRoute = {action: obj, controller: currentControllerName};\r\n }\r\n else{\r\n tmpRoute = obj;\r\n }\r\n tmpRoute.getParams = $.extend({},tmpRoute.params);\r\n return $.extend({}, defaultRoute, tmp...
[ "0.69673014", "0.65067947", "0.6253531", "0.6098924", "0.6054433", "0.5961769", "0.5955426", "0.59383893", "0.59383893", "0.59383893", "0.5920788", "0.5877686", "0.5872621", "0.5826042", "0.5781528", "0.5694709", "0.5683778", "0.56832606", "0.5681354", "0.56583095", "0.564041...
0.6940775
1
helper function to format string
function format() { var format = arguments[0] || ""; var match = format.match(/%s|%d|%j/g); if (!match) return format; if (match.length != arguments.length - 1) throw { name: "Argument Error", message: "Number of arguments mismatch" }; for (var i = 1; i < arguments.length; i++) { var matchIndex = i - 1; var value = (match[matchIndex] == "%j") ? JSON.stringify(arguments[i]) : arguments[i]; format = format.replace(match[matchIndex], value); } return format; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Format() {}", "function Format() {}", "function formatString(arg) {\n var response = arg;\n response = response.replace(/\\//g, \"_\");\n response = response.replace(/\\+/g, \"-\");\n response = response.replace(/=+$/, '');;\n return response;\n}", "format (formatString = '%s%y%j%p%n'...
[ "0.77428436", "0.77428436", "0.7315509", "0.72914624", "0.7254038", "0.7215152", "0.711854", "0.7112623", "0.70984256", "0.70468247", "0.7030428", "0.6989819", "0.69894737", "0.69861245", "0.6975022", "0.6886742", "0.6884545", "0.68305856", "0.6771086", "0.67595685", "0.67436...
0.6902527
15
Function called when clicking the Login/Logout button. [START buttoncallback]
function toggleSignIn() { if (!firebase.auth().currentUser) { var provider = new firebase.auth.GoogleAuthProvider(); // [START signin] firebase.auth().signInWithPopup(provider).then(function(result) { // User is authenticated. var user = result.user; // The signed-in user info // Store user uid, displayName, and email sessionStorage.setItem("uid", user.uid); sessionStorage.setItem("displayName", user.displayName); sessionStorage.setItem("email", user.email); // Store in session the graduation status of the user; if not a student/alumni, show error message. gradStatus = returnGradStatus(user.email, user.emailVerified) // Determine if account can enter app. if (gradStatus !== 'error') { sessionStorage.setItem("gradStatus", gradStatus); // Go to app main page. window.location.href = "main.html"; } else { // Signout user. firebase.auth().signOut(); // Re-enable button. document.getElementById('quickstart-sign-in').disabled = false; // Error message (user is not verified, or not a student or alumni) sweetAlert("Oops!", "Please use a Notre Dame e-mail account.", "error"); } }).catch(function(error) { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; var email = error.email; // The email of the user's account used. var credential = error.credential; // The firebase.auth.AuthCredential type that was used. if (errorCode === 'auth/account-exists-with-different-credential') { alert('You have already signed up with a different auth provider for that email.'); // If you are using multiple auth providers on your app you should handle linking // the user's accounts here. } else { console.error(error); } }); // [END signin] } else { // [START signout] // Confirm logout sweetAlert. swal({ title: "Are you sure?", text: "Do you want to logout?", type: "warning", showCancelButton: true, closeOnConfirm: false, confirmButtonText: "Yes, logout!", confirmButtonColor: "#ec6c62" }, function(isConfirm){ if (isConfirm) { // Logout confirmed. firebase.auth().signOut(); console.log("logging out"); window.location.href = "index.html"; } else { // Logout canceled. } }); // [END signout] } $('#quickstart-sign-in').disabled = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleLoginBtnClick() {\n console.log(\"login clicked\", email, password);\n\n }", "function loggedIn(){\n var $login = $('.login');\n switchTheme($login, 'b');\n $('.ui-btn-text', $login).text($login.data('text-logout'));\n $login.attr('onclick', 'window.location.h...
[ "0.75020313", "0.745738", "0.74435467", "0.7432854", "0.73764944", "0.7121758", "0.7024859", "0.7013445", "0.69564337", "0.6953437", "0.68890643", "0.6881376", "0.68652344", "0.6841569", "0.68296957", "0.6821401", "0.6796377", "0.6774338", "0.6769635", "0.6756239", "0.6744398...
0.0
-1
[END buttoncallback] Function used to return current user graduation status based on their user.email.
function returnGradStatus (email, emailVerified) { if (emailVerified) { // Email is verified. // Get domain of email (note: if email is 'abc@abc'@example.com, then this next line won't work properly) var domain = email.replace(/.*@/, ""); // Replaces everything up to and including the @ symbol if (domain === 'alumni.nd.edu') { // true if the address ends with alumni.nd.edu return 'alumni'; } else if (domain === 'nd.edu') { // true if the address ends with nd.edu return 'student'; } else { // address is not of student or alumni return 'error'; } } else { // Email is not verified. return 'error'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CheckStatus(){\n \n fire.auth().onAuthStateChanged(\n (user)=>{\n if (user) {\n setUserInfo(user.email)\n }\n }\n )\n }", "function checkUserState() {\n var user = firebaseData.getUser();\n if (user) {\n // logged in - hide this\n document.ge...
[ "0.6206232", "0.6147407", "0.6083824", "0.60828996", "0.5799449", "0.5774487", "0.56727433", "0.56727433", "0.5600111", "0.55664414", "0.5553524", "0.55490065", "0.55338335", "0.55041534", "0.5503462", "0.55018497", "0.5495348", "0.5492129", "0.54843765", "0.5479782", "0.5477...
0.634385
0
Esta funcion crea el cursor y setea los listeners
function createCursor() { cursor = document.createElement("div"); cursor = document.createElement("div"); span = document.createElement("span"); title = document.queryCommandValue("h1"); cursor.classList.add("custom-cursor"); document.body.append(cursor); setCursorListeners(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static SetCursor() {}", "function createCursor() {\r\n cursorBar = document.createElement(\"div\");\r\n cursorBar.classList = [\"cursor-bar\"];\r\n\r\n checkCursorIntervalHandle = setInterval(function() {\r\n cursorImage = display_element.querySelector(\"#jspsych-a...
[ "0.7385312", "0.6627222", "0.66079", "0.6439811", "0.63694715", "0.631824", "0.6286023", "0.6217564", "0.6203469", "0.6197986", "0.61702645", "0.6104216", "0.60769176", "0.604556", "0.6027897", "0.6027897", "0.6000636", "0.59923834", "0.59831095", "0.5976143", "0.5970618", ...
0.699894
1
let [x, y, z] = [0, 0, 0]; const meshX = new THREE.Vector3(1, 0, 0); scene.add(new THREE.AxisHelper( 200 )); mesh.rotation.z = Math.PI / 2; const arrowHelper = new THREE.ArrowHelper(meshX, new THREE.Vector3(), 300, 0xffffff); scene.add(arrowHelper);
function start() { document.body.appendChild( renderer.domElement ); mesh.rotation.set(-Math.PI/2, 0, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addHelpArrow() {\r\n\tlet dir = new THREE.Vector3(1, 2, 0);\r\n\tdir.normalize();\r\n\tlet origin = new THREE.Vector3(0, 0, 0);\r\n\tlet length = 1;\r\n\tlet hex = 0xffff00;\r\n\tlet arrowHelper = new THREE.ArrowHelper(dir, origin, length, hex);\r\n\tscene.add(arrowHelper);\r\n}", "drawGeometry(scene){\...
[ "0.76643014", "0.6565999", "0.65508", "0.65248364", "0.64694476", "0.6308553", "0.6268231", "0.62507004", "0.62262636", "0.61648804", "0.61637837", "0.6149577", "0.61450136", "0.6138427", "0.61242926", "0.6100362", "0.6027", "0.6025186", "0.6014909", "0.6014772", "0.5984306",...
0.6466647
5
Converts each image used by the extension into the base64 encoding, placing that encoding into an outputted JSON file for later use by the extension.
function encodeFile(path) { const file = fs.readFileSync(path); return new Buffer(file).toString('base64'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "serializeImagesRelations(images, writer) {\n if (images.length > 0) {\n let imagePath = '';\n let base64ImageString;\n let keys = images.keys;\n for (let i = 0; i < keys.length; i++) {\n let mImage = images.get(keys[i]);\n base64Image...
[ "0.618109", "0.614802", "0.61224395", "0.60447633", "0.5908084", "0.5844983", "0.5842953", "0.58383584", "0.57972217", "0.579369", "0.5705284", "0.56775045", "0.56536174", "0.5647137", "0.56185514", "0.56081927", "0.5600521", "0.5598167", "0.5514028", "0.5504744", "0.5502492"...
0.0
-1
10.136.149.161 openapi.qzone.qq.com 10.136.149.161 graph.qq.com 10.12.23.156 pub.idqqimg.com 10.136.149.161 openapi.qzone.qq.com 10.136.149.161 graph.qq.com 10.12.23.156 pub.idqqimg.com
function HostsManager() { this.hosts = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "IP() {\n // return \"47.106.171.247\";\n return \"tcjump.anyh5.com\";\n // return \"tcrhythm.anyh5.com\";\n }", "resolveLocalHost(url) {\n let strToReplace = url.toString();\n //strToReplace = strToReplace.replace('localhost', '192.168.1.7'); //put here the address of localMachine\n ...
[ "0.5768341", "0.53459907", "0.5262719", "0.51721704", "0.515178", "0.5121218", "0.50644404", "0.50459456", "0.50412184", "0.49936128", "0.49880514", "0.49574947", "0.4955964", "0.4913962", "0.48788762", "0.48631275", "0.48441955", "0.48419645", "0.48365718", "0.48365718", "0....
0.0
-1
const time = new Date().getHours()
function App2(){ const [searchTerm,setSearchTerm] = useState('') const onSearchChange = (e) =>{ setSearchTerm(e.target.value) } return( < > { isLoggedIn? <Login/> : <Greeting text="Welcome to iCrowd"/> } <input type='text' placeholder = 'search staff' onChange = {onSearchChange} value = {searchTerm} /> <CardList searchStaff = {searchTerm}/> <Image/> </>) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hourNow() {\n return (new Date).getHours();\n}", "H (date) {\n return date.getHours()\n }", "function getHours() {\r\n\tlet date = new Date();\r\n\tlet hour = date.getHours();\r\n\r\n\treturn hour;\r\n}", "function returnHour(){\n\tvar date = new Date();\n\tvar hours = date.getHours();\n\tc...
[ "0.88877296", "0.8814418", "0.865732", "0.8097972", "0.8007119", "0.7994984", "0.7929036", "0.76222223", "0.759132", "0.755606", "0.7416349", "0.7312028", "0.7297682", "0.72687304", "0.7256236", "0.7223416", "0.71892506", "0.71366775", "0.7118099", "0.7086186", "0.7072738", ...
0.0
-1
To swap the position of two items
function init() { posHTML.setDragnDrop() //Tooltip $("a").tooltip('show') $('a').tooltip({html: true}) $("a").tooltip('hide') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SwapItems(itemId1: int, itemId2: int) {\n\t\n\t}", "swapItems(itemIndex1, itemIndex2) {\n const items = this.props.items.slice();\n const temp = items[itemIndex1];\n items[itemIndex1] = items[itemIndex2];\n items[itemIndex2] = temp;\n\n this.props.onChange(items);\n }", "function swap...
[ "0.77183545", "0.75518435", "0.7456719", "0.74516267", "0.7449057", "0.7441188", "0.7395601", "0.73703724", "0.72045845", "0.7175213", "0.7130356", "0.7096268", "0.70710194", "0.70570165", "0.705149", "0.70360345", "0.702523", "0.69908166", "0.69832885", "0.6976202", "0.69714...
0.0
-1
Return true for events we want to keep, false to ignore
function fixParsedEvent(parsedEvent, backupSiteId, serverTs, eventId, dateMap, fileDateIndex) { // Field names repairFieldNames(parsedEvent); // Check that basic info is available if (!parsedEvent.pageUrl || !parsedEvent.browserUserAgent) { // Almost never happens // console.log('No page url or new user agent'); // console.log(parsedEvent.name); return false; } // Date and index // Get the year, month and date from the server ts rather than the file, because there can be a discrepancy const date = new Date(serverTs); parsedEvent.date = { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() }; const dateAsNum = getDateAsNumber(parsedEvent.date), newDateIndex = dateMap[dateAsNum]; parsedEvent.dateIndex = newDateIndex; if (typeof newDateIndex !== 'number') { if (dateAsNum === 20160131) { console.log('Event before beginning of time (Feb 1, 2016) -- throwing away: ', ++ tooOldCounter); return false; } console.log('Bad date: ' + newDateIndex + ' from ' + dateAsNum + ' / ' + JSON.stringify(parsedEvent.date)); return false; } if (newDateIndex !== fileDateIndex) { if (newDateIndex < fileDateIndex - 1 || newDateIndex > fileDateIndex + 1) { console.log('Strange date index discrepency, off by more than 1 day: ' + fileDateIndex + ' => ' + newDateIndex); } else { console.log('Date index discrepency for dateIndex = %d (%s): ', dateAsNum, newDateIndex > fileDateIndex ? '+1' : '-1', ++ dateIndexDiscrepencyCounter); } } // Event ID parsedEvent.eventId = eventId; // Site ID parsedEvent.siteId = (parsedEvent.siteId || backupSiteId).trim(); // Server time parsedEvent.serverTs = serverTs; // Window name simplification -- sometimes the names are ridiculously large if (parsedEvent.details && parsedEvent.details.windowName) { parsedEvent.details.windowName = parsedEvent.details.windowName.substr(0, 30); } // Garbage AB test check if (typeof parsedEvent.abTest === 'string') { if (parsedEvent.abTest.startsWith('moreButtonTimer.')) { delete parsedEvent.abTest; } } else if (typeof parsedEvent.abTest !== 'undefined') { delete parsedEvent.abTest; } // Event-specific fixes const eventSpecificRepairFn = eventSpecificRepair[parsedEvent.name]; if (eventSpecificRepairFn) { eventSpecificRepairFn(parsedEvent); } // Version const version = parsedEvent.scVersion, simplifiedVersionString = version && version.replace('-RELEASE', ''); parsedEvent.version = simplifiedVersionString; // Metadata parsedEvent.meta = metaData(parsedEvent); // Garbage session id fix if (parsedEvent.userId && (simplifiedVersionString === '4.2.7' || simplifiedVersionString === '4.2.8')) { // Create a session ID unique to this user and this domain const newSessionId = parsedEvent.userId + '-' + parsedEvent.meta.domain + '-' + newDateIndex; parsedEvent.sessionId = newSessionId; } // TODO Debug null session ids and page view ids! // else { // if (!parsedEvent.sessionId && parsedEvent.name !== 'page-visited' && parsedEvent.name !== 'error') { // console.log(JSON.stringify(parsedEvent)); // } // } // Keep or ignore? if (shouldKeep(parsedEvent)) { removeUnusedFields(parsedEvent); return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ignoreEvent(event) { return true; }", "filterEvent(event) {\n return false;\n }", "has(e) {\n return !!this.events[e];\n }", "stopEvent(event) {\n return false;\n }", "function shouldEventBeIgnored(event){\n // This adds an easter egg to only play closed PRs\n if (!!ULTIMA...
[ "0.7149208", "0.68852717", "0.64330953", "0.6242025", "0.6164724", "0.59778744", "0.58658725", "0.5808228", "0.58077973", "0.5753746", "0.5722709", "0.57148975", "0.56845635", "0.5684476", "0.5672289", "0.56389", "0.5618865", "0.5618865", "0.5618865", "0.5618865", "0.560033",...
0.0
-1
[Config Functions] Hide Custom Panels
function customPanel_visibility(state) { let inverse = 'Auto'; let panels = { "Message": "", "Panels": [] } if (hideCustomPanels_inUSBMode.toString() == "true" ? true : false) { if (state == "Hidden") { panels.Message = 'Hide Custom UI in USB Mode is enabled, Hiding the following panel IDs: ' } else { panels.Message = 'Hide Custom UI in USB Mode is enabled, Showing the following panel IDs: ' } for (let i = 0; i < hideCustomPanels_inUSBMode_PanelIds.length; i++) { panels.Panels.push(hideCustomPanels_inUSBMode_PanelIds[i]) xapi.command('UserInterface Extensions Panel Update', { PanelId: hideCustomPanels_inUSBMode_PanelIds[i], Visibility: state }).catch(e => console.debug(e)) } console.debug(panels) } else { for (let i = 0; i < hideCustomPanels_inUSBMode_PanelIds.length; i++) { panels.Panels.push(hideCustomPanels_inUSBMode_PanelIds[i]) xapi.command('UserInterface Extensions Panel Update', { PanelId: hideCustomPanels_inUSBMode_PanelIds[i], Visibility: 'Auto' }).catch(e => console.debug(e)) } } if (hideCustomPanels_inDefaultMode.toString() == "true" ? true : false) { if (state == 'Auto') { inverse = 'Hidden'; panels.Message = 'Hide Custom UI in Default Mode is enabled, Hiding the following panel IDs: ' } else { inverse = 'Auto' panels.Message = 'Hide Custom UI in Default Mode is enabled, Showing the following panel IDs: ' } for (let i = 0; i < hideCustomPanels_inDefaultMode_PanelIds.length; i++) { panels.Panels.push(hideCustomPanels_inDefaultMode_PanelIds[i]) xapi.command('UserInterface Extensions Panel Update', { PanelId: hideCustomPanels_inDefaultMode_PanelIds[i], Visibility: inverse }).catch(e => console.debug(e)) } console.debug(panels) } else { for (let i = 0; i < hideCustomPanels_inDefaultMode_PanelIds.length; i++) { panels.Panels.push(hideCustomPanels_inDefaultMode_PanelIds[i]) xapi.command('UserInterface Extensions Panel Update', { PanelId: hideCustomPanels_inDefaultMode_PanelIds[i], Visibility: 'Auto' }).catch(e => console.debug(e)) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hidePanels(){\n\tvar controller = abRepmAddEditLeaseInABuilding_ctrl;\t\n\tcontroller.abRepmAddEditLeaseInABuildingLeaseInfo_form.show(false);\n\tcontroller.abRepmAddEditLeaseInABuildingDocs_grid.show(false);\n\tcontroller.abRepmAddEditLeaseInABuildingBaseRents_grid.show(false);\n}", "function hideContr...
[ "0.725464", "0.7065207", "0.6750465", "0.67105985", "0.6627959", "0.6622119", "0.6595186", "0.6553107", "0.65338504", "0.653136", "0.6496401", "0.6493388", "0.6465505", "0.64373815", "0.64037937", "0.63856566", "0.6369869", "0.63603336", "0.63507223", "0.63385075", "0.6326461...
0.64652795
13