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
List of settings for history requests
function RequestsSettingsModel(name, ParsingJsonService, RequestsSettingsService) { var self = this; self.name = name; self.data = { requestsCount: 10000, saveReceived: true, fillWithReceived: true, saveResponseData: true, }; self.loadFromStorage = loadFromStorage; self.saveToStorage = saveToStorage; self.clone = clone; self.setData = setData; /** * */ function setData(data) { angular.forEach(self.data, function (val, key){ self.data[key] = data[key]; }); } /** * Create copy of this object */ function clone() { var result = self.name === 'yangman_historySettings' ? RequestsSettingsService.createHistorySettings() : RequestsSettingsService.createCollectionsSettings(); result.setData(self.data); return result; } /** * Loading from localStorage */ function loadFromStorage(){ var settings = localStorage.getItem(self.name); if (settings){ angular.forEach(ParsingJsonService.parseJson(settings), function (value, key){ self.data[key] = value; }); } return self; } /** * Saving to local storage */ function saveToStorage(){ console.debug('saving settings', self); try { localStorage.setItem(self.name, JSON.stringify(self.data)); } catch (e) { } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static getAll(history) {\n const ctxt = \"pl\";\n\n return new Promise((resolve, reject) => {\n Api.initAuth(history);\n Api.get(endpoint(\"settings\", ctxt)).then((data) => {\n if (typeof data === \"object\") {\n if (Object.keys(data).length === 0) {\n resolve(undefined)...
[ "0.6947702", "0.5971782", "0.5971782", "0.5907524", "0.5886222", "0.58680356", "0.5710169", "0.56947595", "0.56703126", "0.55831796", "0.5541712", "0.55398035", "0.5510154", "0.5501426", "0.5496229", "0.5496056", "0.5469322", "0.54645383", "0.5405658", "0.53690374", "0.536628...
0.0
-1
Create copy of this object
function clone() { var result = self.name === 'yangman_historySettings' ? RequestsSettingsService.createHistorySettings() : RequestsSettingsService.createCollectionsSettings(); result.setData(self.data); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copy()\n\t{\n\t\treturn this.constructor.createNewInstance(this);\n\t}", "clone() {\n\t\tlet data = JSON.parse(JSON.stringify(this.Serialize()));\n\t\treturn new this.constructor(data);\n\t}", "clone() {\n return new this.constructor(this);\n }", "clone() {\n return Object.assign(Object.create(thi...
[ "0.8280515", "0.81947494", "0.79354817", "0.7776851", "0.77584827", "0.77584827", "0.771262", "0.75974697", "0.75974697", "0.75686955", "0.75449437", "0.7509984", "0.7507627", "0.75017196", "0.7500579", "0.7495404", "0.728451", "0.728254", "0.7254721", "0.7253717", "0.7253717...
0.64996004
82
Saving to local storage
function saveToStorage(){ console.debug('saving settings', self); try { localStorage.setItem(self.name, JSON.stringify(self.data)); } catch (e) { } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function save() {\n storage.write(filename, data);\n }", "function save() {\n localStorage && localStorage.setItem(key, Y.JSON.stringify(data));\n }", "async function save() {\n await localStorage.setItem(\n KEY,\n JSON.stringify({\n path,\n text,\n revis...
[ "0.80368495", "0.79595757", "0.7826227", "0.7813021", "0.77804625", "0.7695233", "0.7685229", "0.7540586", "0.7520764", "0.74880517", "0.74453187", "0.74440217", "0.7441403", "0.74403673", "0.7424962", "0.73773855", "0.73752004", "0.7341365", "0.73277444", "0.73108155", "0.73...
0.7876531
2
ADDS A LIST TO SELECT FROM IN THE LEFT SIDEBAR
appendNewListToView(newList) { // GET THE UI CONTROL WE WILL APPEND IT TO let listsElement = document.getElementById("todo-lists-list"); let appModel=this.model // MAKE AND ADD THE NODE let newListId = "todo-list-" + newList.id; let listElement = document.createElement("div"); listElement.setAttribute("id", newListId); listElement.setAttribute("class", "todo_button sidebar_list_item"); listElement.appendChild(document.createTextNode(newList.name)); listElement.addEventListener('click',function(){ document.getElementById('add-list-button').classList.remove('add_list_disabled') appModel.resetStack() if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } let controls=document.getElementsByClassName('list-item-control') for(let i=0;i<controls.length;i++){ controls[i].style.pointerEvents='all' controls[i].style.color='white' } let lists=document.getElementById('todo-lists-list').getElementsByClassName('todo_button') for(let i=0;i<lists.length;i++){ lists[i].classList.remove('todo_button_selected') lists[i].classList.add('todo_button_unselected') lists[i].style.color="rgb(233,237,229)" } listElement.classList.remove('todo_button_unselected') listElement.classList.add('todo_button_selected') listElement.parentNode.insertBefore(listElement,listElement.parentNode.firstChild) listElement.style.color='rgb(255,200,25)' let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' //document.getElementsByClassName('list-item-control').style.pointerEvents="all"; }) listElement.addEventListener('dblclick',function(){ listElement.innerHTML='' listElement.innerHTML+= "<input style='position:relative;top:0px' id='listrenameinput-"+newListId+"'></input>" document.getElementById('listrenameinput-'+newListId).focus() document.getElementById('listrenameinput-'+newListId).value=newList.name document.getElementById('listrenameinput-'+newListId).addEventListener('blur',function(){ newList.name=document.getElementById('listrenameinput-'+newListId).value if(newList.name.length>17){ listElement.innerHTML=newList.name.substring(0,17)+'...'; } else{ listElement.innerHTML=newList.name; } }) }) listsElement.appendChild(listElement); // SETUP THE HANDLER FOR WHEN SOMEONE MOUSE CLICKS ON OUR LIST let thisController = this.controller; listElement.onmousedown = function() { thisController.handleLoadList(newList.id); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addColumnToList() {\n\tvar v_select_left = document.getElementById(\"sel_columns_left\");\n\n\tvar v_select_right = document.getElementById(\"sel_columns_right\");\n\tvar option = document.createElement(\"option\");\n\toption.text = v_select_left.options[v_select_left.selectedIndex].text;\n\tv_select_righ...
[ "0.60700077", "0.6057699", "0.6048242", "0.600039", "0.5834864", "0.5776954", "0.5775449", "0.5770298", "0.5769719", "0.57539314", "0.57136786", "0.57011944", "0.5698238", "0.56822866", "0.567221", "0.56227833", "0.5619517", "0.56174135", "0.55868936", "0.55697143", "0.556629...
0.0
-1
REMOVES ALL THE LISTS FROM THE LEFT SIDEBAR
clearItemsList() { let itemsListDiv = document.getElementById("todo-list-items-div"); // BUT FIRST WE MUST CLEAR THE WORKSPACE OF ALL CARDS BUT THE FIRST, WHICH IS THE ITEMS TABLE HEADER let parent = itemsListDiv; while (parent.firstChild) { parent.removeChild(parent.firstChild); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapseList() {\n\n // ******* TODO: PART IV *******\n // i handled this using the splice method below\n\n\n}", "function slurpDirt() {\n let index = dirtLeft.findIndex(\n (e) => JSON.stringify(e) === JSON.stringify(position)\n );\n if (index !== -1) {\n dirtLeft.splice(index, ...
[ "0.6119306", "0.6073067", "0.6062365", "0.6050946", "0.6043112", "0.6011475", "0.59660184", "0.59328943", "0.5924713", "0.59137356", "0.5889891", "0.5886529", "0.5865554", "0.5855752", "0.585447", "0.5846196", "0.5832427", "0.5790428", "0.57790256", "0.5778222", "0.5736488", ...
0.5771221
21
REFRESHES ALL THE LISTS IN THE LEFT SIDEBAR
refreshLists(lists) { // GET THE UI CONTROL WE WILL APPEND IT TO let listsElement = document.getElementById("todo-lists-list"); listsElement.innerHTML = ""; for (let i = 0; i < lists.length; i++) { let list = lists[i]; this.appendNewListToView(list); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "refreshLists(lists) {\n // GET THE UI CONTROL WE WILL APPEND IT TO\n let listsElement = document.getElementById(\"sidebar-list\");\n listsElement.innerHTML = \"\";\n\n for (let i = 0; i < lists.length; i++) {\n let list = lists[i];\n this.appendListToView(list);\n ...
[ "0.6936278", "0.6511532", "0.6427955", "0.62023824", "0.60670644", "0.6019444", "0.5966541", "0.59629416", "0.5945299", "0.5916517", "0.5827676", "0.58243024", "0.5822333", "0.5805565", "0.5798106", "0.57892853", "0.578919", "0.57723224", "0.5770962", "0.57616454", "0.5755956...
0.5748387
24
LOADS THE list ARGUMENT'S ITEMS INTO THE VIEW
viewList(list) { let appModel=this.model if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } // WE'LL BE ADDING THE LIST ITEMS TO OUR WORKSPACE let itemsListDiv = document.getElementById("todo-list-items-div"); // GET RID OF ALL THE ITEMS this.clearItemsList(); for (let i = 0; i < list.items.length; i++) { // NOW BUILD ALL THE LIST ITEMS let listItem = list.items[i]; let listItemElement = "<div id='todo-list-item-" + listItem.id + "' class='list-item-card list-item-row'>" + "<div onclick='changeTodoDesc("+ listItem.id+");' id='todo-list-desc-"+listItem.id+ "' class='task-col task-desc' > " + listItem.description + "</div>" +"<div id='todo-list-desc-input-"+ listItem.id+"' class='list-item-desc'><input type='text' id='tododescchange-" + listItem.id + "' class='list-item-desc-input'value='"+listItem.description+"'></input></div>" + "<div id='todo-list-date-" + listItem.id + "' class='due-date-col date-text' onclick='changeTodoDate("+listItem.id+")'>" + listItem.dueDate + "</div>" + "<div style='margin-left:21%;display:none;' id='todo-list-date-input-" + listItem.id + "' class='due-date-col-input'><input type='date' class='list-item-date-input' value='"+listItem.dueDate+"'></input></div>" + "<div onclick='changeStatus("+ listItem.id+");' id='todo-list-status-" + listItem.id + "' class='status-col status-text'>" + listItem.status + "</div>" + "<div id='status-col-selector-div-" + listItem.id + "' style='display:none;position:absolute;left:63%;margin-top:25px;'><select style='width:140%;background-color:rgb(64,69,78);color:white' id='status-col-selector-" + listItem.id + "' onclick='changeStatus("+listItem.id+")''> <option value='complete'>complete</option> <option value='incomplete'>incomplete</option></select></div>" + "<div class='list-controls-col'>" + " <div id='todo-move-up-"+ listItem.id + "' style='margin-top:25px;' class='list-item-control material-icons'>keyboard_arrow_up</div>" + " <div id='todo-move-down-"+ listItem.id + "' style='margin-top:25px;' class='list-item-control material-icons'>keyboard_arrow_down</div>" + " <div id='todo-close-"+ listItem.id + "' style='margin-top:25px;' class='list-item-control material-icons'>close</div>" + " <div class='list-item-control'></div>" + " <div class='list-item-control'></div>" + "</div>"; itemsListDiv.innerHTML += listItemElement; } for (let j = 0; j < list.items.length; j++) { let listItem = list.items[j]; document.getElementById('todo-move-up-'+listItem.id).addEventListener('click',function(){ let item=document.getElementById('todo-list-item-'+listItem.id); let itemList=document.getElementsByClassName('list-item-card'); let itemListArr=[...itemList] let prevIndex=itemListArr.indexOf(item)-1 document.getElementById('add-list-button').classList.add('add_list_disabled') item.parentNode.insertBefore(item,itemListArr[prevIndex]) let index=-1 for(let i=0;i<list.items.length;i++){ if(listItem.id==list.items[i].id){ index=i break; } } appModel.changePositionTransaction(index,index-1,listItem.id) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } // let temp=list.items[index-1] // list.items[index-1]=listItem // list.items[index]=temp let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows.length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' }) document.getElementById('todo-move-down-'+listItem.id).addEventListener('click',function(){ document.getElementById('add-list-button').classList.add('add_list_disabled') let item=document.getElementById('todo-list-item-'+listItem.id); let itemList=document.getElementsByClassName('list-item-card'); let itemListArr=[...itemList] let prevIndex=itemListArr.indexOf(item)+2 item.parentNode.insertBefore(item,itemListArr[prevIndex]) let index=-1 for(let i=0;i<list.items.length;i++){ if(listItem.id==list.items[i].id){ index=i break; } } appModel.changePositionTransaction(index,index+1,listItem.id) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } // let temp=list.items[index+1] // list.items[index+1]=listItem // list.items[index]=temp let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows.length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' }) document.getElementById('todo-close-'+listItem.id).addEventListener('click',function(){ document.getElementById('add-list-button').classList.add('add_list_disabled') let item=document.getElementById('todo-close-'+listItem.id).parentNode.parentNode // let index=-1 // for(let i=0;i<list.items.length;i++){ // if(listItem.id==list.items[i].id){ // index=i // break; // } // } appModel.removeOldItemTransaction(listItem) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } item.remove() // if list only has 1 item, disable both move up and down if(document.getElementsByClassName('list-item-card list-item-row').length==1){ let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[1].style.pointerEvents='none' firstRowIcons[1].style.color='rgb(53,58,68)' } let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows[i].length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' }) document.getElementById('todo-list-desc-'+listItem.id).addEventListener('click',function(){ // let temp= todoLists[0] // todoLists[0]=todoLists[index] // todoLists[index]=temp document.getElementById('add-list-button').classList.add('add_list_disabled') let lists=document.getElementById('todo-lists-list').getElementsByClassName('todo_button') let listsParent=lists[0].parentNode let index=-1 for(let i=0;i<lists.length;i++){ if(lists[i].id==('todo-list-'+list.id)){ index=i } lists[i].style.color="rgb(233,237,229)" } lists[index].style.color='rgb(255,200,25)' listsParent.insertBefore(lists[index],listsParent.firstChild) }) document.getElementById('todo-list-desc-input-'+listItem.id).querySelector("input").addEventListener('blur',function(){ let val=document.getElementById('todo-list-desc-input-'+listItem.id).querySelector("input").value if(listItem.description!=val){ appModel.changeTaskTextTransaction(listItem.description,val,listItem.id) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } } listItem.description=val; let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows[i].length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' document.getElementById('todo-list-desc-'+listItem.id).innerHTML=val; document.getElementById('todo-list-desc-input-'+listItem.id).style.display='none'; document.getElementById('todo-list-desc-'+listItem.id).style.visibility='visible' let lists=document.getElementById('todo-lists-list').getElementsByClassName('todo_button') let listsParent=lists[0].parentNode let index=-1 for(let i=0;i<lists.length;i++){ if(lists[i].id==('todo-list-'+list.id)){ index=i } } listsParent.insertBefore(lists[index],listsParent.firstChild) }); document.getElementById('todo-list-date-'+listItem.id).addEventListener('click',function(){ document.getElementById('add-list-button').classList.add('add_list_disabled') let lists=document.getElementById('todo-lists-list').getElementsByClassName('todo_button') let listsParent=lists[0].parentNode let index=-1 for(let i=0;i<lists.length;i++){ if(lists[i].id==('todo-list-'+list.id)){ index=i } lists[i].style.color="rgb(233,237,229)" } lists[index].style.color='rgb(255,200,25)' listsParent.insertBefore(lists[index],listsParent.firstChild) }) let date=document.getElementById('todo-list-date-input-'+listItem.id) date.querySelector('input').addEventListener('blur',function(){ let newDate=date.querySelector("input").value; if(listItem.dueDate!=newDate){ appModel.changeDateTransaction(listItem.dueDate,newDate,listItem.id) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } } listItem.dueDate=newDate; document.getElementById('todo-list-date-'+listItem.id).innerHTML=newDate; document.getElementById('todo-list-date-'+listItem.id).style.visibility='visible'; date.style.display='none'; let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows[i].length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' }); let statusSelect=document.getElementById('status-col-selector-'+listItem.id); for( let i=0;i<statusSelect.options.length;i++){ if(statusSelect.options[i].value==listItem.status){ statusSelect.selectedIndex=i; break; } } let status=document.getElementById('todo-list-status-'+listItem.id); if(status.innerHTML=='incomplete'){ status.style.color='rgb(234,145,84)'; } else{ status.style.color='rgb(142,212,248)'; } let statusDiv=document.getElementById('status-col-selector-div-'+listItem.id); status.addEventListener('click',function(){ document.getElementById('add-list-button').classList.add('add_list_disabled') let lists=document.getElementById('todo-lists-list').getElementsByClassName('todo_button') let listsParent=lists[0].parentNode let index=-1 for(let i=0;i<lists.length;i++){ if(lists[i].id==('todo-list-'+list.id)){ index=i } lists[i].style.color="rgb(233,237,229)" } lists[index].style.color='rgb(255,200,25)' listsParent.insertBefore(lists[index],listsParent.firstChild) statusSelect.focus() }) statusSelect.addEventListener('blur',function(){ statusDiv.style.display='none' status.style.visibility='visible' if(status.innerHTML=='incomplete'){ status.style.color='rgb(234,145,84)'; } else{ status.style.color='rgb(142,212,248)'; } }) statusSelect.addEventListener('click',function(){ let newStatus=statusSelect.value; status.innerHTML=newStatus //status.style.visibility='visible' if(listItem.status!=newStatus){ appModel.changeStatusTransaction(listItem.status,newStatus,listItem.id) if(appModel.getUndoSize()==0){ document.getElementById('undo-button').classList.add('add_list_disabled') } else{ document.getElementById('undo-button').classList.remove('add_list_disabled') } if(appModel.getRedoSize()==0){ document.getElementById('redo-button').classList.add('add_list_disabled') } else{ document.getElementById('redo-button').classList.remove('add_list_disabled') } } listItem.status=newStatus let firstRow=document.getElementsByClassName('list-item-card list-item-row')[0] let firstRowIcons=firstRow.getElementsByClassName('list-item-control material-icons') firstRowIcons[0].style.pointerEvents='none' firstRowIcons[0].style.color='rgb(53,58,68)' let allRows=document.getElementsByClassName('list-item-card list-item-row') for(let i=1;i<allRows[i].length;i++){ let allRowIcons=allRows[i].getElementsByClassName('list-item-control material-icons') for(let x=0;x<allRowIcons.length;x++){ allRowIcons[x].style.pointerEvents='all' allRowIcons[x].style.color='white' } } let lastRowIcons=document.getElementsByClassName('list-item-card list-item-row')[document.getElementsByClassName('list-item-card list-item-row').length-1].getElementsByClassName('list-item-control material-icons') lastRowIcons[1].style.pointerEvents='none' lastRowIcons[1].style.color='rgb(53,58,68)' }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set list(list){\n this._list = list;\n this.render()\n }", "function initList(){\r\n\tif(dataTableIsLoaded()){\r\n\t\tdestoryDataTable();\r\n\t}\r\n\tvar html = new EJS({url: 'javascripts/templates/list_view.ejs'}).render(internship_data);\r\n\t$(\"#list_view_body\").html(html);\r\n\tinitDataTab...
[ "0.65003216", "0.6224981", "0.62136775", "0.608084", "0.6069051", "0.5925901", "0.5832838", "0.58254915", "0.5825062", "0.5798715", "0.5787122", "0.57669705", "0.57536066", "0.5710626", "0.56908554", "0.56716305", "0.5657303", "0.5656698", "0.565303", "0.56497145", "0.5562066...
0.0
-1
THE VIEW NEEDS THE CONTROLLER TO PROVIDE PROPER RESPONSES
setController(initController) { this.controller = initController; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async show({ params, request, response, view }) {}", "async show({ params, request, response, view }) {\n }", "requestView(){\t\t\n\t\tthis.trigger('requestView');\n\t}", "async show ({ params, request, response, view }) {\n }", "async show ({ params, request, response, view }) {\n }", "async show ({ ...
[ "0.63194776", "0.6034931", "0.5975033", "0.5965259", "0.5965259", "0.5965259", "0.5965259", "0.5965259", "0.5965259", "0.5965259", "0.5955034", "0.58268714", "0.57410765", "0.5733831", "0.5731593", "0.5708007", "0.56882566", "0.5667873", "0.5646979", "0.5646979", "0.5646979",...
0.0
-1
Use of this source code is governed by a BSDstyle license that can be found in the LICENSE file.
function getMappingAndReplace() { sk.get('https://internal.skia.org/mapping/').then(function(resp) { replace(JSON.parse(resp)); }).catch(function() { console.error('Error connecting to internal.skia.org'); }); setTimeout(getMappingAndReplace, 10000); // 10 seconds }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static final private internal function m106() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "transient protected internal ...
[ "0.7139167", "0.6837431", "0.65248805", "0.64999384", "0.6238427", "0.6190297", "0.61669457", "0.61662513", "0.61616164", "0.61012816", "0.6044587", "0.60413057", "0.59534127", "0.5914116", "0.5885347", "0.5863976", "0.5860713", "0.578485", "0.5692495", "0.56601787", "0.56466...
0.0
-1
This function collects user data such as how many characters, and which type of characters they would like. If user selects less than 8 or more than 128 characters they will get an alert to select between 8 and 128.
function userSelectType() { howMany = prompt("How many characters would you like your password to contain.") if (howMany < 8 || howMany > 128) { alert("Please select a value between 8 and 128.") } else { firstType = confirm("Click OK to add lowercase characters.") secondType = confirm("Click OK to add uppercase characters.") thirdType = confirm("Click OK to add numeric characters.") fourthType = confirm("Click OK to add special characters.") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function characterSelector() {\n let sliderEl = document.getElementById('formControlRange');\n // console.log(sliderEl)\n let sliderDisplayEl = document.getElementById('sliderDisplay');\n // console.log(sliderDisplayEl);\n let passwordLength = sliderEl.value;\n // https://www.java67.com/2012/10/b...
[ "0.6800659", "0.6614458", "0.6517703", "0.63612986", "0.63320786", "0.63156265", "0.6278705", "0.6258698", "0.6241788", "0.62414694", "0.6240523", "0.62299997", "0.6216857", "0.6200515", "0.6156698", "0.61509234", "0.6144476", "0.6119292", "0.6111818", "0.60586345", "0.603724...
0.6540479
2
This function takes confirmed character types, and adds that array to a new array.
function addChoices() { if (firstType == true) choices = choices.concat(lowcaseChar); if (secondType == true) choices = choices.concat(upcaseChar); if (thirdType == true) choices = choices.concat(numericChar); if (fourthType == true) choices = choices.concat(specialChar); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "manipulateString() {\n let myArray = Array.from(gatherInput().toLowerCase(), x => {\n switch (x) {\n case 'a':\n return 1\n break;\n case 'b':\n return 2\n break;\n case 'c':\n return 3\n break;\n case 'd':\n return ...
[ "0.56422704", "0.5607449", "0.5603855", "0.55382437", "0.55072707", "0.54873794", "0.53914696", "0.5379787", "0.5378454", "0.5365118", "0.52910143", "0.52797097", "0.5273398", "0.52640635", "0.5241884", "0.5235894", "0.51747507", "0.517365", "0.5172673", "0.5171287", "0.51568...
0.5305465
10
This function generates the password. If they did not select any character types, the password box will state no characters selected and an alert will ask them to choose at least one type of chracter. If they selected at least one type password is generated and returned.
function generatePassword() { if (firstType === false && secondType === false && thirdType === false && fourthType === false) { alert("Please choose at least one type.") return "No password characters selected." } else { for (i = 0; i < howMany; i++) { newPass += choices[Math.floor(Math.random() * (choices.length - 1))]; } return newPass } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generatePassword() {\n \n var charList = \"\";\n \n if (upCharacters) {\n charList = charList + \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n }\n if (lowCharacters) {\n charList = charList + \"abcdefghijklmnopqrstuvwxyz\";\n ...
[ "0.8620715", "0.84379184", "0.8294107", "0.8285383", "0.82662433", "0.8253135", "0.8216017", "0.8182304", "0.81427187", "0.81349444", "0.81297743", "0.8115978", "0.81069636", "0.8099991", "0.8079995", "0.80752784", "0.8063197", "0.8054204", "0.80452657", "0.80384576", "0.8037...
0.8408611
2
This function resets the password output each time you click for a new password.
function resetPass() { howMany = (0); choices = []; newPass = (""); password = (""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() { \n passwordLength = 0;\n specialCharacters = false;\n numbers = false;\n uppercase = false;\n lowercase = false;\n validInput = false;\n }", "function reset() {\n password = \"\";\n charactersToUse = \"\";\n le...
[ "0.75233674", "0.7469336", "0.73596096", "0.7296241", "0.72147584", "0.7180623", "0.71603745", "0.71364355", "0.71304846", "0.70602924", "0.7030731", "0.70264536", "0.6991227", "0.6958533", "0.6945553", "0.69365084", "0.6933001", "0.69326466", "0.6919259", "0.68748736", "0.68...
0.7998078
0
Write password to the password input. This will also run the generate password function.
function writePassword() { var password = generatePassword(); var passwordText = document.querySelector("#password"); passwordText.value = password; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writePassword() {\n var password = generatePassword();\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n generatePassword()\n }", "function writePasswo...
[ "0.8602847", "0.8589338", "0.857945", "0.8491261", "0.8425412", "0.8423503", "0.8396477", "0.8396209", "0.8395533", "0.8367764", "0.8359636", "0.8337766", "0.83352834", "0.83309877", "0.83226883", "0.8319957", "0.83150727", "0.8314448", "0.82903343", "0.8289602", "0.8284951",...
0.82230896
73
Function made to copy password to clipboard by grabbing the id from the pageXOffset.
function copyPass() { var copyText = document.getElementById("password"); copyText.select(); copyText.setSelectionRange(0, 128) document.execCommand("copy"); alert("Copied the text: " + copyText.value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copyPassword() {\n let copiedText = document.getElementById(\"password\");\n copiedText.select();\n copiedText.setSelectionRange(0, 99999);\n document.execCommand(\"copy\");\n\n}", "function copyPassword(){\n\n document.getElementById(\"viewerPoint\").select();\n\n document.execCommand...
[ "0.75539476", "0.7462277", "0.7418522", "0.74028176", "0.7394039", "0.7387179", "0.7352431", "0.735099", "0.7323031", "0.73020625", "0.7287851", "0.72574097", "0.72436285", "0.7213551", "0.72078055", "0.7195278", "0.71900606", "0.7164402", "0.71498835", "0.71289223", "0.71278...
0.7456433
2
Solution by Prince O. Onyenike
function checkCashRegister(price, cash, cid) { var denominations = [ {'name': 'ONE HUNDRED' , value: 100.00}, {'name': 'TWENTY' , value: 20.00}, {'name': 'TEN' , value: 10.00}, {'name': 'FIVE' , value: 5.00}, {'name': 'ONE' , value: 1.00}, {'name': 'QUARTER' , value: 0.25}, {'name': 'DIME' , value: 0.10}, {'name': 'NICKEL' , value: 0.05}, {'name': 'PENNY' , value: 0.01} ]; var totalCashInDrawer = 0.0; for (var j = 0; j < cid.length; j++) { totalCashInDrawer += cid[j][1]; } var changeDue = cash - price; if(totalCashInDrawer < changeDue){ console.log("Insufficient Funds"); return "Insufficient Funds"; }else if(totalCashInDrawer === changeDue){ console.log("Closed"); return "Closed"; } var result = []; cid = cid.reverse(); for(var i=0; i<denominations.length; i++){ var value = 0.0; if(changeDue >= denominations[i].value){ while (changeDue >= denominations[i].value && cid[i][1] >= denominations[i].value) { value += denominations[i].value; changeDue -= denominations[i].value; changeDue = Math.round(changeDue * 100)/100; cid[i][1] -= denominations[i].value; } result.push([denominations[i].name, value]); } } return changeDue === 0 ? result : "Insufficient Funds"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "static private internal function m121() {}", "protected internal function m252() {}", "private public function m246() {}", "transient protected internal function m189() {}", "static private protected internal function m118() {}", "static protected internal functio...
[ "0.61992574", "0.5899133", "0.5830115", "0.5812727", "0.55021274", "0.5402913", "0.5345003", "0.5290449", "0.52716345", "0.5267635", "0.52601933", "0.5198047", "0.51842606", "0.51764965", "0.511236", "0.5112244", "0.5097956", "0.5092681", "0.5089016", "0.5064945", "0.50521034...
0.0
-1
dealing with logging input and output of pvs
function console_log(msg) { console.log(msg); var c = document.getElementById('console_log'); c.innerHTML = msg + "<br>" + c.innerHTML; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function log(p, v) {\n console.log(p+'\\t'+v+'\\t'+timestamp);\n}", "function log(p, v) {\n console.log(p + \" \" + v + \" \" + timestamp);\n}", "function l(input) {\n\n\tif(writeLogs === true) {\n\t\tconsole.log(input);\n\t}\n}", "function SFVTPV(state) {\n state.fv = state.pv;\n\n if (exports.DEBUG...
[ "0.63552153", "0.6276675", "0.5972628", "0.58903635", "0.5843083", "0.5710847", "0.5591433", "0.5566524", "0.55598205", "0.54517907", "0.5357442", "0.53542167", "0.53204674", "0.52865994", "0.52787095", "0.5233214", "0.522754", "0.5204039", "0.51670945", "0.5155948", "0.51559...
0.0
-1
utitlity function to pretty print pvsio output
function prettyPrint(msg) { return msg ? msg.toString().replace(/,,/g, ",") : msg; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Pretty(){}", "function pretty(obj){\n\tconsole.log(obj.length , obj);\n}", "pretty() {\n // output pretty formatted string\n let str = [];\n /**\n * Make a specified length space string\n * @param numberOfSpaces Length of output string\n */\n functio...
[ "0.63990533", "0.60574657", "0.59906065", "0.5965526", "0.5953478", "0.59327334", "0.58584094", "0.5787679", "0.57857835", "0.57665855", "0.56982166", "0.5684852", "0.56559956", "0.56511915", "0.56346446", "0.5623669", "0.5599686", "0.55837756", "0.5581661", "0.5564067", "0.5...
0.5010018
99
parses pvs output into a json object map
function parseState(state) { var st = state[0].substr(2, state[0].length - 4); var props = st.split(","); var res = {}; props.forEach(function (p) { var args = p.split(":="); res[args[0].trim()] = args[1] ? args[1].trim() : args[1]; }); return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_output(s) {\n var d = {};\n s.trim().split('\\n').forEach(function(line) {\n var split = line.trim().split(/\\s+/);\n d[split[0]] = +split[1];\n });\n return d;\n}", "function output_parser(input){\n\t\tvar basic_rule = [\"job-rules\", \"paper-rule\"];\n const T24 = [\"BA-rule\", ...
[ "0.5995799", "0.5660491", "0.5613756", "0.55259496", "0.54452837", "0.5399332", "0.5372989", "0.5363012", "0.5346289", "0.53429", "0.5291741", "0.52829444", "0.51636", "0.5125561", "0.51239485", "0.51087177", "0.5102324", "0.5101059", "0.5093213", "0.50574577", "0.5054186", ...
0.0
-1
spec has .prototypeImage, .pvsSpec, .projectName
function newProject(spec) { //first upload the files for pictures and pvs source uploadFile(spec.prototypeImage, function (res) { var uploadedImageFile = JSON.parse(res.responseText).fileName; uploadFile(spec.pvsSpec, function (res) { var uploadedSpecFile = JSON.parse(res.responseText).fileName; //call websocket to create new project ws.send({ type: "createProject", uploadedSpecFileName: uploadedSpecFile, clientSpecFileName: spec.pvsSpec.name, projectName: spec.projectName, uploadedImageFileName: uploadedImageFile, clientImageFileName: spec.prototypeImage.name }, function (res) { console.log(res); if (!res.error) { currentProject = res; d3.select("div#body").style("display", null); ws.startPVSProcess(res.spec.split(".pvs")[0], currentProject.name, pvsProcessReady); var imagePath = "../../projects/" + currentProject.name + "/" + currentProject.image; updateImage(imagePath); updateProjectName(currentProject.name); d3.select("#imageDragAndDrop.dndcontainer").style("display", "none"); } }); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getArtboardSpecs(layer, parentFullName, namespace)\n {\n var doc = app.activeDocument;\n\n var obj = {};\n\n obj.name = layer.name;\n obj.index = layer.id;\n\n try\n { \n var bounds = getArtboardBounds(layer.id);\n\n obj.x = bounds[...
[ "0.5666802", "0.55121654", "0.5463144", "0.52257526", "0.5212159", "0.5198702", "0.5169123", "0.51137096", "0.5112813", "0.50962496", "0.507962", "0.5079485", "0.50653195", "0.50484604", "0.50300354", "0.5022696", "0.50067997", "0.50026155", "0.4993706", "0.49927765", "0.4976...
0.54248524
3
Definition for type : SoundControllerBrowser
function SoundControllerBrowser(name, root) { this.name = name; this.root = (root === null)? this : root; this.ready = false; this.bus = (root === null)? new EventEmitter() : this.root.bus; this.build(name); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sound() {\n\t\n}", "constructor(sound) {\n this._sound = sound;\n }", "function selectsound(e) {\r\n\t//disable the outer onclick event firing and only allow the inner\r\n\tif (!e) var e = window.event;\r\n e.cancelBubble = true;\r\n if (e.stopPropagation) e.stopPropaga...
[ "0.60804826", "0.6076882", "0.5968705", "0.59412426", "0.5913074", "0.5895327", "0.5885299", "0.5869244", "0.58261245", "0.5816252", "0.5799498", "0.57162577", "0.571611", "0.5714421", "0.570848", "0.5705615", "0.5696879", "0.5684364", "0.568339", "0.56799513", "0.5670722", ...
0.7050902
0
Function for the error with Ajax
function ajaxError(error) { chatBot.add('Je suis désolé, je ne peux pas vous répondre pour le moment, mon cerveau est en surchauffe :( !!'); // Display error message in the console console.error('[AJAX] ERROR : ' + error); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function errorOnAjax() {\n console.log(\"error\");\n}", "function ajaxError(err, msg) {\n alert('[错误信息]' + msg + err);\n}", "function handleAjaxError(error){\n\t showErrorMessage(\"An error has occured\");\n\t return true;\t \n}", "function doAjaxError(err){\n\tremove_loading();\n\...
[ "0.8300325", "0.7980312", "0.7892997", "0.78735447", "0.78506655", "0.77952456", "0.7719698", "0.76875454", "0.7674865", "0.7653777", "0.76460636", "0.7511524", "0.745673", "0.7422849", "0.74052167", "0.7403486", "0.7375422", "0.73528695", "0.73396087", "0.7319577", "0.731957...
0.79404247
2
Function for displaying the google map
function initMap(location, mapId) { geometry = location['geometry']; let map = new google.maps.Map(document.getElementById(mapId), { center: geometry, zoom: 14 }); let marker = new google.maps.Marker({ position: geometry, map: map, title: 'C\'est ici !' }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayMap() {\n $('#mapDiv').append(googleMap);\n}", "function displayMap(resLat,resLong,pId){\n $(\"#\"+pId).append(\"<iframe width='250' height='250' frameborder='0' style='border:0' src='https://www.google.com/maps/embed/v1/view?zoom=18&center=\" + resLat + \",\" + resLong + \"&key=\" + apiKey_...
[ "0.7699314", "0.75643134", "0.7433209", "0.74238217", "0.7393296", "0.7384002", "0.7344212", "0.7333262", "0.725457", "0.7216297", "0.719231", "0.71791923", "0.71637684", "0.7154047", "0.7137869", "0.70891", "0.70891", "0.7088295", "0.70634675", "0.7051867", "0.70506465", "...
0.0
-1
each square needs its own tl
function addRotationSequence(tl, squares, indexOfRotation, dir, startTime, dur) { let nextZeroIdx = 1; if (dir) nextZeroIdx = 3; tl .call(() => { squares.forEach(s => s.indexOfRotation = indexOfRotation); }, [], startTime) squares.forEach((s, i) => { tl.to(s, dur, { rotation: dur ? rotationAngle : -rotationAngle, ease: Back.easeInOut.config(2), onComplete: () => { s.resetPtsArray(nextZeroIdx) }}, startTime + (offset * i)) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setTL(){\n for(var i=0; i<im_p.length; i++){\n var c = Math.floor(i /rows); var r = i %rows; //current column /rom of tile in canvas\n tl_p[im_p[i].id] = {px:im_p[i].px, py:im_p[i].py, tx:c *tl_size.w, ty:r *tl_size.h, ord:i};\n }\n drawTL(tl_p); //draw tiles in c...
[ "0.64750546", "0.6448616", "0.5996558", "0.58501875", "0.56933475", "0.5663944", "0.56636715", "0.56618786", "0.5645103", "0.559932", "0.5595101", "0.5541799", "0.55329645", "0.5532179", "0.55275875", "0.55257195", "0.55210876", "0.5500411", "0.5484181", "0.5476576", "0.54735...
0.0
-1
this solution may be o(n^2) so this is another solution that i have found online I say that it is O(n^2) because using unshift is O(N) already , using in the while loop can make it O(N^2) that being said, while testing, My solution with unshift is still faster, but in the worst case, the bottom solution will out perform mine
function make_squares(arr) { const n = arr.length; squares = Array(n).fill(0); let highestSquareIdx = n - 1; let left = 0; let right = n - 1; while (left <= right) { let leftSquared = arr[left] ** 2, rightSquared = arr[right] ** 2; if (leftSquared > rightSquared) { squares[highestSquareIdx] = leftSquared; left++; } else { squares[highestSquareIdx] = rightSquared; right--; } highestSquareIdx -= 1; } return squares; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inssortshift2(A) {\n for (var i = 1; i !== A.length; i++) { // Insert i'th record\n var j;\n var temp = A[i];\n for (j = i; (j !== 0) && (temp < A[j - 1]); j--)\n A[j] = A[j-1];\n A[j] = temp;\n }\n}", "function inssortshift(A) {\n for (var i = 1; i < A.length; i++) { // Insert i'th ...
[ "0.6782179", "0.659091", "0.64935863", "0.6172952", "0.6161603", "0.61439526", "0.61426353", "0.6110815", "0.61037743", "0.6084196", "0.6074444", "0.60575396", "0.60428286", "0.6039935", "0.6022083", "0.6011853", "0.5998213", "0.5989112", "0.59839547", "0.59806395", "0.597716...
0.0
-1
this function isn't used now
async function createAccount(uid, point, pointType) { var domain = CONFIG.ubtDomain return new Promise((resolve, reject) => { wx.request({ url: domain + '/ubt/point/create', //创建帐号; data: { "point": point, "seq": Math.round(Math.random() * 1000000), "type": pointType, "uid": uid }, method: "POST", header: { "Content-Type": "application/json" }, complete: function (res) { if (res == null || res.data == null) { console.error('网络请求失败') reject(new Error('网络请求失败')) } }, success: function (res) { if (res.data.status == 0) { resolve(res.data) } else { reject(new Error(res)); } } }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private protected internal function m182() {}", "static private internal function m121() {}", "transient private internal fun...
[ "0.7191189", "0.6865583", "0.6846352", "0.6546148", "0.65255684", "0.6441113", "0.6431351", "0.63312954", "0.6248954", "0.6175129", "0.59622765", "0.5959476", "0.5944729", "0.5914628", "0.5911452", "0.5896722", "0.5895152", "0.5881386", "0.5804981", "0.5750393", "0.5696987", ...
0.0
-1
processing tasks in sequence and return the results
function request(url, acc, finalize, progress){ $.ajax(url).done(function(ret){ if(typeof(progress) === "function"){ progress(); } if(ret.more){ request(ret.next, acc.concat(ret.data), finalize, progress); } else { finalize(acc.concat(ret.data)); } }).fail(function(){ throw "Failed at " + url; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function process() {\n // schaut in lokaler varable nach, ob ich am arbeiten bin oder nicht, falls ich am arbeiten bin mache ich ein return\n // wenn ich schon am arbeiten bin, dann passiert garnichts\n if (inProcess) { return; }\n if (tasks.length === 0) { return; } // guard clause\n ...
[ "0.66252744", "0.65031916", "0.6469231", "0.6334655", "0.62832284", "0.62433594", "0.62137675", "0.6201011", "0.6154423", "0.6148302", "0.6148302", "0.61430556", "0.6125035", "0.60921764", "0.6078479", "0.60480684", "0.60480684", "0.6008135", "0.60024494", "0.5962327", "0.595...
0.0
-1
Return true to count, false to ignore
function limiter(t, nft) { return nft.properties.TYPE.toLowerCase() === t; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get countable () {\n return true\n }", "count() {}", "get _countable () {\n return true\n }", "get _countable () {\n return true\n }", "function countTrue(array) {\n let count = 0;\n for (let element of array) {\n if (element) {\n count++;\n }\n }\n return count;\n}", "function...
[ "0.6633588", "0.6313941", "0.6289358", "0.6289358", "0.6170109", "0.6153445", "0.6141343", "0.61064404", "0.6106035", "0.60925263", "0.6034157", "0.59955126", "0.5995502", "0.59951043", "0.59623605", "0.5939542", "0.5922278", "0.5922278", "0.5911789", "0.5910615", "0.58995336...
0.0
-1
Send back errors in standard format and log with App Insights
sendError(res, err, title = 'smilr-api-error') { console.log(`### Error with events API ${err.toString()}`); let source = ((new Error().stack).split("at ")[2]).trim(); let statusCode = err.code ? err.code : 500; if(statusCode < 100 || statusCode > 999) statusCode = 500; // Problem Details object as per https://tools.ietf.org/html/rfc7807 let problemDetails = { error: true, title: title, details: err.toString(), status: statusCode, source: source }; // App Insights const appInsights = require("applicationinsights"); if(appInsights.defaultClient) appInsights.defaultClient.trackException({apiError: problemDetails}); res.status(statusCode).send(problemDetails); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "callErrorTelemetryService(app, logDataObject) {\n const api = app.service('telemetry/error');\n\n const payload = {\n log: logDataObject,\n uuid: this.uuid,\n flavor: this.options.flavor,\n };\n\n return api.create(payload)\n .then(res => logger.debug(`Pushed error log (message='${l...
[ "0.6364397", "0.6159961", "0.6005267", "0.594253", "0.5934596", "0.5909099", "0.59001315", "0.5899429", "0.58847034", "0.5874711", "0.584976", "0.5843109", "0.5843109", "0.5843109", "0.5831574", "0.58239853", "0.5815372", "0.5811194", "0.5798798", "0.5781954", "0.5772357", ...
0.69874775
0
This will send data back to caller
sendData(res, data) { // App Insights const appInsights = require("applicationinsights"); if(appInsights.defaultClient) appInsights.defaultClient.trackEvent({name: "dataEvent", properties: {data: JSON.stringify(data)}}); res.type('application/json'); res.status(200).send(data) return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sendData() {\n\n }", "function sendBack(obj){\n zAu.send(new zk.Event(widget, \"onData\", obj, {toServer:true}));\n}", "function onReceiveData(data) {\n appForm.responseTarget.value = JSON.stringify(data);\n }", "function amReturnData(map_id, data) {\n\tAmmap.publish('amreturndata', map_id, data);...
[ "0.73012024", "0.6955992", "0.6414183", "0.61845654", "0.6135842", "0.61153924", "0.6101351", "0.6095928", "0.6095928", "0.6095928", "0.6024867", "0.60096925", "0.6007909", "0.60058385", "0.6002841", "0.59699", "0.5947876", "0.59358037", "0.59338003", "0.5912471", "0.58960414...
0.5547443
73
Security check function, attempts to validate JWT tokens
verifyAuthentication(req) { return new Promise(function(resolve, reject) { // Short circuit validation if SECURE_CLIENT_ID is not set if(!process.env.SECURE_CLIENT_ID) resolve(true); // Check we even have a authorization header if(!req.headers['authorization']) { reject('SECURE_CLIENT_ID is set, but authorization bearer token missing'); return; } // Validate using azure-ad-jwt // Note. azure-ad-jwt has been modified to support AAD v2 try { var aad = require('./azure-ad-jwt/azure-ad-jwt') } catch(e) { console.log(e); } var authorization = req.headers['authorization'] var bearer = authorization.split(" "); var jwtToken = bearer[1]; //console.log("### TOKEN ###", jwtToken); let aadV2 = true; if(process.env.AAD_V1 == "true") aadV2 = false; aad.verify(jwtToken, null, true, aadV2, function(err, result) { if (result) { // validate audience is our client id if(result.aud == process.env.SECURE_CLIENT_ID) { console.log(`### Verified identity of '${result.name}' in token on API call`); resolve(result) } else { reject("Verify authentication failed, SECURE_CLIENT_ID doesn't match token audience claim") } } else { console.log("### Verify authentication failed, JWT is invalid: " + err); reject(err) } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validarTk(token){\n return jwt.verify(token, config.jwtSecret);\n \n \n}", "async validateToken(token){\n try{\n const payload = await jwt.verify(token, this.secretKey);\n }catch{\n return false;\n }\n return true;\n }", "function veri...
[ "0.75768447", "0.73291826", "0.72350734", "0.7218123", "0.7212188", "0.71858364", "0.71858364", "0.7170401", "0.715143", "0.7061176", "0.7046874", "0.6948716", "0.68968856", "0.6885559", "0.6874865", "0.6863838", "0.6856907", "0.68424255", "0.682252", "0.6815366", "0.6813086"...
0.0
-1
Simple random ID generator, good enough, with len=6 it's a 1:56 billion chance of a clash
makeId(len) { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < len; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateId() { // random 6-char string\n\t\tvar letters = [];\n\t\tvar possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\t\tvar possible_len = possible.length;\n\t\tvar id_length = 6;\n\t\twhile (0 < id_length--) {\n\t\t\tletters.push(possible.charAt(Math.floor(M...
[ "0.8533485", "0.8352224", "0.83299136", "0.8312365", "0.8305388", "0.825622", "0.82488114", "0.8240944", "0.8236236", "0.82240975", "0.8217062", "0.81953406", "0.8183079", "0.81412745", "0.8125245", "0.8122815", "0.8115036", "0.8107139", "0.81021917", "0.81015295", "0.809577"...
0.7948781
61
Sleep, call with await
sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }", "function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }", "async function sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n }", "sleep() {}", "sleep (ms) {\n return new Prom...
[ "0.7734972", "0.7734972", "0.75035596", "0.7503463", "0.7495497", "0.7492673", "0.7455424", "0.74169195", "0.7415466", "0.7408139", "0.740782", "0.7396054", "0.73655164", "0.7362256", "0.7352233", "0.7337586", "0.7337374", "0.73321176", "0.73278004", "0.73192", "0.73192", "...
0.74056304
11
Verif si c'est un nombre
function isDigit(c) { return c >= '0' && c <= '9'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nombre(){\n\t\tvar nombre = $('#name').val();\n\t\tif (nombre === null || nombre.length === 0){\n\t\t\t$('.name-container').append('<span>¡Error! El campo nombre no debe estar vacío</span>'); //llamo a la clase del contenedor y le paso el span con el texto\n\t\t\treturn false;\n\t\t}else if(nombre.substri...
[ "0.6718784", "0.6515408", "0.61571205", "0.6043286", "0.6016227", "0.59723145", "0.58885247", "0.58808357", "0.5836634", "0.5835853", "0.58278024", "0.58011353", "0.5795129", "0.5770972", "0.5741319", "0.57346505", "0.57306427", "0.5687022", "0.5668759", "0.5651621", "0.56400...
0.0
-1
Functions Implementation // noinspection JSUnusedLocalSymbols
function onStateChangeStart(e, toState, toParams, fromState){ $state.previous = fromState; if (toState.data && toState.data.requiredAuthentication) { var _requiredAuthentication = toState.data.requiredAuthentication; if (_requiredAuthentication && !Authentication.isAuthenticated()) { console.group('stateChange Rejected. Authentication Needed'); console.warn('fromState: ', fromState.name); console.warn('toState: ', toState.name); console.groupEnd(); e.preventDefault(); $state.go('home', {'notify': false}); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Func_s() {\n}", "function FunctionUtils() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion (){}", "function miFuncion(){\n\n}", "function fuction() {\n\n}", "function fun() { }", "private public function m246() {}", "function myFunc...
[ "0.7657109", "0.7358425", "0.7324249", "0.7324249", "0.7324249", "0.7299934", "0.7073495", "0.70656824", "0.6849384", "0.6835084", "0.6785154", "0.67738205", "0.6698249", "0.6684674", "0.666826", "0.66443133", "0.6634278", "0.66263384", "0.66104734", "0.6608992", "0.65857714"...
0.0
-1
These tests run against a local instance of CockroachDB that meets the following requirements: 1. Running with the insecure flag. 2. Contains a database named "sequelize_test". To override the CockroachDB port, set the COCKROACH_PORT environment variable.
async function cleanupDatabase(sequelize) { // https://github.com/sequelize/sequelize/blob/29901187d9560e7d51ae1f9b5f411cf0c5d8994a/test/support.js#L136 const qi = sequelize.getQueryInterface(); await qi.dropAllTables(); sequelize.modelManager.models = []; sequelize.models = {}; if (qi.dropAllEnums) { await qi.dropAllEnums(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function initializeDatabase() {\n process.env.MOCKDB_URL = MOCKDB_URL;\n await database.initialize(MOCKDB_URL);\n}", "function main() {\n // First, we need to initialize the data model\n sequelize.initSequelize();\n\n // Then, continue populating the test data\n populateAllTestData(false).then(()...
[ "0.5773255", "0.5632219", "0.5593921", "0.5415647", "0.5367834", "0.53002644", "0.52497435", "0.51860976", "0.5154959", "0.513085", "0.5110358", "0.5104306", "0.5090198", "0.50545996", "0.5040464", "0.50367695", "0.50060004", "0.49912503", "0.49582863", "0.49522117", "0.49128...
0.0
-1
input value degerlerini aliyoruz
updateInputValueEmail(evt) { this.setState({ email: evt.target.value }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function proverka(input) { \n var value = input.value; \n var rep = /[-\\.;\":'/a-zA-Zа-яА-Я ]/; \n if (rep.test(value)) { \n value = value.replace(rep, ''); \n input.value = value; \n }\n }", "function cleanData(){\n document.getElementById(\"num\").val...
[ "0.6882495", "0.6689794", "0.6645712", "0.6524091", "0.6496844", "0.64361644", "0.6359559", "0.635951", "0.6354187", "0.6308404", "0.62934995", "0.6277315", "0.6256743", "0.62380373", "0.622323", "0.6200319", "0.61771446", "0.6165554", "0.612627", "0.6121818", "0.6110369", ...
0.0
-1
input value degerlerini aliyoruz
updateInputValuePass(evt) { this.setState({ password: evt.target.value }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function proverka(input) { \n var value = input.value; \n var rep = /[-\\.;\":'/a-zA-Zа-яА-Я ]/; \n if (rep.test(value)) { \n value = value.replace(rep, ''); \n input.value = value; \n }\n }", "function cleanData(){\n document.getElementById(\"num\").val...
[ "0.68854755", "0.6691233", "0.66468376", "0.65250593", "0.6494026", "0.6431661", "0.6361743", "0.6357025", "0.63554555", "0.63077956", "0.62898326", "0.62828565", "0.62592036", "0.6233287", "0.62222517", "0.6199552", "0.6178587", "0.6166894", "0.6128951", "0.6122693", "0.6110...
0.0
-1
Remove values from array
function removeFromArray(startingPoint) { let myArray = [1, 2, 3, 4]; // Grab the additional arguments which will be removed from myArray let toBeRemoved = Array.prototype.slice.call(arguments, 1); // Go through myArray from starting point for (i = startingPoint; i < myArray.length; i++) { // Go through tobeRemoved array from 0 for (j = 0;j < toBeRemoved.length; j++) { if(myArray[i] == toBeRemoved[j]) { myArray.splice(i,1); } } } return myArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "arrayRemove(arr, value) {\n return arr.filter(function(ele){\n return ele != value;\n });\n }", "function arrayRemove(arr, value) { \r\n return arr.filter(function(ele){ \r\n return ele != value; \r\n });\r\n }", "function arrayRemoveByVal(value, arr) {\n return ar...
[ "0.79451245", "0.77447647", "0.7729826", "0.7707592", "0.7644685", "0.7642417", "0.7629058", "0.7613043", "0.7599546", "0.7571394", "0.7567827", "0.74870723", "0.74782616", "0.7386126", "0.73071057", "0.7270143", "0.7239263", "0.7236073", "0.7162326", "0.7107825", "0.7084856"...
0.0
-1
Get a random colour
function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randColor() {\n return Math.floor(Math.random() * 256);\n}", "function randomColor () {\nreturn Math.floor (Math.random() * 256) ;\n}", "function randomColor() {\n return Math.floor(Math.random() * 255);\n}", "function gencolor() {\n len = _COLOR.length;\n rand = Math.floor(Math.random()*l...
[ "0.8802517", "0.8730149", "0.86941904", "0.8666582", "0.8655234", "0.86388963", "0.86221707", "0.861838", "0.8581597", "0.8580601", "0.85794586", "0.8574002", "0.8548262", "0.85388845", "0.853776", "0.85301393", "0.85286796", "0.8521791", "0.8519573", "0.8511103", "0.85049564...
0.0
-1
New code For the fun, it simulates the same process than Paypal when you want to verify your account
function verifyAccount() { return (dispatch) => { dispatch(removeAmountOnAccount(0.30)); // Simulate asynchronous treatment setTimeout(() => { dispatch(addAmountOnAccount(0.30)); }, 1000); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function verifyAdyenPayment() {\n tokenManager.getToken().then(function(newToken) {\n // add login token to GET\n GET['token'] = newToken;\n\n url = '/order/current/receipt/';\n dataToSend = GET;\n $scope.status = requestWrapper.init();\n req...
[ "0.6992972", "0.64376515", "0.6423944", "0.6243999", "0.6110865", "0.5990402", "0.596417", "0.59589165", "0.59098476", "0.58390874", "0.58082443", "0.5801025", "0.57950157", "0.5780294", "0.57485473", "0.57445616", "0.57265365", "0.57222253", "0.5721798", "0.5716645", "0.5711...
0.0
-1
All functions to be called on $(window).load() should be in this function
function mkdfOnWindowLoad() { uncoveringFooter(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function documentReadyFunction() {\n onPageLoadOrResize();\n onPageLoad();\n }", "function eltdfOnWindowLoad() {\n\t eltdfWooCommerceStickySidebar().init();\n\t eltdfInitButtonLoading();\n eltdfInitProductListMasonryShortcode();\n }", "function onLoaded()\n\t{\n\t\twindow.initE...
[ "0.7603443", "0.7390145", "0.70822436", "0.6952076", "0.6911911", "0.6875787", "0.6837854", "0.6804085", "0.67883515", "0.6787063", "0.6762158", "0.6727174", "0.67183834", "0.6708196", "0.66999775", "0.6696354", "0.6674478", "0.6656283", "0.6647745", "0.6633798", "0.66316754"...
0.62382495
68
let count = 0;
function postData (data){ return fetch('https://api.sjonbin.io/b', { method: "POST", headers: { 'Content-type': 'aplication/json', 'secret-key': SECRET_KEY, private: 'true', name: 'todo', }, body: JSON.stringify(data) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function count() {\n return counter +=1;\n }", "count() {}", "function getCount() {\n return count;\n}", "constructor() {\n this.count = 0;\n }", "function defineVariable(){\r\n //define a variable \"count\" with value 0\r\n let count = 0;\r\n //then increment it\r\n count += 1;\...
[ "0.8043517", "0.80302155", "0.7901133", "0.77123946", "0.7686996", "0.7480703", "0.73399496", "0.73348606", "0.7317078", "0.73149186", "0.72395337", "0.7220059", "0.71401584", "0.7124376", "0.70871264", "0.7057174", "0.70476586", "0.70288664", "0.6997159", "0.69155455", "0.69...
0.0
-1
2. Write a function to check whether a string is blank or not. "My random string" > false " " > true 12 > false false > false
function isBlank (input) { if (input === "" ) { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ifBlank(s) {\n if (s === ' ') {\n return true;\n }\n else {\n return false;\n }\n\n}", "function is_Blank(input) {\n return input === \"\";\n}", "function isBlankAgain(string) {\n return string.length === 0;\n}", "function isBlank(str) {\n\t// Following code based on SI...
[ "0.763297", "0.7453941", "0.7409631", "0.7342658", "0.7321767", "0.7260667", "0.72108215", "0.71890867", "0.71690804", "0.7143483", "0.71417224", "0.7133227", "0.7129156", "0.7093016", "0.70762616", "0.703499", "0.7034444", "0.7014258", "0.70139045", "0.70066446", "0.69970185...
0.71269286
13
3. Write a function that concatenates a given string n times (default is 1). "Ha" > "Ha" "Ha", 3 > "HaHaHa"
function concHaHaHa(n) { var string = 'Ha'; var conc = ''; for (i =0; i < n; i++) { conc = conc + string; } return conc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function concatenate(string, n) {\n var newString = '';\n for (var i=1; i<=n; i++){\n newString += string;\n \n }\n return newString;\n }", "function concatenateString(str,n){\n if (n !== undefined){\n \n var result = \"\";\n for (va...
[ "0.8035956", "0.79715735", "0.78111184", "0.7790325", "0.77254444", "0.7722534", "0.76935434", "0.76921636", "0.7671627", "0.7671571", "0.7642865", "0.7603114", "0.757212", "0.7564924", "0.7563", "0.7555896", "0.7540956", "0.7510442", "0.74898845", "0.7486013", "0.744113", ...
0.76318264
11
4. Write a function to count the number of letter occurrences in a string. My random string;, "n"; > 2
function letOccur(str, a){ var countletter = 0; for (var i=0; i < str.length; i++) { if (str[i] === a) { countletter ++ } } return countletter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function count(str, letter){\r\n let n =0\r\n if(str === \"\"){\r\n return 0\r\n } else {\r\n return 1+ count(str.substr(1), letter) \r\n } \r\n }", "function strCount(str, letter){ \n counter = 0;\n for (var i = 0; i < str.length; i++) {\n if (letter === str[i]) {\n ...
[ "0.82470864", "0.8113964", "0.8015104", "0.79940236", "0.7913993", "0.78763175", "0.7875984", "0.78402376", "0.78277576", "0.7816622", "0.78118503", "0.7800634", "0.7794196", "0.7759462", "0.7751548", "0.7723177", "0.77134526", "0.77045697", "0.76789886", "0.76566213", "0.765...
0.789525
5
5. Write a function to find the position of the first occurrence of a character in a string. The result should be the position of character. If there are no occurrences of the character, the function should return 1.
function firstOccur (string, char) { var position = 0; for (var i = 0; i < string.length; i++){ if (string[i] === char){ position = i + 1; break } else position = -1 } return position; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function firstOccur (string, char) {\n var position = 0;\n for (var i = string.length - 1; i >= 0; i--){\n if (string[i] === char){\n position = i + 1;\n break\n }\n else position = -1\n }\n return position;\n}", "function charFirstOccurrence(word, char) {\n    for (var i = 0; ...
[ "0.8581308", "0.8273311", "0.77913934", "0.7741584", "0.77254933", "0.76719266", "0.7599205", "0.7445891", "0.74153006", "0.741329", "0.7364193", "0.7300704", "0.7180715", "0.715022", "0.7081069", "0.7068148", "0.70542204", "0.70376897", "0.70350057", "0.70129186", "0.6992878...
0.8674178
0
6. Write a function to find the position of the last occurrence of a character in a string. The result should be in human numeration form. If there are no occurrences of the character, function should return 1.
function firstOccur (string, char) { var position = 0; for (var i = string.length - 1; i >= 0; i--){ if (string[i] === char){ position = i + 1; break } else position = -1 } return position; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lastPositionOcc (s){\n var position;\n for (i = s.length; i<=0; i--){\n if (s[i] === 'a'){\n position = i;\n }else{\n position = -1\n }\n }\n return position;\n}", "function charLastOccurrence(word, char) {\n\n    if (typeof word !== \"string\")...
[ "0.81344646", "0.7767376", "0.7356346", "0.71163416", "0.71013486", "0.7084106", "0.7074216", "0.70578015", "0.7041216", "0.70129645", "0.69743514", "0.6931267", "0.6917107", "0.6886233", "0.67940646", "0.67750454", "0.67641973", "0.66597795", "0.6626484", "0.65917", "0.65845...
0.7282586
3
8. Write a function that accepts a number as a parameter and checks if the number is prime or not. Note: A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
function primeNum(p) { var isPrime = true; for (var i = 2; i < 10; i++){ if (p % i === 0 && p !== i) { isPrime = false; break; } } return isPrime; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPrime(number) {\n return false;\n}", "function isPrime (number) { // <== HELPER FUNCTION\n if (number < 2) {\n return false;\n }\n for (let i = 2; i < number; i++) {\n if (number % i === 0)\n return false;\n }\n return true;\n}", "functi...
[ "0.8386542", "0.83662987", "0.8365691", "0.8327541", "0.8304682", "0.82405746", "0.822797", "0.8192832", "0.8181887", "0.81642264", "0.81553113", "0.81515807", "0.8139445", "0.8137998", "0.8134416", "0.81267804", "0.8115786", "0.80937064", "0.80833906", "0.8078109", "0.807810...
0.7838649
83
11. Write a function that converts an array of strings into an array of numbers. Filter out all nonnumeric values. ["1", "21", undefined, "42", "1e+3", Infinity] > [1, 21, 42, 1000]
function convertStrToNum(arrStr) { var strNum = []; var j = 0; for (var i = 0; i < arrStr.length; i++) { if (isFinite(parseFloat(arrStr[i]))) { strNum[j] = parseFloat(arrStr[i]); j++ } // console.log('Na poziciji i = ' + i +' Element stringa je' + arrStr[i] + '\n'); // console.log('Trenutna pozicija j = ' + (j - 1) +' Novi niz je ' + strNum + '\n'); } return strNum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filterNumbers(arr) {\n // Create the result list\n const result = arr.filter(function (value, i) {\n // Filter based on the rules for checking the input is number\n if (isNaN(value) || isBoolean(value) || isEmptyString(value)) {\n return false;\n }\n return tru...
[ "0.766184", "0.7534108", "0.7414322", "0.74075735", "0.7395704", "0.735002", "0.73126084", "0.70446825", "0.6990663", "0.69765645", "0.69010615", "0.6880747", "0.68706137", "0.6843171", "0.6719546", "0.6700495", "0.66902333", "0.6671926", "0.6564365", "0.6556153", "0.6554588"...
0.61715513
38
12. Write a function to calculate how many years there are left until retirement based on the year of birth. Retirement for men is at age of 65 and for women at age of 60. If someone is already retired, a proper message should be displayed.
function pension(birth,currentY,gender) { var ret; if (gender === 'man') { ret = 65 - (currentY - birth); } else if (gender === 'woman') { ret = 60 - (currentY - birth); } else { return 'Please check input.'; } if (ret > 0) { return ret + ' years to retirement'; } else { return 'Already retired' } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function yearsUntilRetirement(year, firstName){\n var age = calculateAge(year);\n var retirement = 65 - age;\n console.log(firstName+' retires in '+retirement+' years.');\n \n if (retirement > 65 ) {\n console.log(firstName+' retires in '+retirement+' years.'); \n} else{\n console.log...
[ "0.83355594", "0.8149428", "0.81295055", "0.7784376", "0.7691339", "0.7645908", "0.7616594", "0.75262773", "0.75016785", "0.74922544", "0.74807143", "0.74688905", "0.7408682", "0.7386212", "0.73635", "0.72814167", "0.72460365", "0.7244297", "0.72218955", "0.7217785", "0.72064...
0.73046017
15
13. Write a function to humanize a number (formats a number to a humanreadable string) with the correct suffix such as 1st, 2nd, 3rd or 4th. 1 > 1st 11 > 11th
function humanize(num) { var hum; if (num > 10 && num < 14) { hum = num + 'th' } else { moduo = num%10; switch (moduo) { case 1: hum = num + 'st'; break; case 2: hum = num + 'nd'; break; case 3: hum = num + 'rd'; break; case 4: case 5: case 6: case 7: case 8: case 9: case 0: hum = num + 'th'; break; } } return hum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function humanizeNumber(num) {\n    if (typeof num == \"undefined\") {\n        return;\n    } else if (num % 100 >= 11 && num % 100 <= 13) {\n        return num + \"th\";\n    }\n\n    switch (num % 10) {\n        case 1:\n            return num + \"st\";\n        case 2:\n            return num + \"nd\";\n      ...
[ "0.8271928", "0.81836253", "0.8143194", "0.80579984", "0.77747047", "0.7366961", "0.728201", "0.72567785", "0.706675", "0.70405966", "0.6930349", "0.68315476", "0.6785624", "0.67429656", "0.67326176", "0.6717082", "0.6688041", "0.66686445", "0.6661422", "0.6644648", "0.663307...
0.7761266
5
USE THIS TO SHUFFLE YOUR NUMBERS + Jonas Raoni Soares Silva
function shuffle(o){ //v1.0 //debugger; for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffle() {\n // TODO\n }", "function scramble(arr) {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n return arr;\n }", "shuffle() {\n let remainingCardTobeShu...
[ "0.69909877", "0.6906035", "0.6796631", "0.67895985", "0.6692701", "0.6692603", "0.66281027", "0.6591485", "0.6589744", "0.6582795", "0.65820277", "0.6580491", "0.6554072", "0.6536399", "0.6534814", "0.6528609", "0.6517592", "0.65047115", "0.65001225", "0.64794457", "0.647253...
0.0
-1
FIXME: Temporarily add this interface to workround the hardware mode's absence of feedback mechanism.
requestKeyFrame() { if (this.videoFrameConstructor) { this.videoFrameConstructor.requestKeyFrame(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async enableSimpleHIDMode() {\n const outputReportID = 0x01;\n const subcommand = [0x03, 0x3f];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReport...
[ "0.5787208", "0.54868996", "0.54536855", "0.5340145", "0.5326014", "0.5242392", "0.5205998", "0.51803243", "0.5172556", "0.51641774", "0.5145647", "0.513062", "0.512607", "0.5090459", "0.5076716", "0.5076541", "0.50657374", "0.5056713", "0.5053184", "0.5046573", "0.5042678", ...
0.0
-1
Raine: The 'is' prefix should be reserved for functions that return true or false. I would call this function validateField David: done
function validateField(input, result) { // Raine: Great idea here to generate the selector dynamically from the given alert! // I would use an id here. David: done // Even more flexible, I would pass in the entire selector or // selected element itself. That makes this function more flexible. var warning = "#" + input, inputField = "." + input; // Raine: A===true can be shortened to A, and A===false can be shortened to !A. David: done if (result) { $(inputField).removeClass('false'); $(inputField).addClass('true'); $(warning).text('true'); } else { $(inputField).removeClass('false'); $(inputField).addClass('true'); $(warning).text('false'); $('body').append('<p id = "invalidAlert">This form is invalid!</p>'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validateField(type, name, linenum)\r\n{\r\n\r\n\t/* On validate field:\r\n\r\n - EXPLAIN THE PURPOSE OF THIS FUNCTION\r\n\r\n\r\n FIELDS USED:\r\n\r\n --Field Name--\t\t\t\t--ID--\r\n\r\n\r\n */\r\n\r\n\r\n\t// LOCAL VARIABLES\r\n\r\n\r\n\r\n\t// VALIDATE FIELD CODE BODY\r...
[ "0.7162346", "0.7049844", "0.68507665", "0.66644734", "0.66519225", "0.6615955", "0.6596849", "0.65759194", "0.6549138", "0.6496338", "0.64707875", "0.64399064", "0.64200556", "0.6408081", "0.64050335", "0.64050335", "0.64041495", "0.63965243", "0.63948655", "0.6384043", "0.6...
0.60527784
46
Raine: Doesn't allow spaces David: rename function to 'isValidName'
function validateName (nameValue) { for (i =0; i < nameValue.length; i++) { // Raine: charCodeAt takes a single parameter, the index of the character. If you don't pass anything, // it's going to interpret undefined as 0, but you should really pass 0 explicitly. In this case you // can just use nameValue.charCodeAt(i); David: done var utf8 = nameValue[i].charCodeAt(i); // Raine: This would be easier to understand if it was abstracted into two separate functions, // isLowerCaseLetter and isUpperCaseLetter. Anything to break apart functionality into small, // meaningful chunks is a good thing. David: done if (!(isUpperCaseLetter(utf8)|| isLowerCaseLetter(utf8))) { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isNameValid(name) {\n let workString = name;\n let regExpOnlySpaces = /\\S/;\n \n if(!workString.match(regExpOnlySpaces)){\n return false;\n }\n if(workString.length > 15 || workString.length < 5){\n return false;\n }\n \n return true;\n \n }", "function validateName (name) {...
[ "0.82316196", "0.821675", "0.81515276", "0.8129199", "0.8129199", "0.8067069", "0.8015445", "0.79715806", "0.79535645", "0.7917626", "0.7917626", "0.7891456", "0.78888625", "0.78823835", "0.78819144", "0.78395975", "0.7829666", "0.78240794", "0.7804458", "0.7802442", "0.77972...
0.7433074
43
Raine: validateZip("123456") should return false because it is given too many digits. validate Zip: 5 digits
function validateZip (zipValue) { if (!zipValue.length =5) { console.log("zip is not 5"); return false; } console.log(zipValue); console.log(zipValue.length); for (i=0; i < 5; i++) { if (isDigit(zipValue.charCodeAt(i))) { } else { return false; } } return true; // Raine: If the function makes it this far, it will return undefined! That's not good. // Since it's a boolean function, it should always return true or false. David: done }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isValidZip() {\n return /^[0-9]{5}$/.test(zip.value);\n}", "function validate_us_zip(value) {\n var zip = clean_nonnumbers(value);\n return validate(zip.length,eq,5);\n }", "function validateZipCode() {\n var e = document.getElementById(\"Zip\").value;\n if (isNumber(e) && e.length == 5) {...
[ "0.81330067", "0.80533826", "0.8038291", "0.7960465", "0.788502", "0.7874849", "0.7783538", "0.77712184", "0.77378815", "0.7720159", "0.7658067", "0.76452875", "0.7626697", "0.76198494", "0.7576782", "0.7480395", "0.7471494", "0.7469405", "0.74507934", "0.74363244", "0.743271...
0.79283583
4
validate Phone: 10 digits, with or without dashes. Raine: Return false if the total length of the string is greater than 10.
function validatePhone (phoneValue) { // Raine: Notice how (phoneValue.charCodeAt(i) > 47 && phoneValue.charCodeAt(i) < 58) is repeated 5 // times in this function? Great opportunity to refactor into a separate function. David: done for (i=0; i < 3; i++) { //check that 1st three are digits if (!(isDigit(phoneValue.charCodeAt(i)))) { return false; } // continue if first three are digits... } if (isDigit(phoneValue.charCodeAt(3))) { console.log(phoneValue[3]); //if 4th is a digit, check if the next six are digits (haven't yet prevented an 11th) for (i=4; i < 10; i++) { if (!(isDigit(phoneValue.charCodeAt(i)))) { return false; } } return true; //no further char testing needed, the entry proven to be 10 digits } else { // Raine: Same as (phoneValue[3] === '-') if (phoneValue.charCodeAt(3) == 45) { // if the 4th is a '-', check if the next three are digits for (i=4; i < 7; i++) { if (!(isDigit(phoneValue.charCodeAt(i)))) { return false; } } } } if (phoneValue.charCodeAt(7) == 45) { // if the 7th is a '-', check if the next four are digits for (i=8; i < 11; i++) { if (!(isDigit(phoneValue.charCodeAt(i)))) { return false; } } } else { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validPhoneNo(phoneNo){\r\n\tif (phoneNo.length < 10)\r\n\t\treturn false;\r\n\tvar m=phoneNo.match( \"^([0-9,-]+)$\" );\r\n\treturn m!=null;\r\n}", "function checkPhone(input){\n\n const exp = /^\\d{10}$/;\n if(!exp.test(input.value)){\n error(input, \"Phone number must have 10 characters!\...
[ "0.788282", "0.7706468", "0.76671475", "0.7581376", "0.754516", "0.7540834", "0.75191045", "0.75144154", "0.7482401", "0.7451907", "0.74410945", "0.74361646", "0.7417812", "0.7384425", "0.732375", "0.73033625", "0.7282102", "0.72649616", "0.7260523", "0.7219234", "0.71918935"...
0.7592318
3
Renders the color pickers panel
function renderColorSelect(id, color, onChange) { return ( <div className="color-select" data-cy={id}> <TwitterPicker color={color} colors={AVAILABLE_COLOR_VALUES} onChangeComplete={onChange} triangle="hide" /> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildColorPicker() {\n // modify the DOM\n var container = $(\"#color-container\");\n if (!state.canvasDrawn) {\n var label = document.createElement(\"p\");\n var labelText = document.createTextNode(\"Color: \");\n label.className = \"colorLabel\";\n label.appendChild(labelTex...
[ "0.67822033", "0.6627951", "0.6621157", "0.6553587", "0.654642", "0.64898014", "0.6476373", "0.64724284", "0.6437735", "0.6436166", "0.6377865", "0.6374563", "0.6354302", "0.63314784", "0.6284738", "0.62184256", "0.621378", "0.61948174", "0.6171663", "0.6165506", "0.61635697"...
0.0
-1
Renders a number select for grid size configuration
function renderSizeSelect(id, value, onChangeFn) { return ( <select data-cy={id} className="swapper-select" value={value} onChange={onChangeFn}> {Array.from(Array(GRID_SIZE_MAX_VALUE).keys()).map(val => { return (<option key={val} className="swapper-option" value={val + 1}>{val + 1}</option>) })} </select> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gridSizeDisplay(value){\n\t$('#grid-size').html(\"<p>Grid Size: </p>\" + value)\n}", "function selectGridSizeFunc() {\n container.innerHTML = \"\";\n const input = prompt(\"Please select a grid resolution. (input 64 for a 64 x 64 sketchpad)\", 16);\n setUpSketch(input);\n}", "grid(number) {\n...
[ "0.6752763", "0.6543984", "0.6214384", "0.61771846", "0.6171789", "0.6152411", "0.6141921", "0.59613734", "0.5922344", "0.59044045", "0.5872906", "0.5856771", "0.5847371", "0.58463675", "0.58189327", "0.5806348", "0.5757524", "0.5752318", "0.5749103", "0.57155013", "0.5710513...
0.63058716
2
Functions Initializes the game
function init() { for (var i = 0; i < diffButton.length; i++) { diffButton[i].addEventListener("click",setupButton); } setupSquares(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initGame() {\r\n initPelota();\r\n initNavecilla();\r\n initLadrillos();\r\n}", "function initGame(){\n resetGameStats()\n setLevel()\n gBoard = buildBoard()\n renderBoard(gBoard)\n gGame.isOn = true\n\n}", "function initializeGame() {\n createArray();\n initializeArray();\n ...
[ "0.8250364", "0.82303494", "0.8012855", "0.79775256", "0.7950634", "0.79375947", "0.79248047", "0.7918406", "0.78582805", "0.78475076", "0.7810885", "0.780732", "0.77672774", "0.7760223", "0.7759093", "0.77480733", "0.7746365", "0.7725795", "0.7679647", "0.7677406", "0.767150...
0.0
-1
Setups the squares accordingly to the game selection
function setupButton() { for(var i = 0; i < diffButton.length; i++) { diffButton[i].classList.remove("selected"); } this.classList.add("selected"); this.textContent === "Easy" ? numberOfSquares = 3 : numberOfSquares = 6; gameReset(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function squareSetup() {\n colors.forEach(function (colorsArry) {\n sqCreate = document.createElement(\"div\");\n sqCreate.className = \"square\";\n document.querySelector(\"#containerColors\").appendChild(sqCreate);\n sqCreate.style.backgroundColor = colorsArry;\n squares = document.querySelectorA...
[ "0.740718", "0.7184558", "0.7007719", "0.68654984", "0.68605685", "0.68424934", "0.6819488", "0.6795189", "0.67898804", "0.67876863", "0.6784556", "0.67581904", "0.67366105", "0.6731907", "0.67025226", "0.6691399", "0.6658293", "0.6650999", "0.6648246", "0.6617736", "0.66032"...
0.0
-1
These will work to randomize the colors
function changeColors(color1) { for(var i = 0; i < squares.length; i++) { squares[i].style.backgroundColor = color1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomizeColors() {\n background(random(0, 255), random(0, 255), random(0, 255));\n fill(random(0, 255), random(0, 255), random(0, 255));\n}", "randomizeColors(){\n for (const [key, color] of Object.entries(this.colors)) {\n color.newColor()\n }\n this.updateGradientStr...
[ "0.8520773", "0.8276336", "0.82340354", "0.8185119", "0.80897444", "0.80473214", "0.80432045", "0.80310714", "0.8020538", "0.7987794", "0.7975235", "0.7918233", "0.78929204", "0.7885636", "0.7870097", "0.7868522", "0.7842337", "0.7828063", "0.78157455", "0.7810207", "0.779348...
0.0
-1
ajax request with JSONP
function ajaxJsonpMethod(dataURL, postData, calBackfun){ $.ajax({ url: dataURL, type: "POST", data: postData, success: function( response ) { calBackfun(response); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getJSONP(url, callback) {\n $.ajax({\n type: 'GET',\n url: url,\n async: false,\n contentType: \"application/json\",\n jsonpCallback: callback,\n dataType: 'jsonp',\n success: function (json) {\n console.dir('success');\n },\n er...
[ "0.78100127", "0.7382843", "0.73711956", "0.7355629", "0.7346219", "0.73253393", "0.730431", "0.72303134", "0.72303134", "0.72303134", "0.72303134", "0.72303134", "0.7204976", "0.7093466", "0.70073867", "0.69812757", "0.6936148", "0.6901024", "0.6886324", "0.6839601", "0.6820...
0.64369947
30
do action after ajaz success
function getCitySuccess(data){ //$('#livekit_loginSliderSubmit').removeClass('livekit_loading_button').attr("disabled", false); if(data){ var cityHtml = '', city = data['cities'], checkedCity = data['checked_city']; if(city.length > 0){ $('.check-all').show(); for(var i=0; i < city.length; i++){ var id = city[i]['id'], cityName = city[i]['city_name'], checked = checkedCity.indexOf(id) != -1 ? 'checked="checked"' : ''; cityHtml += '<li>' + '<input type="checkbox" id="city'+id+'" name="city[]" value="'+id+'" '+checked+' class="checkbox-inline" >' + ' <label for="city'+id+'">'+cityName+'</label>' '</li>'; } $('#city-list').html(cityHtml); }else{ $('.check-all').hide(); $('#city-list').html(''); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function success() {\n finish( false );\n }", "function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t\tnotif(\"success\", \"Brief envoyé avec <strong>succès</strong> !\");\n\t\t}", "function onSuccess (){\n AlertsService.addAlert(\"Your data has been submitted. Showing ...
[ "0.6786505", "0.6675615", "0.6637297", "0.65924627", "0.6578944", "0.65592176", "0.6553638", "0.654651", "0.65406543", "0.6506162", "0.64990145", "0.64885384", "0.64885384", "0.64885384", "0.64885384", "0.64885384", "0.64885384", "0.64885384", "0.64885384", "0.640602", "0.638...
0.0
-1
!negalima rasyti rankomis String (nes duomenys kinta, ir jus nezinote koki duomenys bus po savaites) C) padaryti B) uzdaviniui fja sukeistiMasyvo2elementus(x, y)
function sukeistiMasyvo2elementus(x,y) { var temp = prekiautojai[y]; prekiautojai[y] = prekiautojai[x]; prekiautojai[x] = temp; console.log( "po sukeitimo prekybos centrai:", prekiautojai ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function polybius(input, encode = true) {\n let str = \"\";\n //declare empty string var\n let lowerText = input.toLowerCase();\n //converts input to lowercase\n if (encode === true) {\n for (let i = 0; i < lowerText.length; i++) {\n //looks for letter at set index, using for loop\n ...
[ "0.5799742", "0.5788349", "0.56871444", "0.5673051", "0.56701434", "0.5636505", "0.5573108", "0.5563454", "0.5545916", "0.55439687", "0.5505373", "0.5503146", "0.54601663", "0.54601663", "0.54601663", "0.54601663", "0.54601663", "0.54601663", "0.54601663", "0.54601663", "0.54...
0.5846741
0
Renders to the UI
render() { return ( <div className="row"> <div className="col-1"> <h3> <span className={this.getBadgeClasses()}>{this.formatCount()}</span> </h3> </div> <div className="col"> <button onClick={() => this.props.onIncrement(this.props.counter)} className="btn btn-secondary btn-sm m-2" > Add </button> <button onClick={() => this.props.onDecrement(this.props.counter)} className="btn btn-secondary btn-sm m-2" disabled={this.props.counter.value === 0 ? "disabled" : ""} > Remove </button> <button onClick={() => this.props.onDelete(this.props.counter.id)} className="btn btn-danger btn-sm m-2" > DELETE </button> </div> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n\n\t\t\t}", "function render() {\n\t\t\t}", "function render() {\n\t\t\n\t}", "function render() {\n\n\t\t\tisRendered = true;\n\n\t\t\trenderSource();\n\n\t\t}", "function render() {\n\t}", "function render() {\n\n isRendered = true;\n\n renderSource();\n\n ...
[ "0.818071", "0.80617017", "0.75644314", "0.7562708", "0.7472722", "0.7412446", "0.7325172", "0.7325172", "0.7215621", "0.7215621", "0.7215621", "0.72036195", "0.72036195", "0.72026944", "0.7189762", "0.7138612", "0.70840216", "0.70840216", "0.70840216", "0.70661974", "0.70639...
0.0
-1
Changes color of number of items if 0 or >0
getBadgeClasses() { let classes = "badge m-2 badge-"; classes += this.props.counter.value === 0 ? "warning" : "light"; return classes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCount() {\n const allListItems = document.querySelectorAll('#invitedList li');\n\n for (var i = 0; i < allListItems.length; i++) {\n let increment = 1 - `${i / 10}`;\n // console.log(increment);\n if (increment === 0) {\n // console.log(\"It's white!\");\n } else {\n allListItem...
[ "0.6695028", "0.62659687", "0.6195302", "0.61459124", "0.6134208", "0.5975075", "0.5909598", "0.58381027", "0.58377975", "0.58100176", "0.57797307", "0.57735634", "0.5727784", "0.5727507", "0.5697499", "0.5676207", "0.5662731", "0.5657895", "0.5652338", "0.5642267", "0.564152...
0.0
-1
Checks the value of count in the State
formatCount() { // Nitpicking count out of this.state; destructuring const { value: count } = this.props.counter; return count === 0 ? "0" : count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleCount() {\n this.setState(prevState => ({count: !prevState.count}));\n }", "function verifyCount(count){\n\treturn count == undefined ? 0 : count;\n}", "count(value) {\n let currentState;\n if (this.currentTransactionIndex > -1) {\n currentState = this.applyTransactions();\n } els...
[ "0.67209405", "0.66570336", "0.6616838", "0.6488054", "0.6290172", "0.6283423", "0.62815547", "0.6266116", "0.6259349", "0.6225905", "0.6192087", "0.61580485", "0.6135192", "0.60918295", "0.60424924", "0.60269934", "0.5994202", "0.59522283", "0.5948445", "0.59294415", "0.5925...
0.58060884
27
Week 4 Challenge 2 + week 5 Challenge 1
function searchCity(event) { event.preventDefault(); let inputCity = document.querySelector("#input-search-city"); let showSearchCity = document.querySelector("h1.showCity"); showSearchCity.innerHTML = `What shall we do today <br /> in <span style="color: rgb(69, 147, 173);">${inputCity.value}</span> ?`; let apiKey = "5105e9ba47cefb06b8ba8c75ae83f74e"; let apiUrl = `https://api.openweathermap.org/data/2.5/weather?q=${inputCity.value}&appid=${apiKey}&units=metric`; axios.get(`${apiUrl}`).then(showTemperatureSearch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exercise07() {}", "function challenge3() {\n\n}", "add7s() {\n this.#chords.forEach((chord, i) => {\n if (i < this.#chords.length) {\n if (\n chord.getGrade() == 5 &&\n ((i != this.#chords.length - 1 &&\n this.#chords[i + 1].getGrade() != 1) ||\n ...
[ "0.6160402", "0.59987956", "0.5916987", "0.58679867", "0.58643484", "0.5857755", "0.58319604", "0.582514", "0.5798464", "0.57970166", "0.5793108", "0.57881534", "0.57738495", "0.5744533", "0.57294154", "0.57184285", "0.571464", "0.5692163", "0.5692163", "0.5690051", "0.568693...
0.0
-1
Week 4 Challenge 3 Display a fake temperature (i.e 17) in Celsius and add a link to convert it to Fahrenheit. When clicking on it, it should convert the temperature to Fahrenheit. When clicking on Celsius, it should convert it back to Celsius.
function convertFahrToCels() { buttonTempFahr.removeEventListener("click", convertFahrToCels); buttonTempCels.addEventListener("click", convertCelsToFahr); let tempToday = document.querySelector("#temperature-today"); let tempCels = tempToday.innerText; if (tempToday !== undefined) { tempToday.innerHTML = parseInt(Math.round(tempCels * 1.8 + 32), 0); buttonTempFahr.style.color = "rgb(69, 147, 173)"; buttonTempCels.style.color = "rgb(95, 95, 95)"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertTemperatureUnit(event) {\n event.preventDefault();\n let temperatureElement = document.querySelector(\"#current-temperature\");\n let currentTemperature = temperatureElement.innerHTML;\n currentTemperature = Number(currentTemperature);\n let celciusFahrenheitDisplay = document.querySelector(\n...
[ "0.7682362", "0.76719064", "0.7582004", "0.7546698", "0.751486", "0.7479591", "0.74364305", "0.74194175", "0.73975575", "0.73961926", "0.7382384", "0.73543847", "0.72186726", "0.72116554", "0.71696866", "0.71210134", "0.7116949", "0.7069426", "0.70627695", "0.70239305", "0.70...
0.658197
56
Week 5 Challenge 1 (see week 4 challenge 2) Week 5 Challenge 2
function showCity(event) { function showGeolocation(position) { console.log(position.coords.latitude); let lat = position.coords.latitude; console.log(position.coords.longitude); let lon = position.coords.longitude; let apiKey = "5105e9ba47cefb06b8ba8c75ae83f74e"; let apiUrl = `https://api.openweathermap.org/data/2.5/weather?lat=${lat}&lon=${lon}&appid=${apiKey}&units=metric`; axios.get(`${apiUrl}`).then(showTemperatureGeo); } function showTemperatureGeo(response) { console.log(response.data); let temp = Math.round(response.data.main.temp); let city = response.data.name; let description = response.data.weather[0].description; let windspeed = Math.round(response.data.wind.speed); console.log(response.data.wind.speed); let precipitation = Math.round(response.data.main.humidity); let currentTempGeo = document.querySelector("#temperature-today"); currentTempGeo.innerHTML = temp; let showSearchCity = document.querySelector("h1.showCity"); showSearchCity.innerHTML = `What shall we do today <br /> in <span style="color: rgb(69, 147, 173);">${city}</span> ?`; let currentDescriptionGeo = document.querySelector("#description"); let currentWindSpeed = document.querySelector("#wind"); let currentPrecipitation = document.querySelector("#precipitation"); currentDescriptionGeo.innerHTML = description; currentWindSpeed.innerHTML = `Windspeed: ${windspeed} km/h`; currentPrecipitation.innerHTML = `Precipitation: ${precipitation}%`; } navigator.geolocation.getCurrentPosition(showGeolocation); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exercise07() {}", "function challenge3() {\n\n}", "function challenge2() {\n\n}", "function challenge1() {\n\n}", "function challenge1() {\n\n}", "function secondProblem(){\n\tconsole.log('\\nProblem 2\\nDivisible by 7 and 5 by the same time:');\n\tvar arr = [3, 0, 5, 7, 35, 140],\n\t\tii = 0,\n...
[ "0.62974876", "0.6248002", "0.6243054", "0.6132519", "0.6132519", "0.60811156", "0.6017926", "0.59408796", "0.58326876", "0.5829253", "0.5760313", "0.57598394", "0.57588553", "0.57539237", "0.5728252", "0.5727068", "0.5702551", "0.56988204", "0.5685774", "0.5681128", "0.56710...
0.0
-1
First Two Degit Reading function start here for use in re use in another function like hundred.
function first2degred(number){ var word=first[number]; if(word!=null){ return word; } else if(word==null && number.length<3){ word=second[number[0]]+" "+first[number[1]]; return word; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function base(aReading) {...}", "function ReadB() {\r\n}", "function readNumber(nStr, title) {\n\t\tif (title.includes(\"QTY\")) {\n\t\t\tword = \"\";\n\t\t} else if (title.includes(\"Beef\") || title.includes(\"Wool\")) {\n\t\t\tword = \" KG\";\n\t\t} else if (title.includes(\"Milk\")) {\n\t\t\tword = ' L';\n...
[ "0.6323146", "0.59430164", "0.59207183", "0.56760633", "0.56760633", "0.560416", "0.558644", "0.55754477", "0.55754477", "0.55754477", "0.5528402", "0.55253154", "0.5503493", "0.549542", "0.54798335", "0.54620975", "0.54349494", "0.53973526", "0.5351594", "0.53323066", "0.531...
0.0
-1
First Two Degit Reading function end here This is function to First Two Degit counting after decimal
function first2deg(number){ var stnumber=parseInt(number); var number=stnumber.toString(); var word=first[number]; if(word!=null){ return word+dec(desplace); } else if(word==null && number.length<3){ word=second[number[0]]+" "+first[number[1]]; return word+dec(desplace); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findDec(f1) {\n\t\t\tfunction isInt(n) {\n\t\t\t\treturn typeof n === 'number' &&\n\t\t\t\t\tparseFloat(n) == parseInt(n, 10) && !isNaN(n);\n\t\t\t}\n\t\t\tvar a = Math.abs(f1);\n\t\t\tf1 = a;\n\t\t\tvar count = 1;\n\t\t\twhile (!isInt(f1) && isFinite(f1)) {\n\t\t\t\tf1 = a * Math.pow(10, count++);\n\t\t\...
[ "0.61990905", "0.60833967", "0.6034382", "0.59706306", "0.5932565", "0.5887164", "0.5823285", "0.5762076", "0.57516813", "0.5707994", "0.5670172", "0.566173", "0.5645919", "0.5622926", "0.55787855", "0.55623585", "0.55508703", "0.5514898", "0.5500575", "0.5499308", "0.5498525...
0.0
-1
Hundred End here Thousand Start here
function thousand(number){ if(number.length==4){ subnum=number[1]+number[2]+number[3]; if(number[0]<1){ unit[1]=""; } word= first[number[0]]+" "+unit[1]+" "+hundred(subnum); return word; } else if(number.length==5){ subnum=number[2]+number[3]+number[4]; if (number[0]!='0') { word= first2degred(number[0]+number[1])+" "+unit[1]+" "+hundred(subnum); } else if(number[1]!='0'){ word=first2degred(number[1])+" "+unit[1]+hundred(subnum); } else{ word=hundred(subnum); } return word; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hundreds(n) {\n return suffix(numwords[Math.trunc(n / 100) % 10], numwords[100]);\n}", "function translate_10_Thousands(s){\n\tif(s == \"00000\"){\n\t\treturn \"\";\n\t}\n\tvar firstDigit = s.substring(0,2);\n\tvar remainingDigits = s.substring(2,5);\n\tvar firstDescription = translate_Tens(firstDigit)...
[ "0.6664955", "0.65052086", "0.6491694", "0.6477609", "0.6432025", "0.6404475", "0.6404475", "0.6404475", "0.63926846", "0.63784844", "0.6327462", "0.6279415", "0.6268657", "0.6268657", "0.6268657", "0.6216713", "0.62073386", "0.62015164", "0.61985534", "0.6195992", "0.6195714...
0.68064606
0
Thousand End here Lakh Start here
function lakh(number){ if(number.length==6){ subnum=number[1]+number[2]+number[3]+number[4]+number[5]; if(number[0]<1){ unit[2]=""; } word= first[number[0]]+" "+unit[2]+" "+thousand(subnum); return word; } else if(number.length==7){ subnum=number[2]+number[3]+number[4]+number[5]+number[6]; if (number[0]!='0') { word= first2degred(number[0]+number[1])+" "+unit[2]+" "+thousand(subnum); } else if(number[1]!='0'){ word= first2degred(number[1])+" "+unit[2]+" "+thousand(subnum); } else{ word=thousand(subnum); } return word; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function thousand(number){\n\t\t\t\tif(number.length==4){\n\t\t\t\t\tsubnum=number[1]+number[2]+number[3];\n\t\t\t\t\tif(number[0]<1){\n\t\t\t\t\t\tunit[1]=\"\";\n\t\t\t\t\t}\n\t\t\t\t\tword= first[number[0]]+\" \"+unit[1]+\" \"+hundred(subnum);\n\t\t\t\t\treturn word;\n\t\t\t\t}\n\t\t\t\telse if(number.length==5)...
[ "0.7143883", "0.6937538", "0.6872452", "0.6833334", "0.681074", "0.6686854", "0.66629905", "0.66536635", "0.66490424", "0.66290665", "0.66193604", "0.6592365", "0.6576433", "0.65619147", "0.6514237", "0.6484778", "0.64293146", "0.64202577", "0.6407966", "0.6393441", "0.638465...
0.6793123
5
Lakh End here Crore Start here
function crore(number){ if(number.length==8){ subnum=number[1]+number[2]+number[3]+number[4]+number[5]+number[6]+number[7]; word= first[number[0]]+" "+unit[3]+" "+lakh(subnum); return word; } else if(number.length==9){ subnum=number[2]+number[3]+number[4]+number[5]+number[6]+number[7]+number[8]; word= first2degred(number[0]+number[1])+" "+unit[3]+" "+lakh(subnum); return word; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "start() {// [3]\n }", "private internal function m248() {}", "function comportement (){\n\t }", "protected internal function m252() {}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }...
[ "0.640099", "0.61405724", "0.60216534", "0.5989939", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", "0.5928247", ...
0.0
-1
ON RENDER, CALL THE API AND RECEIVE THE WEATHER OBJECT BACK
componentDidMount() { axios .get( `https://api.openweathermap.org/data/2.5/weather?q=Austin&units=imperial&appid=ea280559dccb736c08acef4ce7ea1175` ) .then((res) => { this.setState({ weather: res.data, //Entire Object temp: Math.floor(res.data.main.temp), //Actual Temp feelsLike: Math.floor(res.data.main.feels_like), //Feels Like Temp mainWeather: res.data.weather[0].main, //Cloudy or Sunny description: res.data.weather[0].description, //Description location: res.data.name, //Place }); this.checkIcon(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n this.eventBusCollector.on(NEWPULLREQUEST.render, this._onRender.bind(this));\n this.eventBus.emit(REPOSITORY.getInfo, {});\n }", "_sendRequest() {\n fetch(this._apiUrl)\n .then((response) => {\n return response.json();\n }).then((json) => {\n this.data = json;\n\n ...
[ "0.6760787", "0.63161564", "0.6082605", "0.60384375", "0.58819216", "0.5859444", "0.5820545", "0.58094114", "0.5805713", "0.5768107", "0.5742438", "0.5742427", "0.5730126", "0.5711184", "0.5701022", "0.5656996", "0.56558543", "0.5641507", "0.55863005", "0.5568503", "0.5562649...
0.0
-1
Obtains a screen capture stream on Firefox.
obtainScreenOnFirefox(options, callback, errorCallback) { let extensionRequired = false; const { desktopSharingFirefoxMaxVersionExtRequired } = this.options; if (desktopSharingFirefoxMaxVersionExtRequired === -1 || (desktopSharingFirefoxMaxVersionExtRequired >= 0 && RTCBrowserType.getFirefoxVersion() <= desktopSharingFirefoxMaxVersionExtRequired)) { extensionRequired = true; logger.log( `Jidesha extension required on firefox version ${ RTCBrowserType.getFirefoxVersion()}`); } if (!extensionRequired || firefoxExtInstalled === true) { obtainWebRTCScreen(options, callback, errorCallback); return; } if (reDetectFirefoxExtension) { reDetectFirefoxExtension = false; initFirefoxExtensionDetection(this.options); } // Give it some (more) time to initialize, and assume lack of // extension if it hasn't. if (firefoxExtInstalled === null) { window.setTimeout( () => { if (firefoxExtInstalled === null) { firefoxExtInstalled = false; } this.obtainScreenOnFirefox(callback, errorCallback); }, 300); logger.log( 'Waiting for detection of jidesha on firefox to finish.'); return; } // We need an extension and it isn't installed. // Make sure we check for the extension when the user clicks again. firefoxExtInstalled = null; reDetectFirefoxExtension = true; // Make sure desktopsharing knows that we failed, so that it doesn't get // stuck in 'switching' mode. errorCallback( new JitsiTrackError(JitsiTrackErrors.FIREFOX_EXTENSION_NEEDED)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStreamAndRecord() {\n navigator.mediaDevices\n .getUserMedia({\n audio: false,\n video: {\n height: { max: 480 },\n },\n })\n .then(function (stream) {\n streamCam = stream;\n unhide(\"contenedor-gif-creado\", \"video\");\n hide(\"msj-2\");\n video.sr...
[ "0.67815155", "0.66036624", "0.65562075", "0.6545868", "0.6507314", "0.64795506", "0.6410394", "0.625477", "0.613503", "0.613503", "0.61259186", "0.6049984", "0.5910201", "0.5909991", "0.59082323", "0.5893733", "0.5877911", "0.58431166", "0.5821785", "0.57970977", "0.57620656...
0.5403048
38
Asks Chrome extension to call chooseDesktopMedia and gets chrome 'desktop' stream for returned stream token.
obtainScreenFromExtension(options, streamCallback, failCallback) { if (chromeExtInstalled) { doGetStreamFromExtension(this.options, streamCallback, failCallback); } else { if (chromeExtUpdateRequired) { /* eslint-disable no-alert */ alert( 'Jitsi Desktop Streamer requires update. ' + 'Changes will take effect after next Chrome restart.'); /* eslint-enable no-alert */ } try { chrome.webstore.install( getWebStoreInstallUrl(this.options), arg => { logger.log('Extension installed successfully', arg); chromeExtInstalled = true; // We need to give a moment to the endpoint to become // available. waitForExtensionAfterInstall(this.options, 200, 10) .then(() => { doGetStreamFromExtension(this.options, streamCallback, failCallback); }) .catch(() => { this.handleExtensionInstallationError(options, streamCallback, failCallback); }); }, this.handleExtensionInstallationError.bind(this, options, streamCallback, failCallback) ); } catch (e) { this.handleExtensionInstallationError(options, streamCallback, failCallback, e); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getMediaStreamId() {\r\n return new Promise(function (resolve, reject) {\r\n var extId = document.getElementById('extension-id').value;\r\n // Send our extension a message, asking for the media source id.\r\n window.chrome.runtime.sendMessage(extId, {\r\n mess...
[ "0.7095652", "0.7095652", "0.63341504", "0.63304454", "0.6289607", "0.6214415", "0.6192859", "0.61693627", "0.6165802", "0.6146747", "0.6142561", "0.6098074", "0.60946375", "0.6068882", "0.60647434", "0.60565513", "0.6054759", "0.59676665", "0.59516925", "0.5944634", "0.59298...
0.5456246
49
Obtains a desktop stream using getUserMedia. For this to work on Chrome, the 'chrome://flags/enableusermediascreencapture' flag must be enabled. On firefox, the document's domain must be whitelisted in the 'media.getusermedia.screensharing.allowed_domains' preference in 'about:config'.
function obtainWebRTCScreen(options, streamCallback, failCallback) { gumFunction([ 'screen' ], streamCallback, failCallback); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStream() {\n if (mediaStream) {\n mediaStream.getTracks().forEach(track => {\n track.stop();\n });\n }\n var videoSource = videoSelect.value;\n constraints = {\n video: {deviceId: videoSource ? {exact: videoSource} : undefined}\n };\n navigator.mediaDevices.getUserMedia(constraints)...
[ "0.72624755", "0.7191022", "0.7151608", "0.69978327", "0.695838", "0.6859495", "0.6857136", "0.68544483", "0.6829308", "0.67021847", "0.666586", "0.66385734", "0.6611017", "0.6596998", "0.64890933", "0.6477117", "0.64527345", "0.6432623", "0.64214694", "0.64091057", "0.640011...
0.59114885
67
Initializes with extension id set in config.js to support inline installs. Host site must be selected as main website of published extension.
function initInlineInstalls(options) { if ($('link[rel=chrome-webstore-item]').length === 0) { $('head').append('<link rel="chrome-webstore-item">'); } $('link[rel=chrome-webstore-item]').attr('href', getWebStoreInstallUrl(options)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initInlineInstalls()\n{\n $(\"link[rel=chrome-webstore-item]\").attr(\"href\", getWebStoreInstallUrl());\n}", "function initInlineInstalls()\n{\n $(\"link[rel=chrome-webstore-item]\").attr(\"href\", getWebStoreInstallUrl());\n}", "function initInlineInstalls(options) {\n if ($('link[rel=chrome-...
[ "0.6861621", "0.6861621", "0.6711045", "0.5589304", "0.5584974", "0.5546517", "0.54924965", "0.5491892", "0.54796994", "0.53814965", "0.53697634", "0.5364858", "0.534253", "0.5304334", "0.53006047", "0.5154623", "0.5138432", "0.51378155", "0.51327235", "0.50935227", "0.509139...
0.6735342
2
Starts the detection of an installed jidesha extension for firefox.
function initFirefoxExtensionDetection(options) { if (options.desktopSharingFirefoxDisabled) { return; } if (firefoxExtInstalled === false || firefoxExtInstalled === true) { return; } if (!options.desktopSharingFirefoxExtId) { firefoxExtInstalled = false; return; } const img = document.createElement('img'); img.onload = () => { logger.log('Detected firefox screen sharing extension.'); firefoxExtInstalled = true; }; img.onerror = () => { logger.log('Detected lack of firefox screen sharing extension.'); firefoxExtInstalled = false; }; // The jidesha extension exposes an empty image file under the url: // "chrome://EXT_ID/content/DOMAIN.png" // Where EXT_ID is the ID of the extension with "@" replaced by ".", and // DOMAIN is a domain whitelisted by the extension. const src = `chrome://${options.desktopSharingFirefoxExtId.replace('@', '.') }/content/${document.location.hostname}.png`; img.setAttribute('src', src); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "obtainScreenOnFirefox(options, callback, errorCallback) {\n let extensionRequired = false;\n const { desktopSharingFirefoxMaxVersionExtRequired } = this.options;\n\n if (desktopSharingFirefoxMaxVersionExtRequired === -1\n || (desktopSharingFirefoxMaxVersionExtRequired >= 0\n ...
[ "0.66458493", "0.5801851", "0.5726003", "0.5720645", "0.56715906", "0.5671586", "0.5470042", "0.5418751", "0.5395399", "0.5320078", "0.5295512", "0.5276542", "0.5246019", "0.51944506", "0.5175635", "0.5159817", "0.5108108", "0.50944376", "0.50867254", "0.5057055", "0.5022027"...
0.7235556
0
Color Mapping for the LED // Orange dont work really well :(
function get_color_to_shape(shape) { //return [155,155,155]; // Alles eine Farbe switch(shape) { case 'IShape': return [0,0,255]; case 'ZShape': return [255,0,0]; case 'LShape': return [0,255,0]; case 'TShape': return [255,255,0]; case 'OShape': return [255,0,255]; case 'SShape': return [0,255,255]; case 'JShape': return [255,255,255]; default: return [155,155,155]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function color() {\n var map = {\n \"black\" : [ 0/255,0/255,0/255 ],\n \"silver\": [ 192/255,192/255,192/255 ],\n \"gray\" : [ 128/255,128/255,128/255 ],\n \"white\" : [ 255/255,255/255,255/255 ],\n \"maroon\": [ 128/255,0/255,0/255 ],\n \"red\" : [ 255/255,0/255,0/255 ],\n \"purple\": [ 128/25...
[ "0.748607", "0.6966495", "0.69039375", "0.6795369", "0.67942774", "0.6786904", "0.670493", "0.6666723", "0.66491383", "0.6642057", "0.66371864", "0.66356605", "0.65595275", "0.6536727", "0.65064794", "0.64864993", "0.64708376", "0.64694923", "0.64651036", "0.6450719", "0.6449...
0.0
-1
Mapping your LED Matrix to x and y of the GameField
function matrix_mapping(x, y) { let matrix_array = [ [0,47,48,95,96,143,144,191,192,239,240,287,288,335,336,383], [1,46,49,94,97,142,145,190,193,238,241,286,289,334,337,382], [2,45,50,93,98,141,146,189,194,237,242,285,290,333,338,381], [3,44,51,92,99,140,147,188,195,236,243,284,291,332,339,380], [4,43,52,91,100,139,148,187,196,235,244,283,292,331,340,379], [5,42,53,90,101,138,149,186,197,234,245,282,293,330,341,378], [6,41,54,89,102,137,150,185,198,233,246,281,294,329,342,377], [7,40,55,88,103,136,151,184,199,232,247,280,295,328,343,376], [8,39,56,87,104,135,152,183,200,231,248,279,296,327,344,375], [9,38,57,86,105,134,153,182,201,230,249,278,297,326,345,374], [10,37,58,85,106,133,154,181,202,229,250,277,298,325,346,373], [11,36,59,84,107,132,155,180,203,228,251,276,299,324,347,372], [12,35,60,83,108,131,156,179,204,227,252,275,300,323,348,371], [13,34,61,82,109,130,157,178,205,226,253,274,301,322,349,370], [14,33,62,81,110,129,158,177,206,225,254,273,302,321,350,369], [15,32,63,80,111,128,159,176,207,224,255,272,303,320,351,368], [16,31,64,79,112,127,160,175,208,223,256,271,304,319,352,367], [17,30,65,78,113,126,161,174,209,222,257,270,305,318,353,366], [18,29,66,77,114,125,162,173,210,221,258,269,306,317,354,365], [19,28,67,76,115,124,163,172,211,220,259,268,307,316,355,364], [20,27,68,75,116,123,164,171,212,219,260,267,308,315,356,363], [21,26,69,74,117,122,165,170,213,218,261,266,309,314,357,362], [22,25,70,73,118,121,166,169,214,217,262,265,310,313,358,361], [23,24,71,72,119,120,167,168,215,216,263,264,311,312,359,360], ]; return matrix_array[x][y]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup (){\n \n pjCol = 0; //pixeles\n pjFill = 0; // pixeles\n xPos = (pjCol * 40)+ 20;\n xPos = (pjFill * 40)+ 20;\n\n\n// Crear arreglo de arreglos\nfor (let index = 0; index < 20; index ++){\n\n mapa.push (new Array(20));\n}\n\n//Asignar valores iniciales\nfor (let fill = 0; fill < 20; ...
[ "0.6522832", "0.6443878", "0.642811", "0.6314295", "0.5995517", "0.5928719", "0.58712965", "0.58605963", "0.5856156", "0.58514524", "0.5846865", "0.5830806", "0.58272237", "0.57949257", "0.5750385", "0.57411665", "0.5736003", "0.57350487", "0.57316166", "0.57276934", "0.57155...
0.5862194
7
Display phrase on game board
addPhraseToDisplay() { // Get phrase and split into letters const letters = this.phrase.split(''); const ul = document.querySelector('ul'); // Create li's and classes and append to the ul letters.forEach(letter => { const li = document.createElement('li'); const item = document.createTextNode(`${letter}`); letter === ' ' ? (li.className = 'space') : (li.className = `hide letter ${letter}`); li.appendChild(item); ul.appendChild(li); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addPhraseToDisplay(){\r\n this.setupLetterToBeDisplayed()\r\n }", "function drawboard(location, word) {\n for (var i = 0; i < word.length; i++) {\n context.fillText('_ ', (location[0] + i * 20), location[1]);\n }\n }", "function updateDisplay(wordArray, midGame) {\n // let wordJoin = w...
[ "0.6981293", "0.68137807", "0.6756588", "0.67542446", "0.6753623", "0.6713736", "0.66985744", "0.6696087", "0.6693561", "0.66635555", "0.66626745", "0.6653121", "0.6652581", "0.6650467", "0.6604783", "0.66047335", "0.6598791", "0.6593423", "0.6571629", "0.65659535", "0.656294...
0.0
-1
Checks if passed letter is in phrase
checkLetter(letter) { // return true/false if passed letter, matches letter in phrase return this.phrase.includes(letter) ? true : false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkLetter(letter) {\r\n const phrase = this.phrase;\r\n if (phrase.includes(letter)) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "checkLetter(letter) {\n if ( this.phrase.includes(letter) ) {\n return true;\n }\n else {\n return false;\n }\n }",...
[ "0.8606026", "0.85749185", "0.8574114", "0.85663104", "0.85546774", "0.8545489", "0.8524654", "0.85224515", "0.85179263", "0.8490222", "0.84855735", "0.84512967", "0.8447152", "0.8431481", "0.8407957", "0.8394505", "0.83786356", "0.83510435", "0.8344266", "0.8333581", "0.8329...
0.8566972
3
Displays passed letter on screen after a match is found
showMatchedLetter(letter) { const listItem = document.querySelectorAll('.letter'); // Add 'show' class if passed letter mathces for (let li of listItem) { if (li.innerText === letter) { li.classList.remove('hide'); li.classList.add('show'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showMatchedLetter(letter){\r\n $(letter).addClass('show');\r\n // display the char of the corresponding letters check if game is won\r\n }", "function match(a,b) {\n\t//if the letter input matches the current string\n\tif(a==b){\n\t\t\n\t\tfinalDisplay(i,guess);\n\t\tmatched++;\t\n\t}\n\n\n\t\n}", "sh...
[ "0.7764646", "0.74672186", "0.7379272", "0.7344734", "0.72903204", "0.72504205", "0.7221005", "0.7158286", "0.71428436", "0.71275896", "0.7125284", "0.71249104", "0.70639473", "0.70473737", "0.70316774", "0.6985066", "0.69456464", "0.69390154", "0.69269377", "0.69063437", "0....
0.66168916
35
creates a rando between 16 for the dice
function randDiceNum() { return Math.floor(Math.random() * 6 + 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rollD12(){\r\n return getRandomInteger(1, 12);\r\n}", "function rollD8(){\r\n return getRandomInteger(1, 8);\r\n}", "rollDice() {\n\t\t//Leverages the pattern: Math.floor(Math.random() * (max - min + 1)) + min\n\t\t// Math.floor(Math.random() * (8 - 0 + 1)) + 0\n\t\t// ...
[ "0.70351946", "0.69659567", "0.695725", "0.6865322", "0.6730272", "0.66519016", "0.66172165", "0.6585288", "0.6561002", "0.6528893", "0.65158755", "0.6514489", "0.6495206", "0.6491385", "0.64833474", "0.6478605", "0.6477713", "0.6466884", "0.646057", "0.6444038", "0.644164", ...
0.64249307
23
Events emitted by ConnectionRdy
static get READY() { return 'ready' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ConnectEvents() {\n\n }", "connected() {\n event();\n }", "_connectEvents () {\n this._socket.on('sensorChanged', this._onSensorChanged);\n this._socket.on('deviceWasClosed', this._onDisconnect);\n this._socket.on('disconnect', this._onDisconnect);\n }", "DisconnectEvents() {\n...
[ "0.70716494", "0.6738824", "0.66929865", "0.66203123", "0.65791166", "0.65321565", "0.65321565", "0.6475732", "0.64491427", "0.63642544", "0.6353212", "0.63204837", "0.6317256", "0.6312055", "0.6291629", "0.62761265", "0.62649196", "0.6236555", "0.62226963", "0.6215708", "0.6...
0.0
-1
Close the reader ready connection.
close() { this.conn.close() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async close(){\n return this.reader.close()\n }", "close() {\n\t\tthis.connection.close();\n\t}", "function abortRead() {\n reader.abort();\n }", "disconnect() {\n _try(() => this._rawConn && this._rawConn.close());\n }", "_close() {\n debug(\"disconnect\");\n this.skipReconnect...
[ "0.700388", "0.68583", "0.6370534", "0.62453747", "0.62434", "0.62236106", "0.62088543", "0.6186545", "0.61816573", "0.6143774", "0.6114675", "0.609861", "0.60586524", "0.6058557", "0.604581", "0.60025346", "0.598068", "0.59150225", "0.59150225", "0.58962125", "0.5854064", ...
0.6266569
3
Raises a `BUMP` event.
bump() { this.statemachine.raise('bump') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bidItem() { }", "remoteBombsGoodieIsOver(man) {\n\t\tif (man !== undefined) {\n\t\t\twinston.info(\"[player] %s has longer remote bombs\", man.getName()); //.getName()\n\t\t\tman.disableRemoteBomb();\n\t\t\tthis.commit();\n\t\t}\n\t}", "coolDownBomb(bomb, anim) {\n\t\tbomb.setAnim(anim);\n\t\tthis.com...
[ "0.54550296", "0.53164613", "0.52745277", "0.5257847", "0.51479995", "0.5087698", "0.50649005", "0.5024813", "0.5000907", "0.49920905", "0.49425754", "0.4931459", "0.4921353", "0.48989692", "0.48989484", "0.48949733", "0.48797297", "0.48382458", "0.48297003", "0.48209962", "0...
0.4780253
21
Raises a `BACKOFF` event.
backoff() { this.statemachine.raise('backoff') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Backoff(backoffStrategy) {\n events.EventEmitter.call(this);\n\n this.backoffStrategy_ = backoffStrategy;\n this.maxNumberOfRetry_ = -1;\n this.backoffNumber_ = 0;\n this.backoffDelay_ = 0;\n this.timeoutID_ = -1;\n\n this.handlers = {\n backoff: this.onBackoff_.bind(this)\n ...
[ "0.59052634", "0.5877253", "0.5782598", "0.5679323", "0.5667366", "0.5667366", "0.566339", "0.5594275", "0.5580331", "0.54861444", "0.5482677", "0.5476108", "0.54050153", "0.53890836", "0.53839636", "0.5381004", "0.53747195", "0.5363433", "0.5290873", "0.5290873", "0.52605313...
0.50749946
35
RDY is implicitly zero
bump() { if (this.connRdy.maxConnRdy > 0) { return this.goto('MAX') } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_status() {\n var current_status = ipin.rawRead();\n if (at_least_once && current_status === last_status) {\n return;\n }\n at_least_once = true;\n if (current_status) {\n sensor_error_code_set_to_good();\n } else {\n sensor_error_code_set_to_bad();\n }\n ...
[ "0.62787807", "0.6171555", "0.6154578", "0.5929394", "0.57372856", "0.57213026", "0.5651239", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", "0.56486446", ...
0.0
-1
Raise a `PAUSE` event.
pause() { this.raise('pause') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pause () {}", "pause () {}", "pause () {}", "function playPause() {\n\t\tDBR.act('pause');\n\t\tsyncState();\n\t}", "pause() { this.setPaused(true); }", "pause() {\n this._isPaused = true;\n }", "pause() {\n this._isPaused = true;\n }", "pause() { this._pause$.next(true); }", "p...
[ "0.72082967", "0.72082967", "0.72082967", "0.70599514", "0.68976575", "0.6888063", "0.6888063", "0.6858433", "0.6823593", "0.67910224", "0.6738278", "0.66862077", "0.6668327", "0.66425496", "0.66425496", "0.66381097", "0.66081506", "0.65953135", "0.6522181", "0.6511195", "0.6...
0.7037411
4
Raise a `UNPAUSE` event.
unpause() { this.raise('unpause') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unpause() {\n _isGamePaused = false;\n\n Frogger.observer.publish(\"game-unpaused\");\n }", "unpause(event) {\n if(this.level.game.paused){\n this.pauseText.destroy();\n this.level.game.paused = false;\n }\n }", "function onUnPauseMessage(message...
[ "0.7083213", "0.69758695", "0.6847897", "0.6433532", "0.62603873", "0.6212751", "0.6161923", "0.61618745", "0.6150715", "0.6079088", "0.60599035", "0.60599035", "0.60572964", "0.6053612", "0.60211974", "0.60069644", "0.59835565", "0.59620225", "0.59620225", "0.59620225", "0.5...
0.7612413
0
Try to balance the connection pool.
try() { this.balance() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "balance() {\n this.log('balance')\n\n if (this.balanceId != null) {\n clearTimeout(this.balanceId)\n this.balanceId = null\n }\n\n const max = this.maxConnectionsRdy()\n const perConnectionMax = Math.floor(max / this.connections.length)\n\n // Low RDY and try conditions\n if (perConn...
[ "0.6969536", "0.5950432", "0.5836974", "0.5695436", "0.55949473", "0.5579118", "0.5579118", "0.5579118", "0.55620474", "0.55560315", "0.5545283", "0.551292", "0.54997754", "0.53749615", "0.53345025", "0.5325228", "0.5322432", "0.529389", "0.5291631", "0.52906936", "0.52811253...
0.61555153
1
Raise a `BACKOFF` event for each connection in the pool.
backoff() { this.connections.forEach((conn) => conn.backoff()) if (this.backoffId) { clearTimeout(this.backoffId) } const onTimeout = () => { this.log('Backoff done') this.raise('try') } const delay = this.backoffTimer.getInterval() * 1000 this.backoffId = setTimeout(onTimeout, delay) this.log(`Backoff for ${delay}`) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "disconnectAll() {\n this._cb = [];\n }", "shutdown () {\r\n for (let ix = 0; ix < this._sockets.length; ix++) {\r\n this.close(this._sockets[ix]);\r\n }\r\n this._sockets.length = 0;\r\n }", "function endConnections(){\n \n if(pool == undefined){\n log4js.shutdown(function(...
[ "0.5652964", "0.5559022", "0.5554058", "0.55289865", "0.5509813", "0.5446695", "0.5427656", "0.5348583", "0.52888465", "0.5280937", "0.5280937", "0.5264728", "0.52252614", "0.5195119", "0.51551", "0.51507074", "0.51049894", "0.50926554", "0.508717", "0.5034399", "0.5011613", ...
0.5995764
0
Evenly or fairly distributes RDY count based on the maxInFlight across all nsqd connections. In the perverse situation where there are more connections than max in flight, we do the following: There is a sliding window where each of the connections gets a RDY count of 1. When the connection has processed it's single message, then the RDY count is distributed to the next waiting connection. If the connection does nothing with it's RDY count, then it should timeout and give it's RDY count to another connection.
balance() { this.log('balance') if (this.balanceId != null) { clearTimeout(this.balanceId) this.balanceId = null } const max = this.maxConnectionsRdy() const perConnectionMax = Math.floor(max / this.connections.length) // Low RDY and try conditions if (perConnectionMax === 0) { /** * Backoff on all connections. In-flight messages from * connections will still be processed. */ this.connections.forEach((conn) => conn.backoff()) // Distribute available RDY count to the connections next in line. this.roundRobinConnections.next(max - this.inFlight()).forEach((conn) => { conn.setConnectionRdyMax(1) conn.bump() }) // Rebalance periodically. Needed when no messages are received. this.balanceId = setTimeout(() => { this.balance() }, this.lowRdyTimeout) } else { let rdyRemainder = this.maxInFlight % this.connections.length this.connections.forEach((c) => { let connMax = perConnectionMax /** * Distribute the remainder RDY count evenly between the first * n connections. */ if (rdyRemainder > 0) { connMax += 1 rdyRemainder -= 1 } c.setConnectionRdyMax(connMax) c.bump() }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Process_Recvq() {\n\tif (this.queue.length == 0)\n\t\treturn 1;\n\tvar timediff = system.timer - this.time_marker;\n\tif (timediff >= 2) {\n\t\tthis.num_sent = 0;\n\t\tthis.time_marker = system.timer;\n\t}\n\tif (this.throttled) {\n\t\tif (timediff < 2)\n\t\t\treturn 1;\n\t} else if ((timediff <= 2) && (t...
[ "0.54180413", "0.5065564", "0.49424988", "0.49355954", "0.48786232", "0.48441264", "0.48406348", "0.48247167", "0.48208782", "0.4699175", "0.46955812", "0.46841297", "0.46233377", "0.46168736", "0.46140403", "0.46026728", "0.4602224", "0.4602224", "0.4602224", "0.4602224", "0...
0.54735196
0
Reset the turn to white at the start of the game.
resetTurn() { this.turn = 'W'; this.turnStatus.text('White:'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetBoard() {\n\t\tfor (var i = $boxes.length -1; i>= 0; i--) {\n\t\t\tvar $box = $($boxes[i]);\n\t\t\t$box.attr('class', 'clear');\n\t\t}\n\t\tredMoves = [];\n\t\tyellowMoves = [];\n\t\twinCounter = 0;\n\t\tcounter = 0;\n\t\tconsole.log('resetBoard')\n\t\taddRedandYellowListeners()\n\t\t$turnText.html(\...
[ "0.7272398", "0.71222526", "0.7098399", "0.6982966", "0.6944545", "0.6919833", "0.68915683", "0.68894285", "0.68893504", "0.68891656", "0.68785", "0.68739945", "0.6840336", "0.6808525", "0.68045896", "0.6758713", "0.6740524", "0.67268986", "0.67167264", "0.6693107", "0.668839...
0.7933768
0