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
For the "Votes for deletion" page. Used to show "close" and "delete". Also, for the show/hide feature, as well as the show/hide all one. By: [[User:KettleMeetPot|KettleMeetPot]]
function closeAppear() { if ( wgPageName == "Emperor Jarjarkine_Wiki:Votes_for_deletion" && $(".discussions").length > 0 && wgAction != "edit" ) { var sAll = 0; var modeAll = 2; $(".discussions.cls-discuss").hide(); $(".show-a").html('<a href="javascript:void(0)">[show]</a>'); $(".hide-a").html('<a href="javascript:void(0)">[hide]</a>'); $(".s-all").html('<a href="javascript:void(0)">show/hide</a>'); $(".mode-all").html('(<a href="javascript:void(0)">all</a>)'); $(".show-a, .hide-a").click(function() { var IDa = $(this).attr("id"); var ClassA = $(this).attr("class").slice(0,6); var ClassB = $(this).attr("class").slice(6); var dID = "d-" + IDa.slice(-IDa.length + 2); if ( IDa.indexOf(".") != -1 || IDa.indexOf(":") != -1) { IDa = IDa.replace(/\./g,"").replace(/:/g,""); $(this).attr("id",IDa); dID = dID.replace(/\./g,"\\.").replace(/:/g,"\\:"); $("#" + dID).attr("id","d-" + IDa.slice(-IDa.length + 2)); dID = "d-" + IDa.slice(-IDa.length + 2); } if ( ClassA == "show-a" ) { $("#" + IDa).html('<a href="javascript:void(0)">[hide]</a>'); $("#" + IDa).attr("class","hide-a" + ClassB); $("#" + dID).show(); } if ( ClassA == "hide-a" ) { $("#" + IDa).html('<a href="javascript:void(0)">[show]</a>'); $("#" + IDa).attr("class","show-a" + ClassB); $("#" + dID).hide(); } }); $(".s-all").click(function() { if ( modeAll == 0 ) { if ( sAll == 0 ) { $(".show-a.open-d").html('<a href="javascript:void(0)">[hide]</a>'); $(".show-a.open-d").attr("class","hide-a open-d"); $(".discussions.o-discuss").show(); sAll = 1; } else if ( sAll == 1 ) { $(".hide-a.open-d").html('<a href="javascript:void(0)">[show]</a>'); $(".hide-a.open-d").attr("class","show-a open-d"); $(".discussions.o-discuss").hide(); sAll = 0; } } if ( modeAll == 1 ) { if ( sAll == 0 ) { $(".show-a.closed-d").html('<a href="javascript:void(0)">[hide]</a>'); $(".show-a.closed-d").attr("class","hide-a closed-d"); $(".discussions.cls-discuss").show(); sAll = 1; } else if ( sAll == 1 ) { $(".hide-a.closed-d").html('<a href="javascript:void(0)">[show]</a>'); $(".hide-a.closed-d").attr("class","show-a closed-d"); $(".discussions.cls-discuss").hide(); sAll = 0; } } if ( modeAll == 2 ) { if ( sAll == 0 ) { $(".show-a").html('<a href="javascript:void(0)">[hide]</a>'); $(".show-a.open-d").attr("class","hide-a open-d"); $(".show-a.closed-d").attr("class","hide-a closed-d"); $(".discussions").show(); sAll = 1; } else if ( sAll == 1 ) { $(".hide-a").html('<a href="javascript:void(0)">[show]</a>'); $(".hide-a.open-d").attr("class","show-a open-d"); $(".hide-a.closed-d").attr("class","show-a closed-d"); $(".discussions").hide(); sAll = 0; } } }); $(".mode-all").click(function() { if ( modeAll == 0 ) { $(".mode-all").html('(<a href="javascript:void(0)">closed</a>)'); modeAll = 1; } else if ( modeAll == 1 ) { $(".mode-all").html('(<a href="javascript:void(0)">all</a>)'); modeAll = 2; } else if ( modeAll == 2 ) { $(".mode-all").html('(<a href="javascript:void(0)">open</a>)'); modeAll = 0; } }); if ( $.inArray("sysop", wgUserGroups) != -1) { $(".Dates").replaceWith(' • <span class="cDelete"><a href="javascript:void(0)">delete</a></span>'); $(".cDiscuss").html('<a href="javascript:void(0)">close</a>'); $(".tool-descriptor").html("Administrator toolbar"); $(".sys-tool").html('<b><a href="javascript:void(0)">archive all</a></b>'); $(".sys-tool").prepend('<span class="close-select"><b><a href="javascript:void(0)">close select</a></b></span> • '); closeApprove = true; archiveClick(); } if ( $(".AJAXRefresh").length > 0 ) { $(".AJAXRefresh").html('<a href="javascript:void(0)">Refresh</a>'); $(".AJAXRefresh").click(function() { $(".archive").html('<div style="text-align:center; padding:8px"><img src="https://images.wikia.nocookie.net/__cb61992/common/skins/common/images/ajax.gif"/></div>'); $.ajax({ type: "GET", url: "http://emperor-jarjarkine.wikia.com/index.php", data: { action:'render', title:'Avatar Wiki:Votes for deletion' }, success: function( data ) { var startChar = data.indexOf('<div class="FRow archive" id="Demarc0">'); var finishChar = data.lastIndexOf('</div>'); var processedData = data.slice(startChar,finishChar); $(".archive").html( processedData ); closeAppear(); closeClick(); } }); }); } } else if ( wgPageName == "Emperor Jarjarkine_Wiki:Votes_for_deletion" ) { $(".AJAXRefresh").html('<a href="javascript:void(0)">Refresh</a>'); $(".AJAXRefresh").click(function() { $(".archive").html('<div style="text-align:center; padding:8px"><img src="https://images.wikia.nocookie.net/__cb61992/common/skins/common/images/ajax.gif"/></div>'); $.ajax({ type: "GET", url: "http://emperor-jarjarkine.wikia.com/index.php", data: { action:'render', title:'Emperor Jarjarkine:Votes for deletion' }, success: function( data ) { var startChar = data.indexOf('<div class="FRow archive" id="Demarc0">'); var finishChar = data.lastIndexOf('</div>'); var processedData = data.slice(startChar,finishChar); $(".archive").html( processedData ); closeAppear(); closeClick(); } }); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteVotes(id, offerid){\n\t\n\t\tbootbox.confirm(__(\"Are you sure you want to delete this vote?\"),__('No'),__('Yes'),function(r){\n\t\n\t\n\t\tif(!r){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\tdeleteVote(id, offerid);\n\t\t}\n\t\t\n\t});\n}", "function handlenoteDelete() {\n var currentnote =...
[ "0.600304", "0.5923789", "0.58830684", "0.5774274", "0.5767797", "0.57634306", "0.573743", "0.57075894", "0.5693932", "0.5690193", "0.5656177", "0.56561273", "0.5627948", "0.5617466", "0.5590266", "0.55696195", "0.55671084", "0.55466986", "0.55384266", "0.5527482", "0.5511389...
0.5816133
3
For the "close" and "delete" functions. By [[User:KettleMeetPot|KettleMeetPot]]
function closeClick() { if ( wgPageName == "Emperor Jarjarkine_Wiki:Votes_for_deletion" && closeApprove == true) { $(".cDiscuss").click(function() { var ID = $(this).attr("id").replace(/_/g," "); globalID = $(this).attr("id"); demarcationID = $(".FRow:last").attr("id"); $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'query', prop:'revisions', titles:'Emperor Jarjarkine_Wiki:Votes_for_deletion', rvprop:'content' }, success: function (data) { var fsplit = data.split("{{Discussion navigation}}"); var secsplit = fsplit[1].split("&amp;lt;/dpl&amp;gt;"); var content = secsplit[0].replace(/&amp;lt;/g,"<").replace(/&amp;quot;/g,'"').replace(/&amp;gt;/g,">").replace(/&amp;amp;/g,"&").replace(/<a href=\"/g,"").replace(/\">http:\/\/emperor-jarjarkine.wikia.com\/wiki\/.*<\/a>/g,""); var Sliced = content.split("<!-- Demarcation: Do NOT remove this notice -->"); var demarcation = parseInt(demarcationID.slice(6),10) + 1; var edittoken = mw.user.tokens.get( 'editToken' ); var consensus; importArticles({ type: "style", article: "MediaWiki:Communitydiscussionpages.css" }); $('<div id="dialog-confirm" title="Measure of consensus">What was the outcome of the discussion?</div>').appendTo('body'); mw.loader.using( ['jquery.ui.dialog', 'jquery.ui.core', 'jquery.ui.position', 'jquery.ui.button', 'jquery.ui.widget'], function () { if ( $.attrFn ) { $.attrFn.text = true; } $("#dialog-confirm").dialog({ resizable: false, draggable: false, height: "auto", closeOnEscape: true, modal: true, buttons: [ { text:"Keep", click: function () { consensus = "Page kept."; $(this).dialog("close"); } }, { text:"Merge", id:"merge-button", click: function () { $("#merge-button").prop("disabled", true); $("#dialog-confirm").html("What was the outcome of the discussion?<br><br>") $('<div id="dialog-input" style="width: auto; height: auto;">Merge into: <input type="text" name="title" id="pagename-input" placeholder="fullpagename" style="width:40%; margin-right:8px"><button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" id="Ok-widget-button" style="margin-bottom:4px"><span class="ui-button-text">Ok</span></button></div>').appendTo("#dialog-confirm"); $("#Ok-widget-button").click(function() { boxInput = $("#pagename-input").val(); consensus = "Page will be merged with [[" + boxInput + "]]."; $("#dialog-confirm").dialog("close"); }); } }, { text:"Delete", click: function () { consensus = "Page deleted."; $(this).dialog("close"); } }, ], close: function(event, ui) { content = "{{Discussion navigation}}" + Sliced[0] + "| T" + demarcation + " = " + ID + " |\n{{Discussion Closed|" + consensus + "}}\n{{subst:Emperor Jarjarkine_Wiki:Votes for deletion/" + ID + "}}" + "\n<!-- Demarcation: Do NOT remove this notice -->" + Sliced[1] + "</dpl>"; $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'edit', title:'Emperor Jarjarkine_Wiki:Votes_for_deletion', text: content, summary:'Archiving discussion.', token: edittoken }, }); $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'delete', title:'Emperor Jarjarkine_Wiki:Votes_for_deletion/' + globalID, reason:'Closing discussion.', token: edittoken }, }); window.location.reload(); } }); }); } }); }); $(".cDelete").click(function() { var ID = $(this).parent().children(".cDiscuss").attr("id"); window.open("http://emperor-jarjarkine.wikia.com/wiki/Emperor Jarjarkine_Wiki:Votes_for_deletion/" + ID +"?action=delete&wpReason=Deleting%20irrelevant%20discussion"); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Close() {\n\n }", "function Close() {\n } // Close", "function onOpenClose(){if(typeof this.fd==='number'){// actually close down the fd\nthis.close();}}", "onClose(removed) {}", "close() {\n this.sendAction('close');\n }", "function del_current_fifter(close){\n $close = $(close);\n $...
[ "0.6270113", "0.62539965", "0.61800706", "0.6154612", "0.6146269", "0.6093909", "0.6089339", "0.6038159", "0.59934247", "0.58975345", "0.5876508", "0.5876508", "0.5865882", "0.5865571", "0.58430517", "0.584179", "0.58359295", "0.5829981", "0.5829176", "0.5822879", "0.58216125...
0.0
-1
For the "archive all" function. By [[User:KettleMeetPot|KettleMeetPot]]
function archiveClick() { if ( wgPageName == "Emperor Jarjarkine_Wiki:Votes_for_deletion" && closeApprove == true ) { $(".sys-tool").click(function() { importArticles({ type: "style", article: "MediaWiki:Communitydiscussionpages.css" }); $('<div id="dialog-confirm" title="archive all">Are you sure you would like to archive all closed discussions?</div>').appendTo('body'); mw.loader.using( ['jquery.ui.dialog', 'jquery.ui.core', 'jquery.ui.position', 'jquery.ui.button', 'jquery.ui.widget'], function () { if ( $.attrFn ) { $.attrFn.text = true; } $("#dialog-confirm").dialog({ resizable: false, draggable: false, height: "auto", closeOnEscape: true, modal: true, buttons: [ { text:"Yes", click: function () { $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'query', prop:'revisions', titles:'Avatar_Wiki:Votes_for_deletion', rvprop:'content' }, success: function (data) { var split = data.split("|}\n{{Format"); var content = split[1].split("&amp;lt;!-- Demarcation: Do NOT remove this notice --&amp;gt;") var edittoken = mw.user.tokens.get( 'editToken' ); var archive = split[0].split("}}") var fsplit = split[0].split("{{Discussion navigation}}"); var archiveNum = fsplit.split("}}"); archiveNum = archiveNum[0].slice(-2).replace(/|/,""); var nextArchive = parseInt(archiveNum) + 1; fsplit = fsplit[1].replace(/\| T\d* =/g,"\n==").replace(/\|\n\{\{/g,"==\n{{").replace(/&amp;lt;/g,"<").replace(/&amp;quot;/g,'"').replace(/&amp;gt;/g,">").replace("|" + archiveNum + "}}","|" + nextArchive + "}}"); var secsplit = content[1].split("&amp;lt;/dpl&amp;gt;"); secsplit = secsplit[0].replace(/\| T\d* =/g,"\n==").replace(/\|\n\{\{/g,"==\n{{").replace(/&amp;lt;/g,"<").replace(/&amp;quot;/g,'"').replace(/&amp;gt;/g,">"); archive = archive[1].slice(-2).replace(/\|/g,""); archive = parseInt(archive) + 1; content = content[0].replace(/\| T\d* =/g,"\n==").replace(/\|\n\{\{/g,"==\n{{").replace(/&amp;lt;/g,"<").replace(/&amp;quot;/g,'"').replace(/&amp;gt;/g,">"); $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'edit', title:'Emperor Jarjarkine_Wiki:Votes_for_deletion/Archive_' + archive, text:"{{talkarchive}}" + content, summary:'Creating new archive', token: edittoken }, }); $.ajax({ type: "POST", url: "http://emperor-jarjarkine.wikia.com/api.php", data: { action:'edit', title:'Emperor Jarjarkine_Wiki:Votes_for_deletion', text: "{{Discussion navigation}}" + fsplit + "|}\n{{Format\n<!-- Demarcation: Do NOT remove this notice -->\n" + secsplit + "</dpl>", summary:'Creating new archive', token: edittoken }, }); } }); $(this).dialog("close"); } }, { text:"Cancel", click: function () { $(this).dialog("close"); $("#dialog-confirm").remove(); } }, ], }); }); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function archive() {\n vm.error = undefined;\n var promises = [];\n vm.todos.filter(function (todo) {\n return todo.completed;\n }).forEach(function (todo) {\n promises.push(_archive(todo));\n });\n\n $q.all(promises).t...
[ "0.65388364", "0.6031656", "0.58802557", "0.5793322", "0.5741232", "0.56024027", "0.55449665", "0.5541877", "0.5540081", "0.5515804", "0.5464233", "0.54307604", "0.5352858", "0.53518295", "0.534513", "0.5327826", "0.52628964", "0.5239142", "0.5197979", "0.5191908", "0.5173061...
0.0
-1
Button method close sheet without saving.
closeWithoutSaving() { const sheetName = this.get('closeSheetName') this.get('fdSheetService').rollbackCurrentItem(sheetName); this.confirmClose(sheetName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "closeWithSaving() {\n const sheetName = this.get('closeSheetName')\n this.get('fdSheetService').saveCurrentItem(sheetName, true);\n }", "function onClose() {\n if (!isActionSheetOpen.current) {\n Navigation.dismissOverlay(componentId);\n }\n }", "function onClose() {\n if (!isActionSheetO...
[ "0.7764902", "0.6784473", "0.6784473", "0.653303", "0.63223547", "0.63204664", "0.6280046", "0.62722516", "0.6242167", "0.62165785", "0.61930865", "0.61598074", "0.6143568", "0.61163086", "0.60978764", "0.6096772", "0.6096772", "0.6096772", "0.6043881", "0.60309917", "0.59986...
0.7401484
1
Button method save and close sheet.
closeWithSaving() { const sheetName = this.get('closeSheetName') this.get('fdSheetService').saveCurrentItem(sheetName, true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "closeWithoutSaving() {\n const sheetName = this.get('closeSheetName')\n this.get('fdSheetService').rollbackCurrentItem(sheetName);\n this.confirmClose(sheetName);\n }", "function save ()\n {\n $uibModalInstance.close(vm.item);\n }", "function saveAndExit() {\n ...
[ "0.658167", "0.652474", "0.62201965", "0.6186926", "0.6125711", "0.6085243", "0.60583186", "0.6017914", "0.60128427", "0.6012832", "0.59898955", "0.59464777", "0.59022284", "0.5885294", "0.58716226", "0.58231175", "0.5816282", "0.5790984", "0.5676336", "0.5676336", "0.5667803...
0.7764474
0
After returning to main screen from other screen in the site
static restoreSelectedSwitchesInMainScreen(symbolsArr) { symbolsArr.forEach(function(symbol) { $(`#${symbol}`).prop("checked", true); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function returnToMainScreen() {\n if ($percCookieSiteTable.fnClearTable !== undefined) {\n $percCookieSiteTable.fnClearTable();\n }\n $('.cookie-consent-site-stats').hide();\n $('#delete-btn-site').hide();\n $('#delete-btn-all').show();\n $('#advanced').addClass...
[ "0.72739637", "0.6836959", "0.6735878", "0.66409266", "0.6579563", "0.65522593", "0.6457241", "0.64409244", "0.642298", "0.6392403", "0.6389071", "0.6316404", "0.6286425", "0.6266742", "0.62640136", "0.62638116", "0.62635326", "0.62616074", "0.62613744", "0.6256071", "0.62481...
0.0
-1
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at < Redux actions for the search state
function addSearchQuery(cx, query) { return { type: "ADD_QUERY", cx, query }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function search (state = '', action) {\n switch (action.type) {\n case INFORMATION_UPDATE_SEARCH:\n return action.value\n\n case INFORMATION_CLEAR_SEARCH:\n return ''\n\n default:\n return state\n }\n}", "search() {\n\t\tthis.props.onSearch(this.state.term);\n\t}", "function searchRed...
[ "0.7706961", "0.73616976", "0.73032963", "0.71947926", "0.7121118", "0.70772076", "0.7018136", "0.70005715", "0.69931114", "0.6952204", "0.6917944", "0.68207926", "0.68108606", "0.67667747", "0.67456853", "0.67100334", "0.6708941", "0.6704832", "0.66680425", "0.66554266", "0....
0.0
-1
You will be given an array (a) and a value (x). All you need to do is check whether the provided array contains the value, without using a loop. Array can contain numbers or strings. X can be either. Return true if the array contains the value, false if not. With strings you will need to account for case.
function check(a,x){ return a.some(element => element == x) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contains(arr, x) {\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] === x) return true;\n }\n return false;\n }", "function contains(arr, x) {\n for (let i = 0; i < arr.length; i++) {\n if (arr[i] === x) {\n return true;\n }\n }\n return false;\n}", ...
[ "0.8176493", "0.81291085", "0.80173653", "0.7809401", "0.7735965", "0.77010363", "0.77010363", "0.76982313", "0.76982313", "0.76982313", "0.76978886", "0.75953937", "0.7569852", "0.7568723", "0.756283", "0.74789995", "0.74748945", "0.7473922", "0.7464376", "0.7433884", "0.743...
0.734581
29
Returns a random phrase from the phrases array
getRandomPhrase () { const phrases = this.phrases; const randIndex = Math.floor(Math.random() * phrases.length); return phrases[randIndex]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomPhrase() {\n const phrase = phrases[Math.floor(Math.random() * phrases.length)];\n return phrase;\n}", "function getRandomPhraseAsArray(arr) {\n let pick = Math.floor(Math.random() * arr.length);\n return phrases[pick];\n}", "getRandomPhrase() {\n const randomNumber = Math.floor(Ma...
[ "0.8513017", "0.8383263", "0.8343142", "0.8343142", "0.8343142", "0.8326532", "0.83141935", "0.83011556", "0.8273669", "0.8270718", "0.82391804", "0.82370436", "0.82281893", "0.81543237", "0.81147563", "0.8100584", "0.8100584", "0.8094644", "0.8080133", "0.8065723", "0.804620...
0.84569424
1
Increment missed counter and alter heart image if life is lost
removeLife () { const lives = document.getElementsByClassName("tries"); this.missed++; for (let i=0; i<this.missed; i++){ lives[i].innerHTML = `<img src="images/lostHeart.png" alt="Lost Heart Icon" height="35" width="30">`; } // Lose the game if user runs out of lives if (this.missed === 5){ this.gameOver(false); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeLife() {\n heartNodes[this.missed].src = 'images/lostHeart.png';\n this.missed += 1;\n if (this.missed === heartNodes.length) {\n this.gameOver(false);\n }\n }", "removeLife() {\r\n let heart = document.getElementsByTagName('img');\r\n heart[this.missed].setA...
[ "0.7489492", "0.7144877", "0.71126765", "0.7092963", "0.70334816", "0.69606113", "0.69494385", "0.6942037", "0.68981504", "0.68339264", "0.68173593", "0.6800112", "0.6789708", "0.6781099", "0.67639846", "0.6747806", "0.67064005", "0.6676143", "0.6665336", "0.66474426", "0.664...
0.60102326
62
Function is declared in the current existig (enclosing) scope
function foo () { return "Bar"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function someFunction() {\r\n // Local Scope #1\r\n function someOtherFunction() {\r\n // Local Scope #2\r\n }\r\n}", "FunctionDeclaration() {\n pushContext();\n }", "function someFunction() {\n // Local Scope #1\n function someOtherFunction() {\n // Local...
[ "0.69811606", "0.6943759", "0.69380796", "0.68799454", "0.6865237", "0.68526596", "0.6793431", "0.67850965", "0.6701261", "0.6659013", "0.6627059", "0.65843856", "0.6567878", "0.6561872", "0.65543056", "0.65454143", "0.6528692", "0.6521522", "0.6517772", "0.651613", "0.649350...
0.0
-1
END saveSpiel() [ errorHandler() ]
function errorHandler(e) { var msg = ''; switch (e.code) { case FileError.QUOTA_EXCEEDED_ERR: msg = 'QUOTA_EXCEEDED_ERR'; break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'; break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR'; break; case FileError.INVALID_MODIFICATION_ERR: msg = 'INVALID_MODIFICATION_ERR'; break; case FileError.INVALID_STATE_ERR: msg = 'INVALID_STATE_ERR'; break; default: msg = 'Unknown Error'; break; } console.log('Error: ' + msg); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "save() {}", "function save() {\n Bar.createWithConfig(dataForm.name, dataForm.frequency, PoP.getFinalStatements().getItem(dataForm.final_statement))\n .then(() => {\n goBack();\n return Promise.resolve()\n })\n .catch(error => {\n console.log(error);\n console.dir(error);\n con...
[ "0.6628752", "0.6422631", "0.6335497", "0.6316256", "0.6288652", "0.6286282", "0.6275508", "0.62487173", "0.6214662", "0.61547756", "0.6128763", "0.6115053", "0.6101809", "0.609764", "0.60941136", "0.6058612", "0.60518914", "0.60399634", "0.6038855", "0.6025671", "0.59949356"...
0.0
-1
Displays recent tokens as quick search links
function QueryRecentTokens() { var email = CacheStoreGet("email"); var authToken = CacheStoreGet("token"); var data = { Email: email, AuthToken: authToken, Latitude: userLat, Longitude: userLng }; $.ajax({ type: "POST", url: "../note/QueryRecentTokens", data: data, success: function (response) { if (response != null) { localStorage.setItem("recentTokens", JSON.stringify(response)); PopulateRecentTokenDisplays(response); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayChanges(tiddlers) {\n $.each(tiddlers, function(index, tiddler) {\n if (!tiddler.type \n || tiddler.type.match(/^text/)) {\n $.each(tiddler.tags, function(index, tag) {\n recentTags.add(tag);\n })\n var penSpan = $('<span>').text(...
[ "0.59259725", "0.5912451", "0.5720877", "0.56542844", "0.5644335", "0.55709684", "0.55578554", "0.5451679", "0.5439425", "0.5439425", "0.5363226", "0.53194386", "0.52875847", "0.52714527", "0.5270312", "0.524372", "0.5239619", "0.5201644", "0.5194869", "0.5193146", "0.5191968...
0.5007218
47
updates note on server and updates UI appropriately
function UpdateNote(noteNodeObj) { // Prevent two facades from updating the same note // this can happen in the "complete" logic if (noteNodeObj.note().updating) { return; } noteNodeObj.note().updating = true; // update each save button to display loading ShowLoadingByClassName("SaveEditButton"); var noteContents = noteNodeObj.note().contents(); if (noteContents == "") { HideButtonImageByClassName("SaveEditButton"); return; } var email = CacheStoreGet("email"); var authToken = CacheStoreGet("token"); var today = new Date(); var data = { Email: email, AuthToken: authToken, NoteContents: noteContents, Completed: noteNodeObj.note().completed(), City: userCity, Latitude: userLat, Longitude: userLng, RowKey: noteNodeObj.note().noteId }; $.ajax({ type: "POST", url: "../note/UpdateNote", data: data, success: function (response) { if (response.Status == "Success") { cachedNotes.UpdateNote(response.Note); noteNodeObj.onSuccessfulUpdate(); } if (response.Status == "Expired") { // Auth token has expired AuthUserAndSetCookie(email, CacheStoreGet("password"), function () { UpdateNote(noteNodeObj); }, // on success function () { Redirect('Signup.html'); showError("Please log in to continue"); }) // on failure } HideButtonImageByClassName("SaveEditButton"); } }); // Unlock the note window.setTimeout(function () { noteNodeObj.note().updating = false; }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateNote(worker, note) {\n if (note != null) {\n note = datastore.updateNote(note);\n worker.port.emit(\"NoteUpdated\", note);\n }\n}", "function updateNote(noteEl) {\n const noteText = document.getElementById('note-text').value\n fetch(url + '/' + `${noteEl.parentElement.id} `, {\n ...
[ "0.7333453", "0.7317997", "0.6923655", "0.69101566", "0.67470664", "0.6739527", "0.66760373", "0.6638135", "0.66198355", "0.65872747", "0.655937", "0.6505686", "0.6501371", "0.649076", "0.648418", "0.6480327", "0.64525676", "0.64412075", "0.6432651", "0.64277625", "0.6414278"...
0.67257565
6
delete note on server and updates UI appropriately
function DeleteNote(noteNodeObj) { // update each save button to display loading ShowLoadingByClassName("DeleteNoteButton"); var email = CacheStoreGet("email"); var authToken = CacheStoreGet("token"); var data = { Email: email, AuthToken: authToken, RowKey: noteNodeObj.note().noteId }; $.ajax({ type: "POST", url: "../note/DeleteNote", data: data, success: function (response) { if (response == "Expired") { // Auth token has expired AuthUserAndSetCookie(email, CacheStoreGet("password"), function () { DeleteNote(noteNodeObj); }, // on success function () { Redirect('Signup.html'); showError("Please log in to continue"); }) // on failure } else { if (response == "RefreshRecent") { QueryRecentTokens(); } noteNodeObj.onSuccessfulDelete(); // attempt to remove it from recent cachedNotes.DeleteNote(noteNodeObj.note().noteId); } HideButtonImageByClassName("DeleteNoteButton"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function note_delete()\n {\n // grab the .data element of note to delete\n var axe_it = $(this).data(\"_id\");\n $.ajax(\n {\n url: \"/api/notes/\" + axe_it,\n method: \"DELETE\"\n }).then(function()\n {\n // on success, hide the modal\n bootbox.hideAll();\n });\n }", "...
[ "0.754349", "0.75392735", "0.75181603", "0.7425493", "0.73937386", "0.7334409", "0.73153305", "0.7305322", "0.7290666", "0.7274384", "0.7268904", "0.7246179", "0.72233987", "0.7206369", "0.72047144", "0.71585107", "0.7154413", "0.71165454", "0.7113576", "0.7104984", "0.709609...
0.7011757
37
In this croquet club, handicaps range from 2 to +26; the better the player the lower the handicap. Input will consist of a list of lists containing two items each. Each list contains information for a single potential member. Information consists of an integer for the person's age and an integer for the person's handicap.
function openOrSenior(data){ // ... var newArray = []; for (var i = 0; i < data.length; i++){ if (data[i][0] >= 55 && data[i][1] > 7){ newArray.push("Senior"); } else { newArray.push('Open'); }; } return newArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getScore(whoseHand) {\n\t\tfor (let i=0; i<whoseHand.length; i++){\n\t\t\n\t\t\t// Set value of face cards\n\t\t\tif (typeof(whoseHand[i]) === 'string') {\n\t\t\t\tif (whoseHand[i] === 'A') { \n\t\t\t\t\twhoseHand[i] = 11;\n\t\t\t\t\taces++;\n\t\t\t\t} else {\n\t\t\t\t\twhoseHand[i] = 10;\n\t\t\t\t}\n\t\t...
[ "0.5311189", "0.53063136", "0.5296378", "0.5296378", "0.5295549", "0.5282417", "0.5261605", "0.525584", "0.52294946", "0.5224053", "0.52170104", "0.5216957", "0.52089393", "0.52032685", "0.5198814", "0.5182998", "0.51767015", "0.51743245", "0.51622224", "0.51450825", "0.51442...
0.0
-1
This is our `update` function that will get triggered by the `requestUpdate` method. Any time we set a property on this element, we'll also trigger an update.
update() { console.log('updating!'); this.shadowRoot.innerHTML = ` <div>value of a: ${this.a}</div> <div>value of b: ${this.b}</div> `; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_requestUpdate(name,oldValue){let shouldRequestUpdate=!0;// If we have a property key, perform property update steps.\nif(name!==void 0){const ctor=this.constructor,options=ctor._classProperties.get(name)||defaultPropertyDeclaration;if(ctor._valueHasChanged(this[name],oldValue,options.hasChanged)){if(!this._change...
[ "0.72600305", "0.7251511", "0.721216", "0.7181032", "0.6965474", "0.6944794", "0.69033456", "0.6891705", "0.68641025", "0.6856583", "0.68506217", "0.6839065", "0.6777387", "0.6771238", "0.6762954", "0.67552245", "0.67552245", "0.67259544", "0.66938925", "0.66938925", "0.66938...
0.0
-1
called once when instanced
function setup() { resetParameters(); loadShader("plasma"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__previnit(){}", "static ready() { }", "_reflow() {\n this._init();\n }", "initialize() { this._saveInstanceProperties(); }", "function init() {\n\t \t\n\t }", "init() {\n }", "function init() {\n //UH HUH, THIS MY SHIT!\n }", "initialize(){// ensures first ...
[ "0.67417896", "0.6684072", "0.66159546", "0.658373", "0.65639436", "0.655552", "0.6543187", "0.65427786", "0.6523542", "0.64546514", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0.64436275", "0....
0.0
-1
classNuToText converts enum to class label.
function classNumToText (props){ const {colIndex, rowIndex,grid} = props; let num = grid[colIndex][rowIndex]; switch (num){ case 1: return "black"; case 2: return "red"; case 11: return "black wins"; case 12: return "red wins"; default: return "white"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _makeLabel (n) {\n if (Array.isArray(n)) return _arrayToVec(n);\n if (typeof n === 'object') return 'fa_' + (n._id);\n else return n.toFixed(6);\n}", "static labelOf(t) {\n const label= !t.desc ? Filters.titlecase(t.name.replace(/[-_]/g, ' ')) /* friendlyish name */ :\n (typeof t.d...
[ "0.6098353", "0.58898973", "0.5831838", "0.5758314", "0.57263845", "0.5697312", "0.56697494", "0.56542087", "0.55759615", "0.5569282", "0.5538657", "0.5526886", "0.55071956", "0.5488564", "0.54478127", "0.543742", "0.5306785", "0.5294057", "0.5286106", "0.527915", "0.52445894...
0.61397135
0
Se carga la lista de departamentos y municipios
async function obtenerDepartamentos() { try { let response = await axios.get(URL_departamentos) let data = response.data.items let result = [] // Opcion por defecto result.push(<option value={0} key={0}>Seleccione una Opción</option>) for (let index in data) { result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>) } setDepartamentos(result) // Se obtiene el municipio por defecto a partir del departamento por defecto recalcularMunicipios() } catch (error) { console.log('Fallo obteniendo los departamentos / municipios' + error) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "function cargar_municipios(datos_muni...
[ "0.6734986", "0.66602004", "0.653661", "0.64129394", "0.63565135", "0.63446254", "0.62949705", "0.62602603", "0.6212332", "0.6197748", "0.6147786", "0.6145449", "0.6130968", "0.6126239", "0.60202247", "0.60123444", "0.60041565", "0.59630895", "0.5961104", "0.5932889", "0.5875...
0.73978484
0
Funcion para consultar en base de datos los nombres y apellidos a partir del numero de documento
async function obtenerNombreCompleto() { // Se valida si se ha diligenciado el campo documento if (watch('documento') !== ''){ try { let URL = URL_nombre_completo URL += watch('documento') let response = await axios.get(URL) let result = await response.data setNombreCompleto(result); } catch (error) { console.log('Fallo obteniendo los nombres y apellidos' + error) } } else { setNombreCompleto("Se autocompleta con el No. de documento..."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remplirLesDonnees(data) {\n lesDocuments = data.lesDocuments;\n for (const documents of lesDocuments){\n afficherDocument(documents)\n }\n}", "function buscarModulos(busqueda, regex) {\n\n return new Promise((resolve, reject) => {\n\n Modulo.find({}, 'nombre tipo estado usuario...
[ "0.5559556", "0.5538495", "0.553293", "0.5397457", "0.53570396", "0.53490955", "0.5326134", "0.5321139", "0.52882993", "0.5284173", "0.5243029", "0.5240028", "0.52252537", "0.5212058", "0.5206271", "0.51986694", "0.5192781", "0.51623863", "0.515546", "0.5148614", "0.5133019",...
0.5905101
0
Recalcular listado de municipios con base al departamento seleccionado
async function recalcularMunicipios() { try { let URL = URL_municipios URL += watch('departamento') let response = await axios.get(URL) let data = await response.data.items let result = [] // Opcion por defecto result.push(<option value={0} key={0}>Seleccione una Opción</option>) for (let index in data) { result.push( <option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option> ) } setMunicipios(result) } catch (error) { console.log('Fallo obteniendo los municipios' + error) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (le...
[ "0.6432732", "0.6351011", "0.6192081", "0.61283785", "0.6064947", "0.59984577", "0.5974175", "0.59726495", "0.59365463", "0.5886678", "0.5739219", "0.5719336", "0.5697672", "0.56490976", "0.5633712", "0.56298995", "0.56070954", "0.55704844", "0.55566484", "0.5547164", "0.5543...
0.6978294
0
Agregar una persona a cargo en el datagrid de personas a cargo
function agregar() { // Máximo pueden haber 4 personas a cargo if (props.personasaCargo.length < 4){ let result = [...props.personasaCargo]; result.push([,"", "",]) cambiarPersonasaCargo(result); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "agregarPersonajes(personaje) {\n this.personajes.push(personaje);\n }", "addPerson() {\n this.people.pushObject(this.personName);\n }", "agregarPersona(id, nombre, sala) {\n\n let persona = { id, nombre, sala }\n\n //agregar la \"persona\" recibida al arreglo de personas\n ...
[ "0.64950323", "0.6444278", "0.6369781", "0.62349975", "0.6185863", "0.60871744", "0.6008432", "0.59491014", "0.5875018", "0.58600676", "0.58280057", "0.57749724", "0.5760148", "0.5731279", "0.5717448", "0.5698203", "0.5675311", "0.56695163", "0.5601724", "0.55939764", "0.5592...
0.6652078
0
Celda para ingresar datos
function renderEditable(cellInfo) { const aboutUserText = "<img onerror='alert(\"Hacked!\");' src='invalid-image' />"; return ( <div className = "cell" contentEditable // La variable de estado se actualiza cada vez que se suelta el foco de la celda actual onBlur = {e => { // Se valida si la edad es numerica o no if (cellInfo.column.id === 3){ if (!isNaN(e.target.innerHTML)){ const newData = [...props.personasaCargo]; newData[cellInfo.index][cellInfo.column.id] = e.target.innerHTML; cambiarPersonasaCargo(newData); } } else { const newData = [...props.personasaCargo]; newData[cellInfo.index][cellInfo.column.id] = e.target.innerHTML; cambiarPersonasaCargo(newData); } }} dangerouslySetInnerHTML = {{ __html: props.personasaCargo[cellInfo.index][cellInfo.column.id] /* __html: aboutUserText */ }} /> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getData() {\n let cleanService = await CleanServiceModel.getCleanServiceById(id);\n setDitta(cleanService.ditta);\n setEmail(cleanService.email);\n setTelefono(cleanService.numeroTel);\n setDataAssunzione((new Date(cleanService.dataAssunzione.seconds * 1000)).toLoc...
[ "0.60697067", "0.5780097", "0.5739184", "0.5654251", "0.5617345", "0.55710477", "0.554787", "0.55423343", "0.55383587", "0.5535877", "0.5522522", "0.5522182", "0.5518094", "0.5497508", "0.5480045", "0.54667646", "0.5454786", "0.5438436", "0.5430082", "0.54180545", "0.54135597...
0.0
-1
Celda para eliminar la fila
function renderDelete(cellInfo) { return ( <Button onClick = {e => { // Mínimo debe haber una persona a cargo if (props.personasaCargo.length > 1){ let result = [...props.personasaCargo]; result.splice(cellInfo.index , 1); cambiarPersonasaCargo(result); } }} size="sm" variant="danger" className="rellenar"> Eliminar </Button> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removerFila(cont_partida)\n{\n\tactualizarTotal(-1*regresarFloat($(\"#importe_\"+cont_partida).val()));\n\n\t$(\"#tr_\"+cont_partida).remove();\n}", "function eliminarFila(id_tabla, id_fila)\r\n{\r\n var TABLA = $(id_tabla);\r\n if(TABLA.rows.length > 1)\r\n {\r\n\t var FILAS = TABLA.rows;\r\n...
[ "0.7876932", "0.74942636", "0.7486997", "0.7413939", "0.73556995", "0.7302456", "0.7237705", "0.72330207", "0.7174539", "0.70933974", "0.701447", "0.70037854", "0.6915748", "0.6897243", "0.6888558", "0.686472", "0.68101996", "0.6803581", "0.6784887", "0.6774764", "0.6774179",...
0.0
-1
Special case '(abc)', '((a)b)', 'abc(())' would be valid and ')a(' '((b())' would be invalid. '()()' is not valid
function isValid2(s){ if(!s || !s.trim()) return false; let openCount = 0; s=s.trim(); for(let i=0; i<s.length; i++){ if(s[i] == "(") openCount++; if (s[i] == ")"){ if (openCount === 0 || (openCount == 1 && i < s.length - 1)) return false; else openCount--; } } return openCount == 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parensValid(string) {\r\n}", "function validParenthesis(str){\n var hasParenthesis = /[()]/;\n var validParenthesis = /\\([0-9]{3}\\)/;\n if(hasParenthesis.test(str)){\n if(validParenthesis.test(str)){\n return true;\n }\n return false;\n }\n return true;\n}", "function checkParens(s...
[ "0.7333383", "0.6978718", "0.6918531", "0.69021803", "0.68431556", "0.68228406", "0.68226886", "0.6651047", "0.66356325", "0.65786415", "0.6535797", "0.6478315", "0.6451493", "0.63995856", "0.63649476", "0.63547367", "0.62954086", "0.62896013", "0.6282761", "0.62640125", "0.6...
0.6675185
7
Can be solved using frequency Counter trying to solve via pointer approach
function noOfUniqueValues(arr){ let i=0; for(let j=1;j<arr.length;j++){ if(arr[j]!==arr[i]){ i++; arr[i]=arr[j] } } return i+1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countFreq() {\n diceFreq.fill(0);\n diceResults.forEach((el) => diceFreq[el - 1]++);\n}", "calculate_frequencies(node, choice, count) {\n let updates = 0;\n let freq = [];\n let arr = (choice === 0) ? node.row : (choice === 1) ? node.col : node.sqr;\n\n if (node.solved) {\n...
[ "0.6646957", "0.6198939", "0.61736786", "0.6111287", "0.59843534", "0.5921587", "0.5836337", "0.5832837", "0.58219665", "0.5811309", "0.57978106", "0.57860434", "0.5733541", "0.5730377", "0.5725221", "0.5693766", "0.5684609", "0.5671703", "0.56406194", "0.5639945", "0.5635796...
0.0
-1
TODO: Not fully implemented for POC
render() { return ( <div class="form-group"> <label class="label" for="features">Key features</label> { this.state.features.map( feature => ( <input class="input input--shortest input--feature" name="features" type="text" value={ feature } /> ))} <button class={style.features__button} onClick={ this.handleClick }>Add feature</button> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "protected internal function m252() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "obtain(){}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "trans...
[ "0.61969167", "0.6143896", "0.6123826", "0.5969905", "0.5703632", "0.5662298", "0.56346583", "0.554736", "0.551884", "0.5475792", "0.5447084", "0.53429925", "0.53429925", "0.5332564", "0.5332564", "0.5332564", "0.5332564", "0.5332564", "0.5332564", "0.5332564", "0.5332564", ...
0.0
-1
notify parent that tween has ended
tweenHasEnded (characterUID) { // console.warn(`tweenHasEnded HAPPY GO LUCKY ${characterUID}`); if (this.props.onTweenFinish) { this.props.onTweenFinish(characterUID); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "notifyAnimationEnd() {}", "function TweenComplete() {\n tweenSlide.eventComplete(function () {\n // Reset 'style' & 'transform' for slide\n that.ResetTFSlideCss();\n // Update the variable in toggle-end\n that.TOSLIDE.End(...
[ "0.74193245", "0.6730198", "0.65552783", "0.65159416", "0.64879155", "0.6447675", "0.6397675", "0.6158307", "0.6116692", "0.6091322", "0.60566294", "0.5942789", "0.5925302", "0.5907035", "0.58980256", "0.58743864", "0.58632576", "0.58577156", "0.5826781", "0.5821376", "0.5793...
0.67982423
1
Interacts with smart contract to buy PCT
async function buyPCT() { // Converts integer as Eth to Wei, let amount = await ethers.utils.parseEther(transAmount.toString()); try { await erc20.buyToken(transAmount, { value: amount }); // Listens for event on blockchain await erc20.on("PCTBuyEvent", (from, to, amount) => { setPendingFrom(from.toString()); setPendingTo(to.toString()); setPendingAmount(amount.toString()); setIsPending(true); }) } catch (err) { if (typeof err.data !== 'undefined') { setErrMsg("Error: " + err.data.message); } setIsError(true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async approveCompound(){\n let spender = Compound.util.getAddress(Compound.cDAI, process.env.ETH_NETWORK);\n //spender = '0xF0d0EB522cfa50B716B3b1604C4F0fA6f04376AD'; //cDAI\n console.log('spender: ' + spender);\n let param = cDAI.methods().approve.call({ spender: spender, amount: '3000...
[ "0.6989427", "0.68070185", "0.6780074", "0.67103094", "0.6587158", "0.6583129", "0.65667874", "0.65234774", "0.65128905", "0.64936507", "0.64729595", "0.6448512", "0.64294785", "0.6427884", "0.6357085", "0.6284114", "0.6282304", "0.6257249", "0.62560284", "0.6250145", "0.6244...
0.7291198
0
Interacts with smart contract to sell PCT
async function sellPCT() { try { await erc20.sellToken(transAmount); // Listens for event on blockchain await erc20.on("PCTSellEvent", (from, to, amount) => { setPendingFrom(from.toString()); setPendingTo(to.toString()); setPendingAmount(amount.toString()); setIsPending(true); }) } catch (err) { if (typeof err.data !== 'undefined') { setErrMsg("Error: " + err.data.message); } setIsError(true); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async instantiate(ctx){\n console.log('************ Pharnet Transporter Smart Contract Instantiated *************');\n\t}", "async approveCompound(){\n let spender = Compound.util.getAddress(Compound.cDAI, process.env.ETH_NETWORK);\n //spender = '0xF0d0EB522cfa50B716B3b1604C4F0fA6f04376AD'; //c...
[ "0.67187506", "0.6597626", "0.6564653", "0.64804304", "0.6382265", "0.6372014", "0.6367808", "0.63591576", "0.63151", "0.6226985", "0.6194143", "0.6170448", "0.6164739", "0.61347854", "0.61236125", "0.6079861", "0.6065798", "0.60639936", "0.60616034", "0.6054455", "0.6020632"...
0.6857746
0
Sets state for value to be transacted Clears extant alerts
function valueChange(value) { setTransAmount(value); setIsPending(false); setIsError(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear_alert() {\n let action = {\n type: 'clear/set',\n data: \"\",\n }\n store.dispatch(action);\n }", "_resetValueStateMessage() {\n this._setValueStateMessage(this._previousValueState.state, this._previousValueState.message);\n }", "reset(value) {\n super.reset(valu...
[ "0.5723365", "0.57226276", "0.5560636", "0.5528728", "0.55265176", "0.55072325", "0.5475948", "0.5462122", "0.5409186", "0.5407828", "0.52995497", "0.51989734", "0.5198372", "0.51835716", "0.5182699", "0.5182699", "0.5167269", "0.5155649", "0.5143768", "0.51327205", "0.512027...
0.56878257
2
functions for local storage
function lsSet(key, val) { return window.localStorage.setItem(key, val); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LocalSettingStorage() {\n}", "function LocalStorage() \n{\nthis.setMany = function(map, onSuccess, onError)\n{\nsetTimeout(function() {\ntry {\nfor ( var key in map )\nlocalStorage.setItem( key, map[key] );\nif (onSuccess) \nonSuccess();\n} catch (ex) {\n(onError || defaultErrorHandler)(ex);\n}\n}, 0);\...
[ "0.8080844", "0.78309387", "0.73977995", "0.7341993", "0.7341993", "0.73052126", "0.72621", "0.7257707", "0.7234483", "0.7231756", "0.7191458", "0.71912944", "0.7187855", "0.7157281", "0.7155157", "0.71415", "0.7133037", "0.7052891", "0.705038", "0.7046006", "0.7044798", "0...
0.0
-1
get a slice / part of the nodes queued objects for proccessing
function getQueuePart(node, size) { var context = node.context(); var part = []; if (size) { if (context.object_queue.length >= size) { for (var i = 0; i < size; i++) { part.push(context.object_queue.shift()); } } else { var ql = context.object_queue.length; for (var i = 0; i < ql; i++) { part.push(context.object_queue.shift()); } } } else { if (context.object_queue.length >= node.pagesize) { for (var i = 0; i < node.pagesize; i++) { part.push(context.object_queue.shift()); } } else { var size = context.object_queue.length; for (var i = 0; i < size; i++) { part.push(context.object_queue.shift()); } } } return part; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get () {\n\t\treturn queue.slice(nowPlaying);\n\t}", "printQueue(){\n return this.queue.slice(this.front,this.rear+1);\n }", "dequeue() {\n return this.processes.shift();\n // console.log('dequeu',this.processes[0]);\n }", "function _sliceBuffer(amount) {\n var newBuff...
[ "0.62579674", "0.59086746", "0.58773434", "0.58189785", "0.5642547", "0.5555309", "0.5540773", "0.5496877", "0.5440474", "0.5435695", "0.53355855", "0.5329713", "0.53250897", "0.5307996", "0.5298105", "0.5287273", "0.5269881", "0.52674496", "0.52665085", "0.5242574", "0.52405...
0.70424706
0
No hay clases, hay prototipos que son objetos, que le vamos agregando metodos que reciben funciones, saben quien es this y sabe como ejecutarlas. Pero no existe un sistema como tal, donde yo diga este prototipo va heredar de otro. Lo que si existe es la herencia prototipal. todas las funciones tienen el atributo prototype
function heredaDe(prototipoHijo, prototipoPadre) { var fn = function() {}; fn.prototype = prototipoPadre.prototype; prototipoHijo.prototype = new fn; prototipoHijo.prototype.constructor = prototipoHijo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una funcion vacia\n fn.prototype = prototipoPadre.prototype // Hacemos una copia del prototipo del Padre para guardarlo en el protitipo de nuestra funcion vacia\n prototipoHi...
[ "0.6886069", "0.656885", "0.6207858", "0.6134792", "0.60250014", "0.59856355", "0.5966292", "0.59559214", "0.5944942", "0.5885831", "0.5835889", "0.5823579", "0.58022684", "0.57965916", "0.57548565", "0.568458", "0.5676391", "0.5675715", "0.5675182", "0.5656196", "0.5653499",...
0.59836775
6
This file is automatically included by javascript_include_tag :defaults
function initCategories() { jQuery('.city h3').toggle( function() { jQuery(this).next("ul").show('fast'); jQuery(this).addClass('on'); return false; }, function() { jQuery(this).next("ul").hide('fast'); jQuery(this).removeClass('on'); return false; } ); jQuery('.city h3').hover( function() { jQuery(this).parent().addClass("js-hover"); return false; }, function(argument) { jQuery(this).parent().removeClass("js-hover"); return false; } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jsOnLoad(){\n\n}", "function setJs() {\n\t\t\tvar body = document.getElementsByTagName(\"body\")[0];\n\t\t\taddClass(body,'js');\n\t\t}", "function PaginaInicial_elementsExtraJS() {\n // screen (PaginaInicial) extra code\n\n }", "function Introducao_elementsExtraJS() {\n // screen (...
[ "0.5867077", "0.5810372", "0.56908464", "0.55790746", "0.548318", "0.5442478", "0.54247946", "0.53652877", "0.53514975", "0.53482634", "0.5323611", "0.53070503", "0.5300482", "0.5285206", "0.5273341", "0.5245496", "0.5241201", "0.52106607", "0.520653", "0.5202457", "0.5199078...
0.0
-1
Decoding base64 image Source:
function decodeBase64Image(dataString) { var matches = dataString.match(/^data:([A-Za-z-+\/]+);base64,(.+)$/); var response = {}; if (matches.length !== 3) { return new Error('Invalid input string'); } response.type = matches[1]; response.data = Buffer.from(matches[2], 'base64'); return response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decodeBase64Image(dataString) {\n\n \tconsole.log(\"Decoding base 64 image\");\n\n\t\tvar matches = dataString.match(/^data:([A-Za-z-+\\/]+);base64,(.+)$/),\n\t\tresponse = {};\n\n\t\tif (matches.length !== 3) {\n\t\t\treturn new Error('Invalid input string');\n\t\t}\n\n\t\tresponse.type = matches[1];\n\...
[ "0.7564775", "0.7341758", "0.7307353", "0.70639443", "0.7063326", "0.70070595", "0.6984309", "0.6944486", "0.69243026", "0.6923552", "0.6879048", "0.68724144", "0.6872352", "0.68554837", "0.68493557", "0.681064", "0.6801049", "0.67886406", "0.677794", "0.67547584", "0.6692501...
0.7215253
3
Fetch an image (html img snippet with inline base64 src attribute) snippet and save the image as file
function fetchImage2base64 (path, dest, key) { return limitedFetch(`${domain}${path}`) .then(r=>r.buffer()) .then(buf=>{ const imgdom = new JSDOM(buf); const src = imgdom.window.document.querySelector('img').getAttribute('src'); const imageBuffer = decodeBase64Image(src); const imageType = imageBuffer.type.match(/\/(.*?)$/)[1]; const imagePath = `${assets}${path}.${imageType}`; dest[key] = imagePath; return fs.mkdir( imagePath.replace(/(.*)\/.*/, '$1'), {recursive:true} ).then( ()=>{ return fs.writeFile(imagePath, imageBuffer.data); } ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchImage() {\n // TODO\n fetch('examples/fetching.jpg')\n\t.then(validateResponse)\n\t.then(readResponseAsBlob)\n\t.then(showImage)\n\t.catch(logError);\n}", "function base64Image(src) {\n var data = fs.readFileSync(src).toString('base64');\n return util.format('data:%s;base64,%s', mime.lookup(src...
[ "0.7028462", "0.68948", "0.6827957", "0.6745683", "0.6540309", "0.6535558", "0.6532054", "0.6527274", "0.6468653", "0.6466614", "0.6413476", "0.6390011", "0.63822335", "0.6380454", "0.62634426", "0.6251078", "0.62499696", "0.6226959", "0.61669594", "0.61470807", "0.6144563", ...
0.6233172
17
Scrape the panels at the top of the detail page for meta
function scrapePrimaryPanel (id, node) { if (!package[id].headerMeta) package[id].headerMeta = {}; node.querySelectorAll('.panel-body .row').forEach(row=>{ const cells = row.querySelectorAll('div'); if (cells && cells.length>=2 ) { package[id].headerMeta[cells[0].textContent.trim()] = cells[1].textContent.trim(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function panelMetaData(url){\n\tpanelView = 'metadata';\n\tpanelShow(220, 'meta');\n\t$('panelFrame').src = myPath+'ressource/lib/media.metadata.php?url='+url;\n}", "function detail_result(json_parse) {\n\n document.getElementsByClassName('panel')[0].className = \"panel panel-default show\"\n document.getElement...
[ "0.57500005", "0.5688017", "0.56705713", "0.562944", "0.55332774", "0.5521916", "0.5467759", "0.54354507", "0.54200995", "0.5387813", "0.53846747", "0.5364622", "0.5349082", "0.53436196", "0.53361887", "0.5308136", "0.5254317", "0.5233635", "0.5202633", "0.51862097", "0.51658...
0.6276835
0
every detail page has a set of tabs at the lower half, these are dynamically loaded here we take one tab section path, fetch it and scrape the meta from it
function getTabDetail (path,id) { return limitedFetch(`${domain}${path}${id}`) .then(res => res.text()) .then(body => { var promises = [] const tabDom = new JSDOM(body); tabDom.window.document.querySelectorAll('.panel.panel-default.collapsible') .forEach( node=>scrapeTabDefaultPanel(id,node,promises) ); return Promise.all(promises); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchDetails (id) {\n return limitedFetch(`${domain}/item/Details/${id}`)\n .then(res => res.text())\n .then(body => {\n var promises = [];\n const detailDom = new JSDOM(body);\n\n // Get the primary image\n const pImg = detailDom.window.documen...
[ "0.5875801", "0.57537854", "0.56964403", "0.56806237", "0.56689864", "0.5655047", "0.562426", "0.5557786", "0.5549782", "0.5543037", "0.5510794", "0.54657274", "0.5425352", "0.54248893", "0.54025745", "0.54022336", "0.53904706", "0.53764397", "0.53661436", "0.5364575", "0.536...
0.6655011
0
gets the detail page for a resource by id (called for every resource in the search results)
function fetchDetails (id) { return limitedFetch(`${domain}/item/Details/${id}`) .then(res => res.text()) .then(body => { var promises = []; const detailDom = new JSDOM(body); // Get the primary image const pImg = detailDom.window.document.querySelector('#PrimaryImage'); if (pImg) { promises.push( fetchImage2base64(pImg.getAttribute('data-url'), package[id], 'primaryImage') ) } // scrape the panels at the top detailDom.window.document.querySelectorAll('.panel-primary') .forEach( node=>scrapePrimaryPanel(id,node) ); // Fetch the detail tabs for this resource ["/Item/_Details/","/Item/_LocationDisplay/","/Item/_Donor/","/Item/_Appraisal_Deed/","/Item/_Purchases/","/Item/_Condition/","/Item/_MaintenanceDisplay/"] .forEach( tabpath=>{ promises.push( getTabDetail(tabpath,id) ); }); return Promise.all(promises); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getDetail(id) {\n return this.fetch(`${this.api}/${this.resource}/${id}`);\n }", "function show(id) {\n\n return resource.fetch(id)\n .then(function(data){ return data.data; });\n }", "function getThePage(id) {\n getStoryData().then((pages) => {\n fo...
[ "0.6858605", "0.6452224", "0.6366965", "0.6130027", "0.5996583", "0.59055376", "0.5904605", "0.58767796", "0.58246654", "0.58035046", "0.58000565", "0.576909", "0.5729735", "0.5662616", "0.56441313", "0.56439996", "0.5630356", "0.56002593", "0.55991536", "0.55722535", "0.5557...
0.5943598
5
retorna "O cachorro faz auau" ES5 version
function ES5Animal(type, sound) { this.type = type; this.sound = sound; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Js(e){return(Js=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?\"symbol\":typeof e})(e)}", "function es6(){\n return {\n name: 'ECMAScript (ES5)',\n releas...
[ "0.62553567", "0.5938019", "0.58995223", "0.5838787", "0.58318746", "0.5823015", "0.57887906", "0.5786807", "0.5776132", "0.576695", "0.5726405", "0.57224286", "0.5667671", "0.56648153", "0.5638636", "0.56245565", "0.55804795", "0.55528444", "0.55331165", "0.55290467", "0.552...
0.0
-1
Function for email address validation
function isValidEmail(emailAddress) { var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i); return pattern.test(emailAddress); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function simpleEmailValidation(emailAddress) {\n\n}", "function validEmail(value) {\n const addy = /\\S+@\\S+\\.\\S+/;\n if (value.match(addy)) return true;\n else return \"Please enter a valid email address.\";\n}", "function validarEmail(email){expr=/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-...
[ "0.87040657", "0.8267088", "0.82614326", "0.8250824", "0.8237266", "0.81995267", "0.8183565", "0.8173933", "0.8132158", "0.81128144", "0.81110734", "0.8092978", "0.8080192", "0.80636483", "0.8060463", "0.8028017", "0.8021111", "0.8018615", "0.8009661", "0.8006999", "0.7996641...
0.0
-1
TODO (tomert) Add a trash talk string (choosing a random TT string from a list)
render(){ if (this.state.roundInfo.stage === RoundStage.RoundEnded) { setTimeout(this.startBetting, 2000) } console.log('this.state.participateCards') console.log(this.state.participateCards) return ( <div className='container'> <div className='deck'> <div className="deck-cards"></div> <div className="deck-cards"></div> </div> <div className='dealer_table'> <Participate cards={this.state.delearCards} showCards={this.state.roundInfo.stage != RoundStage.RoundEnded} isDealer={true} /> <Participate cards={this.state.participateCards} showCards={this.state.roundInfo.stage != RoundStage.RoundEnded} isDealer={false} /> </div> {this.renderChips()} {this.renderPotChips()} {this.renderPlayerActionsButtons()} </div>); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickTweetText() {\n let options = [\n \"Actually... Crypto stands for CRYPTOGRAPHY!\",\n \"Hey, just a reminder, hashtag CRYPTO means cryptography 🤓\",\n \"crypto => C.R.Y.P.T.O.G.R.A.P.H.Y not cryptocurrency! 🤨\",\n \"Will you stop using hashtag *crypto* ... it's CRYPTOGRAPHY, not cryptocu...
[ "0.70866615", "0.70684355", "0.6994803", "0.6926681", "0.69028443", "0.69016147", "0.6871489", "0.67661387", "0.67502373", "0.6748586", "0.67455804", "0.6616859", "0.6609113", "0.65879464", "0.65863913", "0.65808254", "0.65046656", "0.6487748", "0.64877254", "0.6475029", "0.6...
0.0
-1
Exercise: make a superhero function take in 2 callbacks and return a string in each one of the callbacks describing the "superpower"
function superHero(power1, power2, callbackOne, callbackTwo) { let powers = "my super powers are " + callbackOne(power1) + " and " + callbackTwo(power2); return powers; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function superHero (name, callbackTwo){\n let hero = \"I am \" + name + \" and one of my powers is I can shoot lasers.\" + \" \";\n let otherSuperhero = callbackTwo();\n\n return hero + otherSuperhero;\n}", "function greeter(fullname,cb){ //cb-call back function\n var message=cb(fullname);\n cons...
[ "0.7760503", "0.5938532", "0.58713496", "0.5764805", "0.5701683", "0.5668318", "0.5668318", "0.5668318", "0.56502336", "0.5627756", "0.5584426", "0.55764854", "0.5540673", "0.5514954", "0.5501167", "0.5491166", "0.5480826", "0.54780596", "0.54635334", "0.5459715", "0.5435841"...
0.8757035
0
make a function that prints your name setTimeout and pass in function and a time (5000)
function nameTimer() { let num = 0; for(let i = 0; i >= 0; i--) { console.log(i); } console.log("Tanner!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printTimeout(str, n) {\n setTimeout(function () {\n console.log(str)\n }, n * 1000);\n}", "function delay(callback) {\n //i want to return some data using timer after 5000ms\n setTimeout(callback, 5000, \"Hello\")\n}", "setTimeout (name, fn, delay) {\n setTimeout(() => this._runF...
[ "0.71046007", "0.70265096", "0.70247465", "0.6995259", "0.6923982", "0.6805815", "0.6752948", "0.6705198", "0.6652114", "0.6604463", "0.65868944", "0.65868944", "0.6581496", "0.6571883", "0.65289676", "0.65256315", "0.6519712", "0.6479186", "0.64417183", "0.6440927", "0.64302...
0.0
-1
The height of your card. Home Assistant uses this to automatically distribute all cards over the available columns.
getCardSize() { return 20; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setCardHeight(){\n const UIflashcard = document.querySelector('#flash-card');\n let cardWidth = UIflashcard.offsetWidth;\n let setHeight = cardWidth / 1.666666666667;\n UIflashcard.style.height = `${setHeight}px`;\n}", "calcHeight() {\n\n const card = document.querySelector('.card'...
[ "0.72718596", "0.70873106", "0.70673823", "0.69754463", "0.6941017", "0.69182336", "0.6875138", "0.6875138", "0.686249", "0.68600845", "0.68600845", "0.6857162", "0.68239033", "0.6813902", "0.6813902", "0.67788595", "0.676424", "0.67560065", "0.6712529", "0.6659524", "0.66505...
0.65642273
26
function to handle the click
handleClick() { this.setState(prevState => ({ showMenu: !prevState.showMenu })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleClick() {}", "handleClick( event ){ }", "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "function handleClick() {\n\t\t window.ctaClick();\n\t\t}", "function handleClick(event)\n{\n}", "handleJDotterClick() {}", "function clickHandler(e) {\n // Nur bei Linksklick\n if (e.b...
[ "0.78419244", "0.7819739", "0.7662472", "0.7662472", "0.7640959", "0.7323042", "0.7272677", "0.72681874", "0.7195996", "0.71852666", "0.717097", "0.71133804", "0.7078893", "0.70786047", "0.70736825", "0.70627207", "0.70618117", "0.70363545", "0.7021498", "0.6957247", "0.69411...
0.0
-1
Constructs a new Participant.
constructor() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Participant(uri, name){\r\n\tthis.URI=uri;\r\n\tthis.name=name;\r\n}", "constructor() { \n \n ParticipantWithUserExternalId.initialize(this);\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xd5676710;\n this.SUBCLASS_OF_ID...
[ "0.6924005", "0.6856601", "0.6320834", "0.6311694", "0.61680496", "0.6005148", "0.57533914", "0.5682655", "0.5521943", "0.55024356", "0.54400545", "0.53776824", "0.53630376", "0.5355724", "0.53435665", "0.5327128", "0.53213036", "0.53184325", "0.5307612", "0.5294493", "0.5287...
0.0
-1
Avg. KB I/O time : 1000ms
async function eventSerializer(){ return new Promise(async (resolve, reject) =>{ port .on('open', async () =>{ process.stdout.write('\x07\x07\x07\x07');//Synchronized with 4 beep sound port.on('data', async (data) =>{ data = data.toString('utf8').replace(/[wkg]/gi, ''); if(isNaN(data)) return resolve(); data = Number(data); if(signalDebug) console.log(`${prev} ${curr} Rate : ${stable} Stable : ${isStable} Sent : ${isSent}`); curr = data; if(data == 0){ zero++ if(STABLE_THRESHOLD < zero) isSent = false, zero = 0; } else zero = 0; if(data == 0 || Math.abs(data) <= THRESHOLD){ return resolve(); } if(stable < STABLE_THRESHOLD) isStable = false; else isStable = true; if(curr == prev){ stable++; if(isStable && !isSent){ prev = curr, stable = 0, isStable = false, isSent = true; let buf = `${String(curr)}`; process.stdout.write('\x07');//Beep sound with "please wait" if(timeDebug) console.time('I/O');//Start KB I/O await robot.typeString(buf); if(timeDebug) console.timeLog('I/O'); await robot.keyTap('tab') process.stdout.write('\x07');//Beep sound with "good to go" if(timeDebug) console.timeLog('I/O');//End KB I/O if(timeDebug) console.timeEnd('I/O'); } } else prev = curr, curr = 0, stable = 0, isStable = false, isSent = false; resolve(); }); }) .on('error', async (error) =>{ console.log(error); }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_measureSpeed() {\n\t\tif(!this._socket) return;\n\t\tif(!this._connected) {\n\t\t\tthis._upspeed = 0;\n\t\t\tthis._downspeed = 0;\n\t\t}\n\t\tconst dt = new Date();\n\t\tconst dtime = (dt - this._measuretime) / 1000;\n\t\tif(dtime < 0.11) return;\n\t\tconst bup = this._socket.bytesWritten - this._bytesOut;\n\t\tc...
[ "0.6065693", "0.6013382", "0.59272915", "0.5873922", "0.5846815", "0.5826777", "0.58232254", "0.5792107", "0.575184", "0.5744504", "0.5737861", "0.57036823", "0.5680032", "0.5645027", "0.5633774", "0.5624554", "0.56168157", "0.55748755", "0.5535333", "0.5515816", "0.5464553",...
0.0
-1
VALIDACION DE LA EDAD
function validarAge(){ let age = document.getElementById("age"); if(age.value === ""){ alert("El Age no puede estar vacio"); return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validarEdad(){\r\n\t\r\n\tvar valEdad = recopilarinfotextbox(\"txtEdad\");\r\n\t\r\n\tif (valEdad>=12){\r\n\t\t//alert(valEdad+\" edad mayor de 12\");\r\n\t\tdesactivarelementoFormulario(\"ceo\");\r\n\t\tdocument.getElementById(\"ceo\").value = \"no aplica\";\r\n\t}else{\r\n\t\t//alert(valEdad+\" edad men...
[ "0.72957057", "0.7217632", "0.71872914", "0.6970653", "0.6840598", "0.67997086", "0.6774233", "0.6762697", "0.66613096", "0.6641357", "0.6601899", "0.6595761", "0.6582559", "0.65773374", "0.6541997", "0.65368026", "0.65368026", "0.65216374", "0.65166956", "0.6516406", "0.6503...
0.0
-1
punycode.decode(string) It is used to convert a Punycode string of ASCII symbols to a string of Unicode symbols.
function test1() { punycode = require('punycode'); console.log(punycode.decode('maana-pta')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decode(string){\n\n}", "function decode_utf8(string) {\n\t\treturn decodeURIComponent(escape(string));\n\t}", "function decode_utf8(s) {\r\n if ((s.length > 0) && (s.charCodeAt(0) == 0x9D)) {\r\n return utf8_to_unicode(s.substring(1));\r\n }\r\n return s;\r\n}", "function decode(strT...
[ "0.73295796", "0.7266751", "0.7171343", "0.71384007", "0.7037509", "0.7025843", "0.7025843", "0.7003679", "0.698886", "0.6915208", "0.6913451", "0.6899496", "0.6884492", "0.68683946", "0.68683946", "0.68683946", "0.68683946", "0.68683946", "0.68683946", "0.68683946", "0.68223...
0.58875865
79
punycode.encode(string) It is used to convert a string of Unicode symbols to a Punycode string of ASCII symbols.
function test2() { punycode = require('punycode'); console.log(punycode.encode('☃-⌘')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _utf8_encode (string) {\n \n string = string.replace(/\\r\\n/g, \"\\n\");\n var utftext = \"\";\n\n for (var n = 0; n < string.length; n++) {\n\n var c = string.charCodeAt(n);\n\n if (c < 128) {\n utftext += String.fromCharCode(c);\n ...
[ "0.7070263", "0.69961494", "0.69674325", "0.6890897", "0.6821374", "0.68053967", "0.6766335", "0.67479444", "0.67127615", "0.6686134", "0.6672746", "0.6656438", "0.6649787", "0.6644739", "0.66405827", "0.66018146", "0.6573514", "0.6568753", "0.653048", "0.6414546", "0.6380298...
0.60592884
40
punycode.toASCII(domain) It is used to convert a Unicode string representing a domain name to Punycode. Only the nonASCII part of the domain name is converted.
function test3() { punycode = require('punycode'); console.log(punycode.toASCII('mañana.com')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function canonicalDomain(str) {\n if (str == null) {\n return null;\n }\n str = str.trim().replace(/^\\./,''); // S4.1.2.3 & S5.2.3: ignore leading .\n\n // convert to IDN if any non-ASCII characters\n if (punycode && /[^\\u0001-\\u007f]/.test(str)) {\n str = punycode.toASCII(str);\n }\n\n return str....
[ "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.659847", "0.6583978", "0.65777093", "0.6319884", "0.5646425", "0.5623975", "0.5598679", "0.5580069", "0.55487365", ...
0.5811806
17
punycode.toUnicode(domain) It is used to convert a Punycode string representing a domain name to Unicode. Only the Punycoded part of the domain name is converted.
function test4() { punycode = require('punycode'); console.log(punycode.toUnicode('xn--maana-pta.com')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unescapeUnicode(str){\n\t str = toString(str);\n\t return str.replace(/\\\\u[0-9a-f]{4}/g, function(ch){\n\t var code = parseInt(ch.slice(2), 16);\n\t return String.fromCharCode(code);\n\t });\n\t }", "toUnicode(str) {\n var res = [];\n for ( v...
[ "0.5947256", "0.57460964", "0.57254046", "0.57163864", "0.57163864", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5599307", "0.5590663", "0.55892944"...
0.55509436
22
Compresses sourceDirectoryPath into a tar.gz
compressSourceDirectory(sourceDirectoryPath) { return __awaiter(this, void 0, void 0, function* () { const fileName = `${(0, uuid_1.v4)()}.tar.gz`; console.log('CompressingSourceDirectory', sourceDirectoryPath, fileName); yield tar.c({ gzip: true, file: fileName, sync: true, cwd: sourceDirectoryPath, onWarn: warning => { console.warn(warning); } }, ['.']); return fileName; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gunzip(src){\n fs.createReadStream(src)\n .pipe(zlib.createGunzip())\n .pipe(fs.createWriteStream(path.join(__dirname,path.basename(src,'.gz'))));\n}", "convertApkToZip (source, target){\n let cond = true;\n fs.rename(source, target, function(err) {\n if(err) {...
[ "0.5825395", "0.5739603", "0.5595743", "0.53256303", "0.5207444", "0.5129628", "0.51209956", "0.50601107", "0.5056975", "0.5041073", "0.5031814", "0.50148463", "0.50113493", "0.49702588", "0.49507222", "0.49234024", "0.49157044", "0.4904952", "0.48901677", "0.48799825", "0.48...
0.8036816
0
The component to render when Manage is selected
function Manage(props) { let {path} = useRouteMatch(); return( <Switch> <Route exact path={`${path}`}> <Organization/> </Route> <Route exact path={`${path}/:orgId`}> <Department currentUser={props.currentUser}/> </Route> <Route path={`${path}/:orgId/:depId`}> <Members/> </Route> </Switch> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderSelectedComponent() {\n const setting = this.state.selectedSetting;\n switch (setting) {\n case \"Password Reset 🔒\":\n return (\n <PasswordReset\n {...this.props}\n settinghaschanges={this.settingHasChanges}\n />\n );\n case \"Add Accoun...
[ "0.6010186", "0.5855429", "0.57952416", "0.57691914", "0.57132107", "0.5661863", "0.56283444", "0.5625412", "0.562423", "0.5571572", "0.5569066", "0.5530671", "0.5506387", "0.5463253", "0.5456111", "0.5421458", "0.5420897", "0.53738916", "0.5371859", "0.5369091", "0.53662336"...
0.5322717
26
The component to render when Contacts is selected
function Contacts(props) { let { path } = useRouteMatch(); const { enqueueSnackbar } = useSnackbar(); const [organizations, setOrganizations] = useState([]); const [departments, setDepartments] = useState([]); const [currentOrganization, setCurrentOrganization] = useState(0); const [currentDepartment, setCurrentDepartment] = useState(0); const history = useHistory(); const [dialogOpen, setDialogOpen] = useState(false); const clearSelected = () => { setCurrentDepartment(1); setCurrentOrganization(1); } const handleDialogOpen = () => { setDialogOpen(true); } const handleDialogClose = function() { clearSelected(); setDialogOpen(false); } const handleDialogConfirm = function() { if(currentOrganization < 1 || currentDepartment < 1) { enqueueSnackbar("Please select an organization and departmnet!",{variant: 'warning'}); }else { history.push(`${path}/${currentOrganization}/${currentDepartment}`); setDialogOpen(false); clearSelected(); } } const handleOrgChange = function(event) { const orgId = event.target.value; setCurrentOrganization(orgId); // Fetch departments in this organization getDepartment(orgId).then(res => { if(res.code===200) { // TODO now can select departments const data = res.data.filter(dep => { return dep.status !== 'notJoin'; }); if(data.length === 0) { setDepartments(data); enqueueSnackbar("There is no department you can access in this organization!",{variant: 'warning'}); }else { setDepartments(data); setCurrentDepartment(0); } }else { enqueueSnackbar(res.msg,{variant: 'error'}); } }) } const handleDepChange = function(event) { const depId = event.target.value; setCurrentDepartment(depId); } useEffect(() => { // Fetch organization getOrganization().then(res => { if(res.code === 200) { const data = res.data; if(data.length === 0) { enqueueSnackbar("You have not joined any organizations!\nJoin an organization first!",{variant: 'warning'}); }else { setOrganizations(res.data); } }else { enqueueSnackbar(res.msg,{variant: 'error'}); } }) }) return( <div> <Dialog disableEscapeKeyDown open={dialogOpen} onClose={handleDialogClose}> <DialogTitle>{'Choose an organization and department to display contacts'}</DialogTitle> <DialogContent> <Box component="form" sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 5}}> <FormControl sx={{ m: 1, minWidth: 200 }}> <InputLabel>{"Organization"}</InputLabel> <Select native value={currentOrganization} onChange={handleOrgChange} input={<OutlinedInput label={'Organization'}/>} > <option aria-label="None" value={-1} /> {organizations.map(item => { return (<option key={item.id} value={item.id}>{item.name}</option>) })} </Select> </FormControl> <FormControl disabled={departments.length <= 0} sx={{ m: 1, minWidth: 200 }}> <InputLabel>{"Department"}</InputLabel> <Select native value={currentDepartment} onChange={handleDepChange} input={<OutlinedInput label={'Department'}/>} > <option aria-label="None" value={-1} /> {departments.map(item => { return (<option key={item.id} value={item.id}>{item.name}</option>) })} </Select> </FormControl> </Box> </DialogContent> <DialogActions> <Button onClick={handleDialogClose}>Cancel</Button> <Button onClick={handleDialogConfirm}>Ok</Button> </DialogActions> </Dialog> <Switch> <Route path={`${path}/:orgId/:depId/:customerId`} > <DisplayCustomer/> </Route> <Route path={`${path}/:orgId/:depId`} > <Customer handleDialogOpen={handleDialogOpen}/> </Route> <Route exact path={`${path}`} > <Box sx={{height: '100vh', width: '100%', minWidth: '600px',flexDirection: 'column', display: 'flex', justifyContent: 'center', alignItems: 'center'}}> <Box> <DialogTitle>{'Choose an organization and department to display contacts'}</DialogTitle> {/* <DialogContent> */} <Box component="form" sx={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'center', gap: 5, maxHeight: 300 }}> <FormControl sx={{ m: 1, minWidth: 200 }}> <InputLabel>{"Organization"}</InputLabel> <Select native value={currentOrganization} onChange={handleOrgChange} input={<OutlinedInput label={'Organization'}/>} > <option aria-label="None" value={-1} /> {organizations.map(item => { return (<option key={item.id} value={item.id}>{item.name}</option>) })} </Select> </FormControl> <FormControl disabled={departments.length <= 0} sx={{ m: 1, minWidth: 200 }}> <InputLabel>{"Department"}</InputLabel> <Select native value={currentDepartment} onChange={handleDepChange} input={<OutlinedInput label={'Department'}/>} > <option aria-label="None" value={-1} /> {departments.map(item => { return (<option key={item.id} value={item.id}>{item.name}</option>) })} </Select> </FormControl> </Box> {/* </DialogContent> */} <DialogActions> <Button onClick={handleDialogClose}>Cancel</Button> <Button onClick={handleDialogConfirm}>Ok</Button> </DialogActions> </Box> </Box> </Route> </Switch> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toRenderContactView() {\n ContactView.render({\n model: contact,\n bindings: bindings\n });\n }", "render() {\n return (\n <div>\n {this.props.contacts.map(contact => (\n <Contact displayConvo={this.props.displayConvo} name={contact} />\n ))}\n ...
[ "0.64872533", "0.61435807", "0.5944054", "0.5852314", "0.5846402", "0.5755448", "0.573583", "0.5705119", "0.57034034", "0.5689367", "0.56595653", "0.56244636", "0.5612604", "0.55912143", "0.5578331", "0.5572586", "0.5545431", "0.55096495", "0.5505732", "0.54934657", "0.549331...
0.0
-1
Service created lifecycle event handler
async created() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "created() {\n this.onCreatedHandler();\n }", "initService() {\n\t\tthis.settings = new ServiceSettings();\n\t\tthis.service = new Service({\n\t\t\tonDisconnect: (hadError) => {\n\t\t\t\tthis.stopCancellableQueues(!!hadError, !!hadError);\n\t\t\t}\n\t\t});\n\t}", "constructor() { \n \n ...
[ "0.68110543", "0.6215897", "0.61676764", "0.61611104", "0.61611104", "0.6119992", "0.610259", "0.6070838", "0.6070838", "0.6067955", "0.60517883", "0.6039822", "0.59989184", "0.59704554", "0.59457517", "0.5918045", "0.58979523", "0.5826529", "0.5819539", "0.57962817", "0.5744...
0.5626522
26
Service started lifecycle event handler
async started() { this.broker.waitForServices("steedos-server").then(async () => { await this.publicClientJS() }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startService() {\n $log.log(TAG + 'starting');\n running = true;\n }", "started() {\n\n }", "started() {\n\n }", "started() {\n\n }", "function startService() {\n $log.log(TAG + 'starting.');\n running = true;\n }", "preStart() {\n }", "started() {\r\n\r\n...
[ "0.6500062", "0.64819014", "0.64819014", "0.64819014", "0.6467215", "0.6429847", "0.636004", "0.63335705", "0.62732744", "0.62657464", "0.6257874", "0.6257874", "0.6257874", "0.6257874", "0.6257874", "0.6257874", "0.6257874", "0.6257874", "0.62467724", "0.62467724", "0.624677...
0.5794123
65
Service stopped lifecycle event handler
async stopped() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stopped() {\n\n }", "stopped() {\n\n }", "stopped() {\n\n }", "stopped () {\n\n }", "stopped () {\n\n }", "stopped () {\n\n }", "stopped() {\r\n\r\n\t}", "stopped() { }", "destroy() {\n logger.log({level: 'info', type: 'service', message: 'Destroying Service'});\n this.end = true;...
[ "0.7112776", "0.7112776", "0.7112776", "0.70919883", "0.70919883", "0.70919883", "0.6991065", "0.6959354", "0.6933851", "0.69287086", "0.69287086", "0.69287086", "0.69287086", "0.69287086", "0.6915627", "0.6905836", "0.6905836", "0.6905836", "0.6905836", "0.6905836", "0.69058...
0.69112134
20
Set Admin Roles from
function initialize(){ sheets.spreadsheets.values.get({ auth: oauth2Client, spreadsheetId: '1KFcvgsjI_6eCBoltdD50ddWxeLcIGfRBd6LWcKEI_Uw', range: 'Permissions!B2:B', }, function(err, response) { if (err) { console.log('The API returned an error: ' + err); } var rows = response.values; if(rows == null) { console.log('No data found: No Admin Roles'); } else { for (var i = 0; i < rows.length; i++) { adminRoles.push(rows[i][0]); } console.log('Admin Roles initialized'); } } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function set_roles() {\n\n // Define roles, resources and permissions\n acl.allow([\n {\n roles: '0', //super -admin\n allows: [\n { resources: '/secret', permissions: '*' }\n ]\n }, {\n roles: '1', //organization-admin\n ...
[ "0.745042", "0.71682554", "0.69947344", "0.6636208", "0.6543777", "0.6526374", "0.65155256", "0.63214195", "0.62340134", "0.61880946", "0.61852044", "0.610689", "0.60894656", "0.6075558", "0.6075491", "0.6026942", "0.5993031", "0.5976654", "0.5971124", "0.5956481", "0.5911777...
0.0
-1
Checks to see if the messenge is from an approved role or is the owner of the guild
function adminCheck(message){ if(message.channel.type != 'text') return; if(message.guild.ownerID == message.author.id){return true;} if(message.author.id == '105041932459184128'){return true;} for( var [id, roles] of message.member.roles){ for (var index = 0; index < adminRoles.length; index++){ if(id == adminRoles[index]){return true;} } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkAdminOrOwnerSender(msg){\n\n\tif (msg.author.id == msg.guild.ownerID ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"Admin\") ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"Admin role\") ||\n\t\tmsg.member.roles.cache.some(role => role.name === \"admin\")\n\t\t){\n\t\treturn ...
[ "0.7385408", "0.6222284", "0.6173132", "0.61214364", "0.6052044", "0.6045111", "0.60045683", "0.60004276", "0.59831333", "0.59613657", "0.57994515", "0.56773937", "0.563937", "0.55982596", "0.55914575", "0.55329895", "0.5532096", "0.5506311", "0.5503812", "0.549643", "0.54952...
0.6928503
1
Load opportunities from database and their images
load(forceReload) { var d = $q.defer(); if(this.list.length === 0 || forceReload === true) { $http.get('/api/opportunities') .then(response => { this.list = response.data; var today = new Date().getTime(); var date; for(var opportunity of this.list) { date = new Date(opportunity.ExpirationDate).getTime(); opportunity.Status = today > date ? 'Encerrada' : opportunity.IsApproved ? 'Aprovada' : 'Pendente'; } d.resolve(this.list); }) .catch(err => { d.reject(err); }); } else { d.resolve(this.list); } return d.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async show ({ params }) {\n const product = await Product.find(params.id)\n await product.loadMany(['image','evaluation'])\n return product\n }", "async function loadFromMongo() {\n axios.get(\"./api/unsplash\").then((res) => {\n let newImages = [];\n res.data.forEach((image) => {\n ...
[ "0.5514424", "0.53767127", "0.5372775", "0.5362709", "0.5298192", "0.5244988", "0.5236877", "0.52081877", "0.5201501", "0.51782775", "0.5169627", "0.514522", "0.5143002", "0.5134626", "0.5133915", "0.51057476", "0.51000327", "0.5094199", "0.5090067", "0.50642043", "0.506246",...
0.0
-1
Load opportunities from database and their images
get (OpportunityId, forceReload) { var d = $q.defer(); if(!this.loadedOpportunities[OpportunityId] || forceReload === true) { $http.get(`/api/opportunities/${OpportunityId}`) .then(response => { var opportunity = response.data; this.loadedOpportunities[OpportunityId] = opportunity; d.resolve(opportunity); }) .catch(err => { d.reject(err); }); } else { d.resolve(this.loadedOpportunities[OpportunityId]); } return d.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async show ({ params }) {\n const product = await Product.find(params.id)\n await product.loadMany(['image','evaluation'])\n return product\n }", "async function loadFromMongo() {\n axios.get(\"./api/unsplash\").then((res) => {\n let newImages = [];\n res.data.forEach((image) => {\n ...
[ "0.55160207", "0.53758043", "0.5371903", "0.53637475", "0.52977395", "0.5246795", "0.5237815", "0.5207772", "0.52024066", "0.5176507", "0.5169728", "0.51442975", "0.5142956", "0.51342154", "0.51328886", "0.5105961", "0.50976783", "0.50931156", "0.5087872", "0.5065087", "0.506...
0.0
-1
Load opportunity applications from database
getApplication (opportunityId, personId, forceReload) { var d = $q.defer(); if(!this.loadedOpportunityApplications[`${opportunityId}-${personId}`] || forceReload === true) { $http.get(`/api/opportunity_applications/${opportunityId}/${personId}`) .then(response => { var application = response.data; this.loadedOpportunityApplications[`${opportunityId}-${personId}`] = application; d.resolve(application); }) .catch(err => { d.reject(err); }); } else { d.resolve(this.loadedOpportunityApplications[`${opportunityId}-${personId}`]); } return d.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployeeJobApplication(firstname) {\n\treturn Employee.findOne({firstname: firstname})\n\t .populate(\"applications\").exec((err, posts) =>{\n console.log(\"Populated Employee\" + posts)\n }\n\t \n)\n}", "function loadCurrentApplication() {\n ApplicationsService\n .l...
[ "0.58995456", "0.5616329", "0.55552274", "0.5461304", "0.5388441", "0.53872836", "0.5376514", "0.53718174", "0.5323144", "0.53102446", "0.5290349", "0.52407265", "0.52389294", "0.522918", "0.5194129", "0.5190767", "0.5157819", "0.5151134", "0.5119506", "0.5103304", "0.5102935...
0.5785937
1
Opens a view with opportunities
open(OpportunityId, OpportunityTitle, forceReload) { $state.go('opportunities.view', { OpportunityId: OpportunityId, PrettyURL: Util.convertToSlug(OpportunityTitle), forceReload: forceReload || false }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "open( viewName, options ){\n _history.push( this.current );\n _options.push( _currentOptions );\n\n viewport.replace( viewName, options );\n }", "view(options) {\n return this.wizardInvokeService.openWizard(Object.assign(options, {\n title: this._buildTitle(options.service.entityName,...
[ "0.60245764", "0.5902084", "0.588091", "0.58751684", "0.58528507", "0.5825909", "0.57534933", "0.5625358", "0.56178623", "0.56178623", "0.55248815", "0.5524539", "0.55118287", "0.5497018", "0.54535663", "0.5450773", "0.54503196", "0.542854", "0.54111236", "0.53768754", "0.537...
0.67139226
0
Load my opportunity applications from database
loadMyApplications(forceReload) { var d = $q.defer(); if(this.myApplications.length === 0 || forceReload === true) { $http.get('/api/opportunity_applications/me') .then(response => { this.myApplications = response.data; for(var application of this.myApplications) { application.ExpirationDate = new Date(application.opportunity.ExpirationDate).getTime(); } d.resolve(this.myApplications); }) .catch(err => d.reject(err)); } else { d.resolve(this.myApplications); } return d.promise; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEmployeeJobApplication(firstname) {\n\treturn Employee.findOne({firstname: firstname})\n\t .populate(\"applications\").exec((err, posts) =>{\n console.log(\"Populated Employee\" + posts)\n }\n\t \n)\n}", "function loadCurrentApplication() {\n ApplicationsService\n .l...
[ "0.5928228", "0.58357394", "0.56812173", "0.5674608", "0.56173736", "0.5557813", "0.5516382", "0.5513296", "0.54212123", "0.54178274", "0.540511", "0.5388905", "0.53515404", "0.5255603", "0.5241275", "0.52322733", "0.5218727", "0.52049106", "0.5202345", "0.51374143", "0.50928...
0.5407379
10
Load my opportunity posts from database
loadMyPosts(forceReload) { if(this.myPosts.length === 0 || forceReload === true) { $http.get('/api/opportunities/me') .then(response => { this.myPosts = response.data; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadPost() {\n return API.get(\"posts\", `/posts/${id}`);\n }", "function loadItemPostData(){\n return post_model.get([ctrl.editedItem.post_id]).then(function(){\n var p = post_model.list[ctrl.editedItem.post_id].datum;\n\n ctrl.editedPost = {\n...
[ "0.69107467", "0.6662232", "0.628636", "0.6286278", "0.6281486", "0.6162624", "0.6062504", "0.59644926", "0.59407014", "0.59132844", "0.5899106", "0.58887494", "0.5865052", "0.5860184", "0.5839161", "0.57962114", "0.5794351", "0.57509637", "0.5725235", "0.57230496", "0.570860...
0.57342064
18
Dynamically adjust the canvas to the window
function windowResized() { resizeCanvas(windowWidth, windowHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adjustCanvasSize() {\n CANVAS.width = CANVAS_WIDTH;\n CANVAS.height = window.innerHeight;\n}", "function windowResized(){\n canvas.resize(windowWidth, windowHeight - canvasadjust);\n}", "function resizeCanvas() {\n\tvar newHeight = window.innerHeight;\n\tvar newWidth = initWidth/initHeight * ne...
[ "0.79434544", "0.77352977", "0.7713235", "0.7712608", "0.7694596", "0.7667064", "0.76613593", "0.757525", "0.7518815", "0.7511717", "0.74886125", "0.74721533", "0.74686044", "0.74424773", "0.74312437", "0.7430374", "0.74183553", "0.73977965", "0.73977965", "0.7396391", "0.739...
0.7264743
45
This function is called before teh app is displayed, and sets the state for the productList
componentDidMount(){ this.getProductDataList(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super();\n this.state = { products: [], displayProduct: false };\n }", "_stateChanged(state) {\n this._products = state.shop.products;\n }", "constructor() {\n super();\n this.state = {products: []}\n }", "componentWillMount(){\n this.setState({\n p...
[ "0.7609573", "0.7130011", "0.70411974", "0.68655294", "0.68365955", "0.6807096", "0.6763245", "0.675613", "0.6689169", "0.66659737", "0.6658431", "0.66581374", "0.66351545", "0.6608302", "0.6563982", "0.6523865", "0.65192217", "0.65185153", "0.6432068", "0.6377935", "0.637150...
0.0
-1
query data from backend server
getProductDataList() { fetch('http://localhost:3000/products').then(res => res.json()).then((data) => { this.setState({productList: data}) }).catch(console.log) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "query(store, type, query) {\n let { backend, id } = query;\n return this.ajax(this._url(backend, id), 'GET', { data: { list: true } }).then(resp => {\n resp.id = id;\n resp.backend = backend;\n return resp;\n });\n }", "run(){\n let [q, ...args] = this._getQuery();\n return this.cl...
[ "0.67702353", "0.67365044", "0.654332", "0.65028936", "0.6469413", "0.63651663", "0.63122827", "0.6246417", "0.6240221", "0.6238856", "0.622833", "0.6227184", "0.62103575", "0.61777556", "0.61689365", "0.6163017", "0.6145435", "0.6144922", "0.6121435", "0.6102793", "0.6092311...
0.0
-1
Explicitly handles the etner button on search bar
handleEnterButton(e){ var unsortedProdList = []; var sortedProdList = []; if(e.keyCode === 13){ this.state.productList.map((item,key)=>{ unsortedProdList.push(item); }); unsortedProdList.forEach((item) => { if(String(item['name']).includes(e.target.value)){ sortedProdList.push(item); } }) this.setState({productList: sortedProdList}); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSearchButton(event) {\n if (\n event.target.label ==\n gSearchBundle.GetStringFromName(\"labelForSearchButton\")\n ) {\n onSearch();\n } else {\n onSearchStop();\n }\n}", "function clickSearchButton(e){\n _self.getDefaultPlace(_self.scope.inputSearch.value); \n }", "click...
[ "0.7752137", "0.76469797", "0.74152416", "0.7324277", "0.7211574", "0.7202888", "0.7197784", "0.7162076", "0.71501607", "0.7042931", "0.69985706", "0.69935787", "0.69819283", "0.69747907", "0.6967185", "0.6954629", "0.6949268", "0.691358", "0.68608326", "0.6825792", "0.682423...
0.0
-1
Handles the query entered in the search bar
handleInputSearchBar(e){ this.setState({ query:e.target.value },() => { if(this.state.query && this.state.query.length>1){ if(this.state.query.length % 2 === 0){ this.getProductDataList(); } } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleQuery () {\n var searchText = $scope.searchText || '',\n term = searchText.toLowerCase();\n //-- if results are cached, pull in cached results\n if (!$scope.noCache && cache[ term ]) {\n ctrl.matches = cache[ term ];\n updateMessages();\n } else {\n fetchResul...
[ "0.79764235", "0.79110783", "0.77525926", "0.7659581", "0.76479644", "0.76479644", "0.76145333", "0.75815505", "0.7544742", "0.75034934", "0.74830097", "0.74830097", "0.74452674", "0.7442663", "0.7390078", "0.73871845", "0.73868", "0.738548", "0.7381054", "0.73779774", "0.737...
0.0
-1
Creates a list of Cards, According the the data received from backend.
getProductListComponenet(productList){ var temp = []; // console.log(productList); if(productList.length>0 && productList){ productList.map((item,key) => { temp.push(<SimpleCard {...item}/>); }) }else{ temp.push( <div> <h1>"Data not being fetched, restart backend server"</h1> </div> ); } return temp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createCards() {\n cardsData.forEach((data, index) => createCard(data, index));\n }", "function createListOfCards() {\n const cards = createListOfCardsUrl();\n let listOfCards = [];\n for (let i = 0; i < 4; i++) {\n listOfCards.push(new CreateNewCard(cards[i], 11))\n }\n\n for (...
[ "0.7443371", "0.70586115", "0.69401056", "0.68297523", "0.6676877", "0.6621398", "0.6576024", "0.6500268", "0.64240956", "0.6417418", "0.6409213", "0.64086944", "0.64015234", "0.6390988", "0.6373608", "0.63731164", "0.6362767", "0.6354633", "0.632621", "0.63109356", "0.630160...
0.0
-1
Renders The Nav Bar
function NavBarItem(props){ return( <Navbar bg="dark" variant="dark"> <Navbar.Brand href="#home"> <img alt="" src={require('./logo.svg')} width="30" height="30" className="d-inline-block align-top" />{' '} React Bootstrap </Navbar.Brand> </Navbar> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderNavBar() {\n\t //if navBar, delete\n\t var oldNav = document.querySelector('.cat-nav-bar');\n\n\t if (oldNav) {\n\t oldNav.parentNode.removeChild(oldNav);\n\t }\n\n\t var newNavBar = createNavBar(cats);\n\n\t catHolderMaster.appendChild(newNavBar);\n\n\t}", "function rende...
[ "0.7378136", "0.7335155", "0.6867642", "0.68675387", "0.68566644", "0.6759498", "0.67142713", "0.65211177", "0.65088344", "0.6491339", "0.6435851", "0.6422452", "0.6419913", "0.6415462", "0.6360725", "0.6356849", "0.63450503", "0.6341991", "0.633546", "0.6322069", "0.631369",...
0.0
-1
Sign in the user upon button click.
function handleSignIn(event) { GoogleAuth.signIn(); loginHandler(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleAuthClick() {\n auth2.signIn();\n}", "function handleAuthClick(event) {\n gapi.auth2.getAuthInstance().signIn();\n }", "function handleSignInButtonClick() {\n if (!loggedIn) {\n setHasError(true);\n setErrorMessage('Please log in to continue');\n setShowLogin(!showLo...
[ "0.7470999", "0.7374268", "0.7348004", "0.7327811", "0.7296217", "0.72920984", "0.72627515", "0.72627515", "0.72627515", "0.7262626", "0.7262626", "0.7262626", "0.7252664", "0.7250213", "0.72392756", "0.72392756", "0.72392756", "0.72392756", "0.72392756", "0.72392756", "0.723...
0.0
-1
Sign out the user upon button click.
function handleSignOut(event) { GoogleAuth.signOut(); logoutHandler; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function btnSignOutOnClick() {\n firebase.auth().signOut();\n}", "signOut() {\n this.bitski.userManager.removeUser();\n this.contractInstance = null;\n this.showLoginButton();\n }", "function signOut() {\n var auth2 = gapi.auth2.getAuthInstance();\n auth2.signOut().then(function () {\n...
[ "0.7971634", "0.79283696", "0.7919959", "0.7899161", "0.7871195", "0.7866677", "0.7850537", "0.78293633", "0.7824971", "0.7824971", "0.7824971", "0.7822838", "0.78069776", "0.77900946", "0.77900946", "0.77900946", "0.7783564", "0.7783564", "0.7777048", "0.77677405", "0.776651...
0.0
-1
formatting queries for request url
function formatQuery(params) { const queryItems = Object.keys(params).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`) return queryItems.join('&') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_formatQueryString(query) {\n // TODO: Figure out how to fix the url encoding of the colons so I can\n // use this more specific search\n // const q = Object.entries(query)\n // .map(([key, val]) => {\n // if (key === 'title') {\n // key = 'track';\n // }\n // retu...
[ "0.7299639", "0.7208712", "0.7008765", "0.67837757", "0.6663055", "0.65995634", "0.65841204", "0.65767133", "0.6538788", "0.6538788", "0.65377015", "0.65186054", "0.648666", "0.6441823", "0.6428883", "0.6428883", "0.6408066", "0.63577884", "0.6353783", "0.63536924", "0.633303...
0.64602613
13
getting location information from WheelMap API
function getWheelMapNodes(bounds) { const params = { api_key: apiKey, bbox: bounds, per_page: 1000, } const options = { mode: 'no-cors' } const queryString = formatQuery(params) const url = `${searchURL}?${queryString}` fetch(url, options) .then(response => { console.log(response); }) .catch(err => { console.log(err) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getLocationInfo(){\n return this.map.getLocationInfo();\n }", "function gbDidSuccessGetLocation ( lat, long )\n{\n\tvar api_url = \"http://api.wunderground.com/api/\" + APIKEY + \"/conditions/q/\" + lat + \",\" + long + \".json\";\n\tgbRequest ( api_url, '1', 'YES' );\n}", "function getGeolocation() ...
[ "0.6993513", "0.6836875", "0.6794714", "0.6767347", "0.6706135", "0.6685092", "0.66030556", "0.6582692", "0.65578604", "0.65209436", "0.6507103", "0.64702135", "0.6464208", "0.6455112", "0.64394647", "0.64307845", "0.64202476", "0.64121234", "0.63966024", "0.63925236", "0.639...
0.0
-1
getting boundbox values for WheelMaps API and converting to proper format (bbox=west,south,east,north) as comma separated float numbers wich are longitude, latitude values in degrees. runs whenever the map is moved and calls getWheelMapNodes function with new bounds
function findBoundaries() { google.maps.event.addListener(map, 'bounds_changed', function() { const bounds = map.getBounds(); const NE = bounds.getNorthEast(); const SW = bounds.getSouthWest(); const coordinates = [`${SW}`, `${NE}`]; const fixed = coordinates.map(e => e.replace(/[{()}]/g, '')).map(e => e.split(', ')).flat(); const parsed = fixed.map(e => parseFloat(e)); [parsed[0], parsed[1]] = [parsed[1], parsed[0]]; [parsed[2], parsed[3]] = [parsed[3], parsed[2]]; const formattedBounds = parsed.join(); getWheelMapNodes(formattedBounds); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getWheelMapNodes(bounds) {\n\tconst params = {\n\t\tapi_key: apiKey,\n\t\tbbox: bounds,\n\t\tper_page: 1000,\n\t}\n\tconst options = {\n\t\tmode: 'no-cors'\n\t}\n\tconst queryString = formatQuery(params)\n\tconst url = `${searchURL}?${queryString}`\n\tfetch(url, options)\n\t\t.then(response => {\n\t\t\tco...
[ "0.65064317", "0.6287059", "0.6096493", "0.6087814", "0.6083349", "0.60483795", "0.60168546", "0.5967971", "0.5747825", "0.5703452", "0.5682678", "0.5669107", "0.5515693", "0.5515693", "0.5488919", "0.54792976", "0.5460724", "0.5445885", "0.54415995", "0.5440736", "0.5421825"...
0.757999
0
vuex v3.1.1 (c) 2019 Evan You
function r(e){var t=Number(e.version.split(".")[0]);if(t>=2)e.mixin({beforeCreate:r});else{var n=e.prototype._init;e.prototype._init=function(e){void 0===e&&(e={}),e.init=e.init?[r].concat(e.init):r,n.call(this,e)}}function r(){var e=this.$options;e.store?this.$store="function"===typeof e.store?e.store():e.store:e.parent&&e.parent.$store&&(this.$store=e.parent.$store)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFieldVuex() {\n return store.getters.dataField;\n }", "function vuexInit(){var options=this.$options;// store injection\n\tif(options.store){this.$store=options.store;}else if(options.parent&&options.parent.$store){this.$store=options.parent.$store;}}", "function U(He){Le&&(He._devtoolHook=Le,Le.emit('v...
[ "0.71114504", "0.70059747", "0.6747754", "0.6744582", "0.662208", "0.662208", "0.662208", "0.6618358", "0.6592901", "0.6487492", "0.63576543", "0.63523763", "0.63509184", "0.63509184", "0.63509184", "0.63509184", "0.63509184", "0.6339643", "0.6321553", "0.62844443", "0.628122...
0.0
-1
Stores an associative array that maps URIs to functions
function RDFIndexedFormula() { this.statements = []; // As in RDFFormula this.propertyAction = []; // What to do when getting statement with {s X o} //maps <uri> to f(F,s,p,o) this.classAction = []; // What to do when adding { s type X } this.redirection = []; // redirect to lexically smaller equivalent symbol this.subjectIndex = []; // Array of statements with this X as subject this.predicateIndex = []; // Array of statements with this X as subject this.objectIndex = []; // Array of statements with this X as object this.namespaces = {} // Dictionary of namespace prefixes // Callbackify? function handleRDFType(formula, subj, pred, obj, why) { if (typeof formula.typeCallback != 'undefined') formula.typeCallback(formula, obj, why); var x = formula.classAction[obj.hashString()]; if (x) return x(formula, subj, pred, obj); return false; // statement given is needed } //handleRDFType //If the predicate is #type, use handleRDFType to create a typeCallback on the object this.propertyAction[ '<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>'] = handleRDFType; // Assumption: these terms are not redirected @@fixme this.propertyAction['<http://www.w3.org/2002/07/owl#sameAs>'] = function(formula, subj, pred, obj, why) { formula.equate(subj,obj); return false; // statement given is needed e.g. when dereferencing }; //sameAs -> equate & don't add to index this.propertyAction['<http://www.w3.org/2006/link#obsoletes>'] = function(formula, subj, pred, obj, why) { formula.replaceWith(obj, subj); return false; // statement given IS needed }; //sameAs -> equate & don't add to index function newPropertyAction(formula, pred, action) { fyi("newPropertyAction: "+pred); formula.propertyAction[pred] = action; var fixEndA = formula.statementsMatching(undefined, pred, undefined); var i; for (i=0; i<fixEndA.length; i++) { // NOT optimized - sort fixEndA etc // fyi("nePropertyAction: retrospective action for "+st) if (action(formula, fixEndA[i].subject, pred, fixEndA[i].object)) { //@@ kb.remove(st); /// messing up the list we are iterating over?? @@ fyi("newPropertyAction: NOT removing "+fixEndA[i]); } } return false; } this.classAction["<"+owl_ns+"InverseFunctionalProperty>"] = function(formula, subj, pred, obj, addFn) { return newPropertyAction(formula, subj, handle_IFP); // yes subj not pred! }; //IFP -> handle_IFP, do add to index this.classAction["<"+owl_ns+"FunctionalProperty>"] = function(formula, subj, proj, obj, addFn) { return newPropertyAction(formula, subj, handle_FP); }; //FP => handleFP, do add to index function handle_IFP(formula, subj, pred, obj) { var s1 = formula.any(undefined, pred, obj); if (typeof s1 == 'undefined') return false; // First time with this value formula.equate(s1, subj); return true; } //handle_IFP function handle_FP(formula, subj, pred, obj) { var o1 = formula.any(subj, pred, undefined); if (typeof o1 == 'undefined') return false; // First time with this value formula.equate(o1, obj); return true ; } //handle_FP }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createURLHandler() {\n\t\tvar arr = [];\n\t\t\n\t\t\n\t\treturn arr;\t\t\n\t}", "defineFn(name, words) {this.fnDefs[name] = words;}", "constructor() {\n this.functions = {};\n }", "function InvokeDefinitionMap() {\n this.map = [];\n this.lookup_table = {}; // Just for building dicti...
[ "0.5627914", "0.5525375", "0.54362535", "0.5414457", "0.5257724", "0.5257337", "0.52383596", "0.5212524", "0.5205943", "0.5189009", "0.51852494", "0.51730436", "0.51723677", "0.5138185", "0.51372784", "0.5110163", "0.50676763", "0.5065058", "0.50540924", "0.5033974", "0.50241...
0.0
-1
sameAs > equate & don't add to index
function newPropertyAction(formula, pred, action) { fyi("newPropertyAction: "+pred); formula.propertyAction[pred] = action; var fixEndA = formula.statementsMatching(undefined, pred, undefined); var i; for (i=0; i<fixEndA.length; i++) { // NOT optimized - sort fixEndA etc // fyi("nePropertyAction: retrospective action for "+st) if (action(formula, fixEndA[i].subject, pred, fixEndA[i].object)) { //@@ kb.remove(st); /// messing up the list we are iterating over?? @@ fyi("newPropertyAction: NOT removing "+fixEndA[i]); } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "withSame(prop, asIdx=-1) {\n\t\tif (this.lastResult === false) return this; //do nothing\n\t\tif (!this.workingList || !this.workingList.length) {\n\t\t\tthis.lastResult = false;\n\t\t\treturn this;\n\t\t}\n\t\tif (asIdx < 0) asIdx = this.matchedItems.length + asIdx;\n\t\tlet list = this.workingList;\n\t\tlet asLi...
[ "0.6037506", "0.580586", "0.5797484", "0.5676205", "0.56560546", "0.564569", "0.56439006", "0.562467", "0.56232196", "0.56133205", "0.5601093", "0.5587284", "0.5566395", "0.5553829", "0.5515353", "0.5496653", "0.54673785", "0.5428805", "0.5421583", "0.53992003", "0.5377644", ...
0.0
-1
FP => handleFP, do add to index
function handle_IFP(formula, subj, pred, obj) { var s1 = formula.any(undefined, pred, obj); if (typeof s1 == 'undefined') return false; // First time with this value formula.equate(s1, subj); return true; } //handle_IFP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function waAddFIProcess(pv_action,pv_details) {\nvar callType=\"page\"; //used in call to waLinkClick function\n\tif(!wa.containerPageName) {\twaCaptureContainerVariables(\"capture\"); }\n\n\ts.prop7=\"fi:\"+pv_action;\n\tif(pv_details) { \n\t\tpv_details=pv_details.toLowerCase();\n\t\ts.prop7=s.prop7+\"_\"+pv_det...
[ "0.5589845", "0.5584595", "0.5544091", "0.5357248", "0.53101486", "0.5308594", "0.528337", "0.52490956", "0.52110255", "0.51872367", "0.51660043", "0.5128588", "0.5110708", "0.5103243", "0.50921446", "0.5079954", "0.50797355", "0.5064261", "0.5040345", "0.5028535", "0.5000693...
0.0
-1
On input parameters, do redirection and convert constants to terms We do not redirect literals
function RDFMakeTerm(formula,val) { if (typeof val != 'object') { if (typeof val == 'string') { return new RDFLiteral(val); } else if (typeof val == 'undefined') { return undefined; } else { // @@ add converting of dates and numbers alert("Can't make term from " + val + " of type " + typeof val); } } if (typeof formula.redirection == 'undefined') alert('formula: '+ formula+', term: '+val); var y = formula.redirection[val.hashString()]; if (typeof y == 'undefined') return val; // fyi(" redirecting "+val+" to "+y) return y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function interpret(input) {\n console.log(\"calling interpret\");\n var cmd = {},\n tokens = input.trim().toLowerCase().split(\" \");\n cmd.action = tokens.shift();\n cmd.target = tokens.join(\" \");\n return cmd;\n}", "constHandler() {\n\t\tlet constant = this.m_constMenu.value;\n\t\tlet constUnit = thi...
[ "0.49727756", "0.49120852", "0.49065593", "0.48922473", "0.48867127", "0.48588923", "0.48551345", "0.4798961", "0.47860354", "0.47789928", "0.47789928", "0.4776643", "0.47615755", "0.47615755", "0.47145283", "0.4689574", "0.46878794", "0.46702182", "0.46512684", "0.46458772", ...
0.5275294
0
StartQuiz function is for displaying questions and answers
function startQuiz(event){ content.textContent = ""; quizImage.remove(); quizBtn.remove(); if(arrQues[i] !== undefined){ ques.textContent = arrQues[i].q; for(var j=0 ; j<arrQues[i].options.length; j++){ var li = document.createElement("li"); li.innerHTML = (j+1) + ". " +arrQues[i].options[j]; li.setAttribute("id", j); ques.append(li); } i++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startQuiz() {\n hideElement(introEl);\n showElement(questionsContainerEl);\n availableQuestions = quiz;\n getNewQuestion();\n\n}", "function initiateQuiz() {\n startQuiz();\n renderFirstQuestion();\n answerChoice();\n renderNextQuestion();\n}", "function startQuiz () {}", "f...
[ "0.8685266", "0.8640112", "0.8627268", "0.85287374", "0.8505236", "0.844439", "0.83431077", "0.832672", "0.8224872", "0.82164794", "0.81903255", "0.8170914", "0.816454", "0.81275296", "0.81127256", "0.8082588", "0.8078522", "0.80443627", "0.8015529", "0.79966784", "0.7990124"...
0.0
-1
This function is for evaluating the answer and saving the score value
function ansSelection(event){ event.preventDefault(); if(event.target.matches("li")){ userId = event.target.id; var userAns = arrQues[k].options[userId]; if(typeof userId !== "undefined"){ resultDisplay.textContent = ""; if(userAns === arrQues[k].a){ resultDisplay.textContent = "Hurray Correct!!" resultDisplay.setAttribute("style", "background-color:green; margin: 8px; width:150px; font-size: 20px;"); score = score+10; }else{ resultDisplay.textContent = "Oops Wrong!!" resultDisplay.setAttribute("style", "background-color:red; margin: 8px; width:150px; font-size: 20px;"); totalSeconds = totalSeconds - 10; } k++; } // StartQuiz is being called to display successive questions startQuiz(); if(liCount === arrQues.length){ showResults(); } liCount++; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scoreAnswers(){}", "function result()\n\t{\n\t\t{\n\t\t\t/* for( i=0; i<questions.length; i++ )\n\t\t\t\t {\n\t\t\t\t checkAnswers( questions[i]);\t\t\n\t\t\t\t } */\n\t\t\t\t\n\t\t\t//To test in console.log\n\t\t\tconsole.log( \"a1 Score is: \" + checkAnswers( questions[0] ) );\n\t\t\tconsole.log( \"a...
[ "0.73082155", "0.69914305", "0.6984815", "0.6937844", "0.6906641", "0.6876439", "0.68623495", "0.6861087", "0.68555605", "0.684543", "0.6824714", "0.68188006", "0.6777512", "0.6695989", "0.6666297", "0.66650146", "0.66630757", "0.66556585", "0.6644925", "0.66420937", "0.66277...
0.0
-1
ShowResults for displaying the results page
function showResults(){ stopTimer(); resultDisplay.textContent=""; content.textContent = ""; queslistEl.innerHTML = ""; var ptag = document.createElement("p"); ptag.setAttribute("class", "mt-4") ptag.textContent = "Completed!!! You secured " +(score/50)*100 +" percentage "; content.append(ptag); var ptag2 = document.createElement("p"); ptag2.textContent = "Your final score: " +score; content.append(ptag2); var form = document.createElement("form"); var div = document.createElement("div"); div.setAttribute("class", "form-group"); var label = document.createElement("label"); label.setAttribute("for", "initials"); label.textContent = "Your Initials: "; label.setAttribute("style", "margin-right:8px;"); input = document.createElement("input"); input.setAttribute("type", "text"); input.setAttribute("id", "initials"); input.setAttribute("class", "form-control"); input.setAttribute("placeholder","JS"); input.setAttribute("required","true"); var button = document.createElement("button"); button.setAttribute("type", "submit"); button.setAttribute("class", "btn btn-primary"); button.setAttribute("id", "submitBtn"); button.textContent = "Submit"; div.append(label); div.append(input); form.append(div); form.append(button); content.append(form); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showResults(results){\n\t\n}", "function show_results() {\n\t\t$('#mc_btns').hide();\n\t\t$('#progress-box').hide();\n\t\t$('#result-btns').show();\n\t\t$('#page-title').html('Results').hide().fadeIn(500);\n\t}", "function showResults() {\n $(\"#results\").show();\n $(\"#correctanswers\"...
[ "0.83796424", "0.8032661", "0.79927695", "0.7973715", "0.7820019", "0.78063816", "0.7768171", "0.7695292", "0.76834977", "0.76825", "0.76168966", "0.7601364", "0.75971085", "0.75827533", "0.75353664", "0.7469749", "0.7440658", "0.74109024", "0.7407934", "0.7361401", "0.735525...
0.0
-1
This starts the timer on pressing "Start Quiz" button
function startTimer(){ interval = setInterval(function() { totalSeconds--; timer.textContent = "Time : " +totalSeconds; if(totalSeconds<0){ stopTimer(); alert("Time Up!!!"); showResults(); timer.textContent = "Time : 0"; } }, 1000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startQuiz(){\n timerCount = 30;\n startQuizButton.disabled = true;\n\n //First queston display\n displayQuiz();\n\n //Timer starts to count down\n startTimer();\n \n }", "function startQuiz() {\n handleAnswerClick();\n displayInterface();\n \n timer();\n}", "function ...
[ "0.84979266", "0.8377631", "0.83421713", "0.82279676", "0.81773514", "0.8157394", "0.8102212", "0.8091078", "0.8082269", "0.80552167", "0.8002226", "0.7994655", "0.79870164", "0.7952219", "0.79392457", "0.79217166", "0.7904673", "0.7898548", "0.78870714", "0.7885742", "0.7884...
0.0
-1
This function first stores the value to localStorage and then displays the value
function displayHighscores(initials, score){ var userInitials; var userScore; content.textContent = ""; highscoreTitle.textContent = "Highscores"; var title = document.createElement("p"); highscoreTitle.append(title); highscoreTitle.setAttribute("style","font-size:28px; font-style:bold; padding:25px; !important"); if(localStorage.getItem("userInitials") && localStorage.getItem("userScore")){ userInitials = JSON.parse(localStorage.getItem("userInitials")); userScore = JSON.parse(localStorage.getItem("userScore")); }else{ userInitials = []; userScore = []; } if((initials!=null && score!=null) && (initials!="" || score!="")){ userInitials.push(initials); userScore.push(score); localStorage.setItem("userInitials", JSON.stringify(userInitials)); localStorage.setItem("userScore", JSON.stringify(userScore)); } var finalInitials = JSON.parse(localStorage.getItem("userInitials")); var finalScore = JSON.parse(localStorage.getItem("userScore")); if(finalInitials!=null){ for(var values= 0; values<finalInitials.length; values++){ var highscoreValue1 = document.createElement("p"); highscoreValue1.setAttribute("style","margin:16px 0; font-size:18px;"); highscoreValue1. textContent = finalInitials[values]+ " - " +finalScore[values]; highscoreDisplay.prepend(highscoreValue1); } highscoreTitle.append(highscoreDisplay); }else{ var title2 = document.createElement("p"); title2.textContent = "No Highscores to display. Please take test!!!" title2.setAttribute("style","margin:16px 0; font-size:18px;"); highscoreTitle.append(title2); } var button1 = document.createElement("button"); button1.setAttribute("id", "goBack"); button1.setAttribute("class", "btn btn-primary mr-5"); button1.textContent = "Go Back"; var button2 = document.createElement("button"); button2.setAttribute("id", "clearHighscores"); button2.setAttribute("class", "btn btn-primary"); button2.textContent = "Clear Highscores"; highscoreTitle.append(button1); highscoreTitle.append(button2); // Onpressing the "goBack" button displays the homePage button1.addEventListener("click", function(event){ event.preventDefault(); window.location.reload(); }); // Onpressing the "ClearHighscores" clears the highscores from localStorage too button2.addEventListener("click", function(event) { event.preventDefault(); if(event.target.id === 'clearHighscores'){ localStorage.removeItem('userInitials'); localStorage.removeItem('userScore'); highscoreDisplay.textContent=""; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showStoreValue() {\n\tvar item = localStorage.getItem(localStorageKey);\n\t\n\tif (item == null) {\n\t\titem = 'Nothing in store';\n\t} else if (item.length === 0) {\n\t\titem = 'Store contains empty value'; \n\t}\n\t\n\t$('.storeItem').text(item);\n}", "function displayScores() {\n document.getEleme...
[ "0.79007894", "0.7499455", "0.7394474", "0.72622263", "0.7226946", "0.7147585", "0.71225077", "0.7114784", "0.7097173", "0.70767146", "0.7061297", "0.70601517", "0.70083827", "0.69997674", "0.6984179", "0.6961659", "0.6947761", "0.69032186", "0.6901314", "0.6886904", "0.68723...
0.0
-1
check that all members agree that the wallet is fully approved now
function checkAndFinalizeWallet(wallet, onDone) { db.query("SELECT member_ready_date FROM wallets LEFT JOIN extended_pubkeys USING(wallet) WHERE wallets.wallet=?", [wallet], function (rows) { if (rows.length === 0) { // wallet not created yet or already deleted // throw Error("no wallet in checkAndFinalizeWallet"); console.log("no wallet in checkAndFinalizeWallet"); return onDone ? onDone() : null; } if (rows.some(function (row) { return !row.member_ready_date; })) return onDone ? onDone() : null; db.query("UPDATE wallets SET ready_date=" + db.getNow() + " WHERE wallet=? AND ready_date IS NULL", [wallet], function () { if (onDone) onDone(); eventBus.emit('wallet_completed', wallet); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkReadyForSubmit(){\n if(this.checkAnswersReady() && this.checkAddressReady() && this.checkMembership()){\n return true;\n }\n else{\n return false;\n }\n }", "function performChecks() {\n if (atLeastOneAdmin()) {\n let demoteSelf = false;\n ...
[ "0.6465505", "0.61762244", "0.6079832", "0.60730726", "0.601335", "0.5954323", "0.5920635", "0.5887216", "0.58646625", "0.58586264", "0.5834388", "0.58060724", "0.5749621", "0.5729037", "0.5722815", "0.5711033", "0.5704529", "0.56971294", "0.5690364", "0.5686234", "0.5676086"...
0.60021394
5
initiator of the new wallet creates records about itself and sends requests to other devices
function createWallet(xPubKey, account, arrWalletDefinitionTemplate, walletName, isSingleAddress, handleWallet) { var wallet = crypto.createHash("sha256").update(xPubKey, "utf8").digest("base64"); console.log('will create wallet ' + wallet); var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate); setTimeout(function () { addWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, function () { handleWallet(wallet); if (arrDeviceAddresses.length === 1) // single sig return; console.log("will send offers"); // this continues in parallel while the callback handleWallet was already called // We need arrOtherCosigners to make sure all cosigners know the pubkeys of all other cosigners, even when they were not paired. // For example, there are 3 cosigners: A (me), B, and C. A is paired with B, A is paired with C, but B is not paired with C. device.readCorrespondentsByDeviceAddresses(arrDeviceAddresses, function (arrOtherCosigners) { if (arrOtherCosigners.length !== arrDeviceAddresses.length - 1) throw Error("incorrect length of other cosigners"); arrDeviceAddresses.forEach(function (device_address) { if (device_address === device.getMyDeviceAddress()) return; console.log("sending offer to " + device_address); sendOfferToCreateNewWallet(device_address, wallet, arrWalletDefinitionTemplate, walletName, arrOtherCosigners, isSingleAddress, null); sendMyXPubKey(device_address, wallet, xPubKey); }); }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addWallet() {}", "async createNewWallet(walletId, mnemonic, restoreHeight) {\n const pathName = mnemonic ? mnemonicHasher(mnemonic) : createRandomHash(8);\n\n const walletConfig = {\n path: pathjs.join(WALLETS_PATH, pathName),\n password: createRandomHash(),\n networkType: MoneroNetworkType....
[ "0.6795212", "0.67434233", "0.66491395", "0.6545587", "0.6383956", "0.6288529", "0.62812907", "0.6272693", "0.6252663", "0.6245656", "0.6152518", "0.6132928", "0.6112114", "0.60959184", "0.6085097", "0.60662955", "0.60092795", "0.59285754", "0.59209657", "0.5903874", "0.58551...
0.64236265
4
walletName will not be used
function createSinglesigWallet(xPubKey, account, walletName, handleWallet) { var arrDefinitionTemplate = ["sig", { pubkey: '$pubkey@' + device.getMyDeviceAddress() }]; createWallet(xPubKey, account, arrDefinitionTemplate, walletName, null, handleWallet); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addWallet() {}", "static generateWallet() {\n const wallet = EthereumJsWallet.generate();\n\n AnalyticsUtils.trackEvent('Generate wallet', {\n walletAddress: wallet.getAddressString(),\n });\n\n this.storeWallet(wallet);\n }", "setWalletName(store, { name }) {}", "removeWallet() {}", "fun...
[ "0.71450025", "0.6903897", "0.6820971", "0.67283136", "0.6643265", "0.6560982", "0.65130633", "0.64113885", "0.63825154", "0.63022906", "0.62454325", "0.6138936", "0.6117011", "0.61133426", "0.61069167", "0.6066534", "0.59985024", "0.5996005", "0.5951974", "0.5950851", "0.592...
0.57392174
29
called from UI after user confirms creation of wallet initiated by another device
function approveWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, arrOtherCosigners, onDone) { var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate); device.addIndirectCorrespondents(arrOtherCosigners, function () { addWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, function () { arrDeviceAddresses.forEach(function (device_address) { if (device_address !== device.getMyDeviceAddress()) sendMyXPubKey(device_address, wallet, xPubKey); }); if (onDone) onDone(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createAccount(){\n\n console.log('ACCOUNT CREATED')\n\n // // Ropsten URL \n let ropstenRPC = 'https://ropsten.infura.io/c7b70fc4ec0e4ca599e99b360894b699'\n\n // Create a Web3 instance with the url. \n var web3js = new web3(new web3.providers.HttpProvider(ropstenRPC));\...
[ "0.68957555", "0.67932266", "0.6651633", "0.65637904", "0.63823557", "0.6373131", "0.6356969", "0.62372476", "0.621725", "0.6212654", "0.6204557", "0.62029", "0.6188136", "0.61433065", "0.6130359", "0.60820746", "0.6046302", "0.6030047", "0.601154", "0.5984836", "0.597262", ...
0.578535
43
called from network, without user interaction One of the proposed cosigners declined wallet creation
function deleteWallet(wallet, rejector_device_address, onDone) { db.query("SELECT approval_date FROM extended_pubkeys WHERE wallet=? AND device_address=?", [wallet, rejector_device_address], function (rows) { if (rows.length === 0) // you are not a member device return onDone(); if (rows[0].approval_date) // you've already approved this wallet, you can't change your mind return onDone(); db.query("SELECT device_address FROM extended_pubkeys WHERE wallet=?", [wallet], function (rows) { var arrMemberAddresses = rows.map(function (row) { return row.device_address; }); var arrQueries = []; db.addQuery(arrQueries, "DELETE FROM extended_pubkeys WHERE wallet=?", [wallet]); db.addQuery(arrQueries, "DELETE FROM wallet_signing_paths WHERE wallet=?", [wallet]); db.addQuery(arrQueries, "DELETE FROM wallets WHERE wallet=?", [wallet]); // delete unused indirect correspondents db.addQuery( arrQueries, "DELETE FROM correspondent_devices WHERE is_indirect=1 AND device_address IN(?) AND NOT EXISTS ( \n\ SELECT * FROM extended_pubkeys WHERE extended_pubkeys.device_address=correspondent_devices.device_address \n\ )", [arrMemberAddresses] ); async.series(arrQueries, function () { eventBus.emit('wallet_declined', wallet, rejector_device_address); onDone(); }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addWallet() {}", "removeWallet() {}", "if (wallets.hasActiveWallet) {\n runInAction(() => {\n this.disableTransferFunds = false;\n });\n }", "async addWallet() {\n // Validate and format address\n let newAddress = this.validateAddress();\n // Deactivate addressInput b...
[ "0.67413193", "0.6667065", "0.6565684", "0.6286294", "0.61377686", "0.60939074", "0.604016", "0.60349756", "0.6025271", "0.60119087", "0.5966179", "0.5861924", "0.58335984", "0.58123046", "0.5742271", "0.5716277", "0.57004464", "0.5681153", "0.56799626", "0.56536573", "0.5652...
0.60137016
9
called from network, without user interaction
function readCosigners(wallet, handleCosigners) { db.query( "SELECT extended_pubkeys.device_address, name, approval_date, extended_pubkey \n\ FROM extended_pubkeys LEFT JOIN correspondent_devices USING(device_address) WHERE wallet=?", [wallet], function (rows) { rows.forEach(function (row) { if (row.device_address === device.uPMyHotDeviceAddress()) { if (row.name !== null) throw Error("found self in correspondents"); row.me = true; } //else if (row.name === null) //throw Error("cosigner not found among correspondents, cosigner=" + row.device_address + ", my=" + device.getMyDeviceAddress()); }); handleCosigners(rows); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Network() {}", "function Network() {}", "function Network() {}", "function Network() {}", "function Network() {}", "networkQueryOffersCollected() {\n this.socket.emit('networkQueryOffersCollected');\n }", "sending () {\n }", "function noNetworkDetected(){\n //We have no netwo...
[ "0.59743446", "0.59743446", "0.59743446", "0.59743446", "0.59743446", "0.57886153", "0.57811815", "0.5754062", "0.57035315", "0.57022405", "0.5689081", "0.5689081", "0.5689081", "0.5689081", "0.5689081", "0.5689081", "0.56524056", "0.5562783", "0.5557042", "0.5527577", "0.550...
0.0
-1
selects one of recent addresses if the gap is too large, otherwise issues a new address
function issueOrSelectNextAddress(wallet, is_change, handleAddress) { readNextAddressIndex(wallet, is_change, function (next_index) { if (next_index < MAX_BIP44_GAP) return issueAddress(wallet, is_change, next_index, handleAddress); readLastUsedAddressIndex(wallet, is_change, function (last_used_index) { if (last_used_index === null || next_index - last_used_index >= MAX_BIP44_GAP) selectRandomAddress(wallet, is_change, last_used_index, handleAddress); else issueAddress(wallet, is_change, next_index, handleAddress); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBestAddress(addresses) {\n // Keep only the addresses with the best match code\n /**\n * I haven't found any test data with duplicate addresses that have\n * different match codes. Until I find any such data, there's no need\n * to compare match codes\n */...
[ "0.53035456", "0.5300804", "0.5250905", "0.52014977", "0.51555926", "0.514475", "0.51274574", "0.50708115", "0.49832755", "0.49712998", "0.48785564", "0.4850904", "0.48318028", "0.4829284", "0.4823226", "0.47610778", "0.47494188", "0.470453", "0.46989533", "0.46976852", "0.46...
0.6008617
0
Helper method for defining associations. This method is not a part of Sequelize lifecycle. The `models/index` file will call this method automatically.
static associate(models) { // define association here }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static associate(models) {\n // define association here\n // This is how Sequelize knows to create \"magic methods\"\n // These are functions that can automatically pull\n // related data.\n // For example: If I have a User object\n // I can call `await user.getContacts()` to get an\n...
[ "0.7640944", "0.7507814", "0.73126423", "0.7306951", "0.7306951", "0.7306951", "0.72936827", "0.7284587", "0.7278498" ]
0.0
-1
ordinate Capture the position, again depending on client's browser
function captureMousePosition(e) { if(document.layers) { xMousePos = e.pageX; yMousePos = e.pageY; } else if(document.all) { xMousePos = window.event.x + document.body.scrollLeft; yMousePos = window.event.y + document.body.scrollTop; } else if(document.getElementById) { xMousePos = e.pageX; yMousePos = e.pageY; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getMousePosition(event) {\n let CTM = damier.getScreenCTM();\n //Si sur mobile\n if(event != undefined && event.touches){\n event = event.touches[0];\n }\n //on transforme la position de la souris (en px, obtenue via CTM) en position en % sur notre damier (car la posit...
[ "0.708026", "0.67051363", "0.6700206", "0.66628206", "0.663844", "0.6632078", "0.66249824", "0.66219914", "0.66059685", "0.6593351", "0.6574394", "0.6571737", "0.6571329", "0.650686", "0.6501473", "0.648355", "0.6469135", "0.64642197", "0.6462404", "0.64610213", "0.6459249", ...
0.65903556
10