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
Get the data to sort a column, be it from cache, fresh (populating the cache), or from a sort formatter
function _fnSortData( settings, idx ) { // Custom sorting function - provided by the sort data type var column = settings.aoColumns[ idx ]; var customSort = DataTable.ext.order[ column.sSortDataType ]; var customData; if ( customSort ) { customData = customSort.call( settings.oInstance, settings, idx, _fnColumnIndexToVisible( settings, idx ) ); } // Use / populate cache var row, cellData; var formatter = DataTable.ext.type.order[ column.sType+"-pre" ]; for ( var i=0, ien=settings.aoData.length ; i<ien ; i++ ) { row = settings.aoData[i]; if ( ! row._aSortData ) { row._aSortData = []; } if ( ! row._aSortData[idx] || customSort ) { cellData = customSort ? customData[i] : // If there was a custom sort function, use data from there _fnGetCellData( settings, i, idx, 'sort' ); row._aSortData[ idx ] = formatter ? formatter( cellData ) : cellData; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortData(data){\n\t\tif(!this.dtInstance)\n\t\t\treturn;\n\n\t\tlet _self = this;\n\t\tlet order = this.dtInstance.order()[0];\n\t\tlet col = order[0], dir = order[1];\n\t\tif(this.sortFns[col]) {\n\t\t\tlet sortFn = this.sortFns[col];\n\t\t\tdata.sort(function(a, b){\n\t\t\t\tlet aa = sortFn(a, col),\n\t\t\t\t\tb...
[ "0.6612077", "0.6608879", "0.6597488", "0.65754896", "0.6540087", "0.6362088", "0.6357926", "0.6190046", "0.6060214", "0.602903", "0.60141516", "0.59987026", "0.5989574", "0.5949557", "0.5909242", "0.59074813", "0.5894499", "0.586217", "0.585533", "0.5827628", "0.5812802", ...
0.5881683
40
Add the numeric 'deformatting' functions for sorting and search. This is done in a function to provide an easy ability for the language options to add additional methods if a nonperiod decimal place is used.
function _addNumericSort ( decimalPlace ) { $.each( { // Plain numbers "num": function ( d ) { return __numericReplace( d, decimalPlace ); }, // Formatted numbers "num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_formatted_numeric ); }, // HTML numeric "html-num": function ( d ) { return __numericReplace( d, decimalPlace, _re_html ); }, // HTML numeric, formatted "html-num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric ); } }, function ( key, fn ) { // Add the ordering method _ext.type.order[ key+decimalPlace+'-pre' ] = fn; // For HTML types add a search formatter that will strip the HTML if ( key.match(/^html\-/) ) { _ext.type.search[ key+decimalPlace ] = _ext.type.search.html; } } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _addNumericSort(decimalPlace) {\n $.each({\n // Plain numbers\n \"num\": function num(d) {\n return __numericReplace(d, decimalPlace);\n },\n // Formatted numbers\n \"num-fmt\": function numFmt(d) {\n return __numericReplace(d, decimalPlace, _re_formatted_numeric)...
[ "0.7087367", "0.6952541", "0.6926567", "0.6911924", "0.68812186", "0.6868262", "0.68661755", "0.68661755", "0.6842611", "0.6830817", "0.6681834", "0.62890834", "0.6124902", "0.6105793", "0.607449", "0.603935", "0.5957413", "0.5957413", "0.59185886", "0.59127337", "0.5787289",...
0.68334436
29
Close search overlay when clicking outside of it
function lkyph_force_close_search_overlay() { jQuery("#search-overlay").bind("click", function(e) { if (jQuery(e.target).parents("#search-overlay .search-form").length <= 0) { jQuery("#search-overlay").removeClass("in"); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeSearch() {\n document.getElementById(\"myOverlay\").style.display = \"none\";\n \n }", "function closeSearch() {\n document.getElementById(\"myOverlay\").style.display = \"none\";\n}", "function closeSearch() {\n document.getElementById(\"myOverlay\").style.display = \"none\";\n}", "cl...
[ "0.792006", "0.780308", "0.780308", "0.76376194", "0.7356014", "0.7313525", "0.72840995", "0.7283736", "0.727552", "0.7190886", "0.7170211", "0.7170211", "0.7157167", "0.71364343", "0.71121436", "0.70965093", "0.7051281", "0.70388275", "0.69828016", "0.69708264", "0.6970462",...
0.8670112
0
Toggle images based on which article title has hover
function lkyph_sink_hover() { jQuery(".sink-related a[data-img]").on("mouseover", function(e) { try { var t = jQuery(this); t.parents(".sink-related").find(".previews img").removeClass("on"); t.parents(".sink-related").find(".previews img[id=img_"+t.attr('data-img')+"]").addClass("on"); } catch (e) { } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "'mouseover .cb-img-title'( e, t ) { //hover\n $( '.cb-img-title' ).prop( 'src', '/img/title-dark.png' );\n }", "function ImageHover() {\n if ($(\".portfolio_item\").length) {\n imagesLoaded(document.querySelectorAll(\"img\"), () => {\n document.body.classList.remove(\"loading\");\n });\n\...
[ "0.65080386", "0.6268045", "0.6232176", "0.61621666", "0.6069447", "0.6028646", "0.5965509", "0.58679307", "0.58589834", "0.58533645", "0.5788459", "0.5772271", "0.57667917", "0.5760278", "0.5718", "0.5715055", "0.5713421", "0.56938905", "0.567412", "0.56699926", "0.56492764"...
0.58937037
7
CONTRACTS SHOW ALL CONTRACTS
function ContractsCtrl($scope,$http){ var s = $scope; $http({method: 'GET', url: '/contracts'}). success(function(data, status, headers, config) { s.contracts = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contract_list(request, response, next) {\n console.log('List of contracts');\n}", "getActiveContracts() {\n return model.activeContracts;\n }", "function showContract() {\n console.log(miniERC20);\n /*\n {\n constructor: [Function: bound call],\n abi: ContractABICoder { * },\n address...
[ "0.6638482", "0.5875666", "0.57943416", "0.5766318", "0.5760595", "0.5616281", "0.54651964", "0.54017013", "0.5381646", "0.53738815", "0.5366702", "0.53329843", "0.53316987", "0.5294888", "0.5284352", "0.5265635", "0.5251014", "0.52399147", "0.51875174", "0.5186027", "0.51600...
0.5113295
22
SHOW CONTRACT BY ID
function ShowContractCtrl($scope,$http,$routeParams) { var s = $scope , params = $routeParams ; $http({method: 'GET', url: '/contracts/'+params.id}). success(function(data, status, headers, config) { s.contract = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getOrdercontract(req, res) {\n contract.find({companyId: req.body.companyId, deleted: false}, function(err, contractlist) {\n if (err) {\n res.json({code: Constant.ERROR_CODE, message: err});\n } else {\n res.json({code: Constant.SUCCESS_CODE, data: contractlist});\n...
[ "0.5951854", "0.5799741", "0.55334544", "0.55069155", "0.5311077", "0.5283127", "0.52422345", "0.5239145", "0.520663", "0.52035266", "0.5174987", "0.5159954", "0.51598006", "0.50870645", "0.50153005", "0.50078297", "0.5007564", "0.50019443", "0.4989968", "0.49883172", "0.4984...
0.535365
4
CREATE NEW CONTRACTS CONTROLLER
function NewContractCtrl($scope,$http) { var s = $scope; s.contract = { name: "", contractor: "", type: "", fulfilled: false, fulfillment_date: null, created_at: null, updated_at: null, assigned_personnel:[], required_personnel: [ { type: "", needed: 0, call_list: [] } ] }; $http({method: 'GET', url: '/employees'}). success(function(data, status, headers, config) { s.employees = data; }). error(function(data, status, headers, config) { s.error = data; }); s.addToCallList = function(employee){ var call = { id: employee._id, first_name: employee.first_name, last_name: employee.last_name, phone_1: { number: employee.phone_number, twilioSID:null, status: "not dialed" }, phone_2: { number: employee.phone_number_2, twilioSID:null, status: "not dialed" }, phone_3: { number: employee.phone_number3, twilioSID:null, status: "not dialed" }, answered: false, reply: null, assigned: false }; s.contract.required_personnel[0].call_list.push(call); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function contract_create(request, response, next) {\n console.log('Contract create');\n}", "async instantiate(ctx){\n console.log('************ Pharnet Transporter Smart Contract Instantiated *************');\n\t}", "async instantiate(ctx) {\n console.log(\"Smart Contract Instantiated\");\n }", "asy...
[ "0.74912816", "0.65463966", "0.64814305", "0.6457836", "0.6271645", "0.6239784", "0.60235775", "0.5915362", "0.5878751", "0.58506095", "0.5823854", "0.5813976", "0.57682574", "0.5754584", "0.57300663", "0.56870866", "0.5675576", "0.56577295", "0.5653332", "0.5645975", "0.5643...
0.5822988
11
EMPLOYEES SHOW ALL EMPLOYEES
function EmployeesCtrl($scope,$http){ var s = $scope; $http({method: 'GET', url: '/employees'}). success(function(data, status, headers, config) { s.employees = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayAllEmployees() {\n return connection.query(viewCommand);\n}", "function displayAllEmployees() {\n let query = \"SELECT * FROM employee \";\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n console.log(\"\\n\\n ** Full Employee list ** \\n\");\n cons...
[ "0.76515025", "0.7456006", "0.7455306", "0.73442817", "0.733155", "0.73010856", "0.7269586", "0.72297674", "0.7217577", "0.72033614", "0.7166205", "0.7121153", "0.70962876", "0.7065796", "0.7053517", "0.7049046", "0.7039714", "0.6993498", "0.6992957", "0.69681007", "0.6956624...
0.0
-1
SHOW Employee BY ID
function ShowEmployeeCtrl($scope,$http,$routeParams) { var s = $scope , params = $routeParams ; $http({method: 'GET', url: '/employees/'+params.id}). success(function(data, status, headers, config) { s.employee = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewEmployees() {\n const query = 'SELECT employee.id, employee.first_name, employee.last_name, roletable.title, department.name AS department, roletable.salary, CONCAT(manager.first_name, \" \", manager.last_name) AS manager FROM employee LEFT JOIN roletable on employee.role_id = roletable.id LEFT JOI...
[ "0.6787925", "0.6746582", "0.6720655", "0.6692374", "0.6677266", "0.66557974", "0.6650413", "0.6630425", "0.6623709", "0.6620952", "0.6589124", "0.656609", "0.65624785", "0.65478474", "0.6545987", "0.6534162", "0.65161836", "0.65020686", "0.6474432", "0.6437839", "0.64228994"...
0.0
-1
CALLS SHOW ALL CALLS
function CallsCtrl($scope,$http){ var s = $scope; $http({method: 'GET', url: '/calls'}). success(function(data, status, headers, config) { s.calls = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cmdCallHistory(res) {\n if (res.result) { printHistory(res.error.data.chat) }\n }", "function GlobalCallInfo ()\n{\n this.top_down_view = call_info.CallInfo ();\n\n\n this.process_call_stack = function (call_list_obj)\n {\n var clo = call_list_obj;\n\n for (var key in clo)\n {\n ...
[ "0.6177262", "0.6077406", "0.59542114", "0.5703063", "0.5637735", "0.555728", "0.55559075", "0.54803675", "0.54351485", "0.5403171", "0.5346403", "0.5307007", "0.5296814", "0.52895284", "0.5280417", "0.52705747", "0.5226257", "0.52069706", "0.5184586", "0.5181329", "0.5181329...
0.0
-1
SHOW CALL BY ID
function ShowCallCtrl($scope,$http,$routeParams) { var s = $scope , params = $routeParams ; $http({method: 'GET', url: '/calls/'+params.id}). success(function(data, status, headers, config) { s.call = data; }). error(function(data, status, headers, config) { s.error = data; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCall(id) {\n return $http.get(baseUrl+\"call/\"+id,{headers:setHeaders()});\n }", "getCallById(id, callback) {\r\n if (!id) {\r\n if (callback) {\r\n callback('No call ID passed', null);\r\n }\r\n }\r\n var call = new Call();...
[ "0.64963245", "0.58687425", "0.5795486", "0.5604448", "0.5488662", "0.5484497", "0.54704523", "0.5383033", "0.53621906", "0.5346662", "0.53099483", "0.5261927", "0.51834506", "0.5144465", "0.51293075", "0.50610304", "0.49913478", "0.49658456", "0.49598822", "0.4955824", "0.49...
0.50859386
15
Show next question and clickable options
function nextQuestion(nextQuestionId) { question.innerHTML = questions[nextQuestionId].question; main.innerHTML = ""; var answer1 = document.createElement("a"); answer1.textContent = questions[nextQuestionId].a; main.appendChild(answer1); var answer2 = document.createElement("a"); answer2.textContent = questions[nextQuestionId].b; main.appendChild(answer2); var answer3 = document.createElement("a"); answer3.textContent = questions[nextQuestionId].c; main.appendChild(answer3); var answer4 = document.createElement("a"); answer4.textContent = questions[nextQuestionId].d; main.appendChild(answer4); window.nextQuestionId++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayNext() {\n quiz.fadeOut(function() {\n $('#question').remove();\n\n if (questionCounter < questions.length) {\n var nextQuestion = createQuestionElement(questionCounter);\n quiz.append(nextQuestion).fadeIn();\n if (!(isNaN(se...
[ "0.80069107", "0.79928535", "0.7986917", "0.7940285", "0.7925222", "0.7916414", "0.7895156", "0.78607315", "0.7824222", "0.77918357", "0.77753687", "0.7773189", "0.7769685", "0.77564955", "0.77293867", "0.77262354", "0.7716734", "0.7713659", "0.77113193", "0.7708575", "0.7694...
0.0
-1
Sorts the highscore and shows it in li tags
function highScore() { storedScore.sort(); storedScore.reverse(); for (var i = 0; i < storedScore.length; i++) { var highScore = storedScore[i]; var li = document.createElement("li"); li.textContent = highScore; scoreList.appendChild(li); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderHighScore() {\n let highScores = JSON.parse(localStorage.getItem(\"high-scores\"));\n\n //this will sort the scores in numerical order\n highScores.sort(function(a, b) {\n return b.currentScore - a.currentScore;\n });\n\n for (let i = 0; i < highScores.length; i++) {\n let c...
[ "0.7703978", "0.7623032", "0.74838436", "0.7396112", "0.7287228", "0.725145", "0.7154519", "0.7119541", "0.7112684", "0.70930684", "0.698958", "0.698033", "0.69360465", "0.69307923", "0.68872434", "0.6849326", "0.6837412", "0.68339795", "0.68195677", "0.6814455", "0.6808405",...
0.8156971
0
= require d3/treeMapDesigner.js Creates a treemap and a list of data having weight = 0 If there is a div with id="treemapSpan" and another one with id="zeroWeightSpan" the diagram will use these divs and fit right into them.
function createTreemap(altWidth, altHeight, data, design, id) { var rawWidth, rawHeight; // filter data with 0 weight // TODO remove filteredData from data (only necessary for less calculation) var filteredData = []; for (var i = 0; i < data.children.length; i++) { var testNode = data.children[i]; if (testNode.weight == 0) { filteredData.push(testNode); } } // set sizes if divs are found if (!d3.select('#treemapSpan').empty() && !d3.select('#zeroWeightSpan').empty()) { var treemapSpanWidth = $(window).innerWidth() * 0.5; var zeroWeigthSpanWidth = parseInt(d3.select('#zeroWeightSpan').style('width'), 10); rawWidth = treemapSpanWidth; rawHeight = 2 / 3 * rawWidth; } else { rawWidth = altWidth; rawHeight = altHeight; } // sorts filteredData alphabetically filteredData.sort(function (a, b) { return a.name > b.name; }); var selector = "[id=" + id + "]"; var container = d3.select(selector); // Defines the margins and the size of the treemap var margin = {top: 10, right: 0, bottom: 10, left: 0}, width = rawWidth - margin.left - margin.right, height = rawHeight - margin.top - margin.bottom; $('#treemapSpan') .css("display", "flex") // Set attributes of the treemap container container .style("width", width + margin.left + margin.right + "px") .style("height", height + margin.top + margin.bottom + "px") // does tooltip at mouse position var mousemove = function (d) { var xPosition = d3.event.pageX + 10; var yPosition = d3.event.pageY + 10; var treemapSpanTop = $('#treemapSpan').offset().top; var treemapSpanLeft = $('#treemapSpan').offset().left; var tooltip = d3.select("#tooltipTreemap"); tooltip .style("left", xPosition - treemapSpanLeft + "px") .style("top", yPosition - treemapSpanTop + "px") .style("z-index", 3); d3.select("#tooltipTreemap #heading") .text(data.dataName + ": " + d.name); d3.select("#tooltipTreemap #info") .text(data.weightName + ": " + d.weight); d3.select("#tooltipTreemap").classed("hidden", false); }; var mouseout = function () { d3.select("#tooltipTreemap").classed("hidden", true); }; var treemap = d3.layout.treemap() .size([width, height]) .value(function (d) { return d.weight; }); // Defines which attribute is pivotal for the size var div = container.append("div") .style("position", "relative") .style("width", (width + margin.left + margin.right) + "px") .style("height", (height + margin.top + margin.bottom) + "px") .style("left", margin.left + "px") .style("top", margin.top + "px"); var node = div.datum(data).selectAll(".node") .data(treemap.nodes) .enter().append("svg") .attr("class", function (d) { if (d.children) { return "node inner" } else { return "node leaf" } }); d3.selectAll(".leaf") .on("mousemove", mousemove) .on("mouseout", mouseout); // decides which design is used if (design.toLowerCase() == "browser") { node.call(designBrowser, true); } else { node.call(designRect); } addFilterBox(); function addFilterBox() { var filterBox = d3.select('#zeroWeightSpan'); filterBox.style("padding-left", "20px"); filterBox.append("text") .html("<strong>" + data.zeroWeightLabel + ": </strong>"); var listGroup = filterBox.append("ul") .attr("class", "list-group"); for (var i = 0; i < filteredData.length; i++) { listGroup.append("li") .attr("class", "list-group-item") // Should look nicer with Bootstrap3 .html(filteredData[i].name); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TreeMap(htmlID) {\n \"use strict\";\n var self = this, margin = {top: 40, right: 0, bottom: 10, left: 0},\n width, height,\n color = d3.scale.category20c(),\n treemap,\n fScale,\n div;\n\n fScale = d3.scale.linear()\n .domain([10, 30000])\n .range(...
[ "0.7242493", "0.70613617", "0.70539737", "0.7025227", "0.69640905", "0.66913444", "0.66566694", "0.6632271", "0.65739286", "0.6439622", "0.6339739", "0.63352597", "0.6270326", "0.62191176", "0.6202769", "0.6183479", "0.6148252", "0.61297685", "0.61133474", "0.61085516", "0.60...
0.78153306
0
endpoints fetchEndpoint fetchParams Funciones onSaveEndpoint onEditEndpoint onDeleteEndpoint
constructor(props) { super(props); this.state = { values: [], columns: [], totalOfRecords: 0, limit: 10, page: 1, editedIds: [], search:"" } this.fetchFromApi = this.fetchFromApi.bind(this); this.mapColumns = this.mapColumns.bind(this); this.mapValues = this.mapValues.bind(this); this.normalRow = this.normalRow.bind(this); this.editedRow = this.editedRow.bind(this); this.addActions = this.addActions.bind(this); this.addToEditedIds = this.addToEditedIds.bind(this); this.addActionsWhenEditing = this.addActionsWhenEditing.bind(this); this.RemoveFromEditList = this.RemoveFromEditList.bind(this); this.onChangeEditingField = this.onChangeEditingField.bind(this); this.addRow = this.addRow.bind(this); this.searchEndpoint = this.searchEndpoint.bind(this); this.dynamicSearch = this.dynamicSearch.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "debugEndpointProvider() {\n console.log(this.epProvider.getEndPointByName('allData'));\n console.log(this.epProvider.buildEndPointWithQueryStringFromObject({\n limit: 10,\n sort: 'title',\n page: 1,\n filter: 'marketing-automation,ad-network',\n direction: 1,\n }, '/fetch-all'));\...
[ "0.635528", "0.5920606", "0.59178764", "0.5638117", "0.54557776", "0.54192483", "0.54161143", "0.5413101", "0.5401899", "0.5401659", "0.53221273", "0.5313876", "0.531256", "0.5296198", "0.5266401", "0.5251788", "0.52489156", "0.5240951", "0.5235156", "0.5221897", "0.5200226",...
0.0
-1
Init search if it wasn't already. Initialization is only executed once a user starts searching.
init() { if (!this.isInit) { return this.loadSearch(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initSearch() {\n this.search.init();\n\n if (this.visible) {\n this.closeSearch();\n } else {\n this.openSearch();\n }\n }", "function initSearch() {\r\n\tconsole.log(\"searchReady\");\r\n}", "function init_search() {\n\tif(Info.browser.isIEpre6) return;\n\t...
[ "0.852638", "0.7585972", "0.73536956", "0.7257967", "0.7131785", "0.7101173", "0.70451117", "0.70080364", "0.6991197", "0.6984699", "0.69390714", "0.6925646", "0.69013375", "0.6890376", "0.6877409", "0.6864544", "0.682902", "0.6751776", "0.6742171", "0.66980016", "0.66788244"...
0.84194475
1
Loads the JSON site index and creates the Fuse.io engine object for search
async loadSearch() { let fs = this; return fetchJSONFile(fs.index, function(data) { //data = data.filter(function(page) { // return page.lang == document.documentElement.lang; //}) fs.fuse = new Fuse(data, fs.fuseConfig); fs.isInit = true; console.log("hugo-fuse-search: Fuse.js was succesfuly instantiated."); }, function(status, statusText) { console.log("hugo-fuse-search: retrieval of index file was unsuccesful (\"" + fs.index + "\": " + status + " - " + statusText + ")") }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initLunr() {\n if (!endsWith(baseurl,\"/\")){\n baseurl = baseurl+'/'\n };\n\n // First retrieve the index file\n $.getJSON(baseurl +\"workflow.json\")\n .done(function(index) {\n pagesIndex = index;\n // Set up lunrjs by declaring the fields we use\n ...
[ "0.5969461", "0.5948373", "0.5942745", "0.5686151", "0.5640357", "0.5625639", "0.56143075", "0.56143075", "0.5597252", "0.5576088", "0.5541216", "0.55369246", "0.55334604", "0.5533023", "0.5527667", "0.5522264", "0.5514544", "0.5512344", "0.54588324", "0.5447411", "0.5436897"...
0.76123655
0
This component is controlled with the keyboard:
keyboardHandler(e, component) { if (event.metaKey && event.which === 191) { // Cmd + / component.initSearch(); } else { switch(e.keyCode) { case 27: // ESC component.closeSearch(); break; case 40: // DOWN component.navigateDown(e); break; case 38: // UP component.navigateUp(e); break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set Keyboard(value) {}", "handleKeyDown (event) {\n }", "onKeypress() {\n this.render();\n }", "onKeypress() {\n this.render();\n }", "onKeypress() {\n // If user press a key, just clear the default value\n if (this.opt.default) {\n this.opt.default = undefined;\n }\n\n this.rende...
[ "0.7208987", "0.66401803", "0.66341895", "0.66341895", "0.6606794", "0.6606794", "0.65699595", "0.65699595", "0.65371716", "0.65039575", "0.6452219", "0.64465135", "0.6445392", "0.63992393", "0.6393389", "0.637669", "0.6369276", "0.63435066", "0.63203657", "0.6310139", "0.630...
0.0
-1
Quick live check on the compatibility of the search component with this keyboard handler It must have the 5 controlled functions: initSearch, openSearch, closeSearch, navigateUp, navigateDown
validateComponent() { let requiredFunctions = ['initSearch', 'openSearch', 'closeSearch', 'navigateUp', 'navigateDown']; for (var f in requiredFunctions) { if (typeof(this.searchComponent[requiredFunctions[f]]) != "function") { return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "search(){\n // Condition checks if nothing has been input when first entering website and clicking the button or when something is typed and then deleted\n // returns out of method if this is the case as there will be no results\n if(this.state === null || this.state.term === ''){\n return;\n }\n\...
[ "0.6715124", "0.6653462", "0.662693", "0.6518495", "0.64232194", "0.6405861", "0.6393959", "0.6371647", "0.6308363", "0.6296724", "0.6293114", "0.62735015", "0.6261043", "0.6236059", "0.620848", "0.6204718", "0.6201838", "0.619269", "0.61867064", "0.61829704", "0.61797637", ...
0.6756157
0
Open the search component, check if fusesearch is already initiated, do so if necessary
initSearch() { this.search.init(); if (this.visible) { this.closeSearch(); } else { this.openSearch(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "openSearch() {\n this.element_main.style.visibility = \"visible\"; // show search box\n this.element_input.focus(); // put focus in input box so you can just start typing\n this.visible = true; // search visible\n }", "startSearch() {\n ...
[ "0.6815135", "0.66539484", "0.65874344", "0.65874344", "0.65457237", "0.6424384", "0.639838", "0.63893384", "0.63445395", "0.6287897", "0.6285508", "0.628222", "0.6270529", "0.6227657", "0.62151414", "0.62070286", "0.6201566", "0.61643827", "0.61580133", "0.6141851", "0.61374...
0.7113447
0
Make the component visible
openSearch() { this.element_main.style.visibility = "visible"; // show search box this.element_input.focus(); // put focus in input box so you can just start typing this.visible = true; // search visible }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "show() {\n this.visible = true;\n }", "static set visible(value) {}", "show() {\n this._elementRef.nativeElement.style.visibility = 'visible';\n }", "show() {\n checkPresent(this.containerDiv, 'not present when showing');\n this.containerDiv.style.visibility = 'visible';\n }"...
[ "0.7981325", "0.7648245", "0.7453596", "0.74317104", "0.7414109", "0.7400517", "0.7364811", "0.73188555", "0.7306029", "0.72806245", "0.72452855", "0.72429055", "0.7131665", "0.7121464", "0.709346", "0.7080804", "0.7017513", "0.6967501", "0.69285333", "0.691959", "0.6862616",...
0.0
-1
Make the component invisible
closeSearch() { if (this.closable) { this.element_main.style.visibility = "hidden"; // hide search box document.activeElement.blur(); // remove focus from search box this.visible = false; // search not visible } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hide() {\n this.isVisible = false;\n }", "onBecameHidden() {\n\n // Stop rendering\n this.isRendering = false\n\n }", "function unHideComponents(){\r\n tank.style.visibility = \"visible\";\r\n missile.style.visibility = \"visible\";\r\n score.style.visibility = \"visible\"...
[ "0.78876483", "0.7449151", "0.740243", "0.7385875", "0.7381059", "0.73426163", "0.7309358", "0.7174615", "0.7150921", "0.7135469", "0.71227956", "0.7119695", "0.70885104", "0.70317966", "0.7028102", "0.70249635", "0.7020506", "0.70114666", "0.69996595", "0.69656837", "0.69604...
0.0
-1
Move the focus down between results and the searchbar
navigateDown(event) { if (this.visible && this.resultsAvailable) { event.preventDefault(); // stop window from scrolling if ( document.activeElement == this.element_input) { this.top_result.firstElementChild.focus(); } // if the currently focused element is the main input --> focus the first <li> else if ( document.activeElement.parentElement == this.bottom_result ) { this.bottom_result.firstElementChild.focus(); } // if we're at the bottom, stay there else { document.activeElement.parentElement.nextSibling.firstElementChild.focus(); } // otherwise select the next search result } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _focusSearch() {\n setTimeout(function() {\n _$search.focus();\n }, CFG.TIME.DELAY);\n }", "navigateUp(event) {\n if (this.visible && this.resultsAvailable) {\n event.preventDefault(); // stop window from scrolling\n if ( document.activeElement ==...
[ "0.76003265", "0.7212361", "0.7126582", "0.71073157", "0.70856935", "0.70404977", "0.70146346", "0.69570446", "0.6918477", "0.68925667", "0.6869234", "0.6842849", "0.6749831", "0.67424625", "0.67304176", "0.67186606", "0.6576615", "0.64974165", "0.6457505", "0.64563453", "0.6...
0.76444477
0
Move the focus up between results and the searchbar
navigateUp(event) { if (this.visible && this.resultsAvailable) { event.preventDefault(); // stop window from scrolling if ( document.activeElement == this.element_input) { this.element_input.focus(); } // If we're in the input box, do nothing else if ( document.activeElement.parentElement == this.top_result) { this.element_input.focus(); } // If we're at the first item, go to input box else { document.activeElement.parentElement.previousSibling.firstElementChild.focus(); } // Otherwise, select the search result above the current active one } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _focusSearch() {\n setTimeout(function() {\n _$search.focus();\n }, CFG.TIME.DELAY);\n }", "navigateDown(event) {\n if (this.visible && this.resultsAvailable) {\n event.preventDefault(); // stop window from scrolling\n if ( document.activeElement ...
[ "0.7314933", "0.7159656", "0.6975068", "0.68999374", "0.6798788", "0.6778126", "0.67639023", "0.6687383", "0.6637259", "0.6605472", "0.6603954", "0.65734935", "0.65734935", "0.65734935", "0.6540389", "0.65312034", "0.6480829", "0.6473608", "0.645744", "0.6450812", "0.64290994...
0.7580102
0
Run the search (which happens whenever the user types)
executeSearch(term) { var results; try { results = this.search.fuse.search(term); // the actual query being run using fuse.js } catch (err) { if (err instanceof TypeError) { console.log("hugo-fuse-search: search failed because Fuse.js was not instantiated properly.") } else { console.log("hugo-fuse-search: search failed: " + err) } return; } let searchitems = ''; if (results.length === 0) { // no results based on what was typed into the input box this.resultsAvailable = false; searchitems = ''; } else { // we got results, show 5 for (let item in results.slice(0,5)) { let result = results[item]; if ('item' in result) { let item = result.item; searchitems += this.itemHtml(item); } } this.resultsAvailable = true; } this.element_results.innerHTML = searchitems; if (results.length > 0) { this.top_result = this.element_results.firstChild; this.bottom_result = this.element_results.lastChild; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doneTyping() {\r\n search();\r\n}", "function doneTyping() {\n if ((self.searchText !== '') && !(arrayContains(self.searchText, searchedText))) {\n queryStudents(self.searchText);\n }\n }", "function search() {\n let search_text = $search_text.value;\n decide_search(search_text)\n}"...
[ "0.76176494", "0.72700644", "0.721371", "0.7176662", "0.71520126", "0.7140705", "0.71274215", "0.7054106", "0.7018404", "0.7018404", "0.7014037", "0.6979836", "0.69749373", "0.6842858", "0.6834637", "0.6834637", "0.6834637", "0.681225", "0.6771707", "0.6748501", "0.6724104", ...
0.64908236
40
========================================== HELPER FUNCTIONS / Fetches JSON file and returns the parsed contents in the callback
function fetchJSONFile(path, callback, errorCallback) { return new Promise(function (resolve, reject) { var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function() { if (httpRequest.readyState === 4) { if (httpRequest.status === 200) { var data = JSON.parse(httpRequest.responseText); if (callback) { callback(data); } resolve(); } else { if (errorCallback) { errorCallback(httpRequest.status, httpRequest.statusText) } reject(); } } }; httpRequest.open('GET', path); httpRequest.send(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadJSON(file,callback){\n var ajax=new XMLHttpRequest();\n ajax.overrideMimeType(\"application/json\");\n ajax.open(\"GET\",file,true);\n ajax.onreadystatechange=()=>{\n if(ajax.readyState ===4 && ajax.status===200){\n callback(ajax.responseText);\n }\n }\n ajax...
[ "0.73925203", "0.73683697", "0.73373675", "0.7309834", "0.72697055", "0.7240527", "0.7216744", "0.7215353", "0.71886384", "0.7152373", "0.71517855", "0.7144123", "0.71307194", "0.7091383", "0.7089693", "0.70718646", "0.7060781", "0.7051274", "0.70503205", "0.70339984", "0.702...
0.72851825
4
Functions for Passing New Chef
function signUpChef(newChef) { $.post("/api/chefsignup", newChef) .then(function(data) { window.location.replace("/chefs"); // If there's an error, handle it by throwing up a bootstrap alert }) .catch(handleLoginErr); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function service(){\n\tchef.apply(null,arguments);\n}", "function validateCreateChef(req,res,next){\n req.check('chef', \"chef doesn't exists\").exists(),\n req.check('chef.name').custom(name => {\n if (!validatorsUtil.checkField(name)) {\n throw new Error('name invalid');\n } el...
[ "0.7133225", "0.56888705", "0.55245125", "0.51479095", "0.50672746", "0.5040997", "0.5031598", "0.4951856", "0.48929513", "0.4859023", "0.4802941", "0.48006845", "0.4796723", "0.47946352", "0.4771253", "0.47711292", "0.47618064", "0.4738504", "0.4695497", "0.46758896", "0.467...
0.47910273
14
start pannellum setup code
function hotspot(hotSpotDiv, args) { hotSpotDiv.classList.add('custom-tooltip'); var span = document.createElement('span'); span.innerHTML = args; hotSpotDiv.appendChild(span); span.style.width = span.scrollWidth - 20 + 'px'; span.style.marginLeft = -(span.scrollWidth - hotSpotDiv.offsetWidth) / 2 + 'px'; span.style.marginTop = -span.scrollHeight - 12 + 'px'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {}", "setup() {}", "setup() {}", "setup() {}", "function _setup () {\n }", "_setup () {\n // Setup pins\n this._dialPin = new Gpio(GpioManager.DIAL_PIN, 'in', 'both', { debounceTimeout: 10 })\n this._pulsePin = new Gpio(GpioManager.PULSE_PIN, 'in', 'falling', { debounceTi...
[ "0.6438941", "0.63599104", "0.63599104", "0.63599104", "0.6123729", "0.60628587", "0.60035086", "0.60024184", "0.5964479", "0.5964479", "0.59601617", "0.5943648", "0.5903026", "0.5878409", "0.584813", "0.5827534", "0.5807786", "0.5799788", "0.5790689", "0.5788834", "0.5774100...
0.0
-1
ajax request na ziskanie dat pre gate_man
function load_all_time_slots() { $.post('gate_man_AJAX/load_all_time_slots.php',{ },function(data){ if (typeof data === 'object'){ parse_data(data); }else if(data){ create_exception(data ,23,'danger'); }else{ create_exception("Could not connect to the server. Please check your <strong>internet connection</strong>.",23,'danger'); } }); setTimeout(generate_gate_selector,250); // nutne cakanie koli spracovaniu dat ktor boli ziskane ajaxom }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStatus(){\n $.ajax({\n // la URL para la petición\n url: 'getStatus',\n // especifica si será una petición POST o GET\n type: 'POST',\n // la información a enviar\n data: {'_token': $('input[name=_token]').val() },\n // el tipo de información que se e...
[ "0.6610311", "0.65447557", "0.64240557", "0.6402824", "0.64021075", "0.64020574", "0.6375184", "0.6366791", "0.6357064", "0.6347096", "0.6343475", "0.6337624", "0.6323555", "0.63109237", "0.6303399", "0.62891126", "0.6288696", "0.62845373", "0.62750477", "0.6273331", "0.62694...
0.0
-1
funkcia na vitvorenie tables 'prepared'/'requested'/'booked'/'finished'
function make_table_for_external_dispatcher(id_of_table , row_class_name , state){ let table_witch_contains_id = document.getElementById(id_of_table); let table_rows_with_class_name = document.getElementsByClassName(row_class_name); while (table_rows_with_class_name.length){ // delete all row of certain table table_rows_with_class_name[0].remove(); } // generator html pre dani table for (let calendar = 0 ; calendar < gates.array_of_calendars.length; calendar++){ for (let real_time = 0 ;real_time < gates.array_of_calendars[calendar].time_slots.length;real_time++){ for (let certain_time_slot = 0; certain_time_slot < gates.array_of_calendars[calendar].time_slots[real_time].start_times.length ; certain_time_slot++) { // pokial je row prepared negenegrovat s rovnakim casom ak sa uz cas nachada v let row = table_witch_contains_id.insertRow(); row.className = row_class_name; let cell1 = row.insertCell(0); let cell2 = row.insertCell(1); let cell3 = row.insertCell(2); let cell4 = row.insertCell(3); let cell5 = row.insertCell(4); let cell6 = row.insertCell(5); let cell7 = row.insertCell(6); let cell8 = row.insertCell(7); if (gates.array_of_calendars[calendar].time_slots[real_time].kamionists_2[certain_time_slot] !== null) { cell5.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].kamionists_1[certain_time_slot] + "<br>" + gates.array_of_calendars[calendar].time_slots[real_time].kamionists_2[certain_time_slot]; } else { cell5.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].kamionists_1[certain_time_slot]; } cell4.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].evcs[certain_time_slot]; cell1.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].start_times[certain_time_slot].split(' ')[1]; cell2.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].destinations[certain_time_slot]; cell3.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].external_dispatchers[certain_time_slot]; if (gates.array_of_calendars[calendar].time_slots[real_time].commoditys[certain_time_slot].length > 40){ create_html_linked_text(gates.array_of_calendars[calendar].time_slots[real_time].commoditys[certain_time_slot],cell6) }else{ cell6.innerHTML = gates.array_of_calendars[calendar].time_slots[real_time].commoditys[certain_time_slot]; } cell7.innerHTML = gates.ids[calendar]; let apply_button = document.createElement("BUTTON") apply_button.className = "btn btn-default bg-success only_one"; apply_button.onclick = function (){ let index = gates.array_of_calendars[calendar].time_slots[real_time].ids[certain_time_slot]; ajax_post_confirm(row,index); } apply_button.innerHTML = "Confirm arrival"; cell8.className = "td_flex_buttons"; cell8.appendChild(apply_button); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTable() {\n Promise.all([BookService.getBooks(), AuthorService.getAuthors()])\n .then(([books, authors]) => {\n books = Library.sortBooksByTitle(books, 1);\n updateTable(books, authors);\n })\n}", "function createTables()\n{\n \n if( location.hash.indexOf(...
[ "0.60164225", "0.59576756", "0.59098965", "0.5896678", "0.58923167", "0.5891175", "0.57918495", "0.57595366", "0.56742686", "0.5674141", "0.5664534", "0.5638784", "0.5638784", "0.5628642", "0.5610885", "0.5609798", "0.556761", "0.5566256", "0.55626184", "0.5560679", "0.556007...
0.0
-1
Create flashcards from Text
function flashcardCreator() { let str = document.querySelector("#flashcardWords").value; let cells = str.split("\n").map(function (el) { return el.split(" - "); }); let inputs = document.querySelectorAll("form input"); let inputsValues = []; for (let i = 0; i < inputs.length; i++) { inputsValues.push(inputs[i].value); } let headings = inputsValues; let out = cells.map(function (el) { let obj = {}; obj.cardID = 1; for (var i = 0; i < el.length; i++) { if (el.length == 2) { obj[headings[i]] = isNaN(Number(el[i])) ? el[i] : +el[i]; obj.empty = ""; } else { obj[headings[i]] = isNaN(Number(el[i])) ? el[i] : +el[i]; } } return obj; }); for (let i = 0; i < out.length; i++) { out[i].cardID = storedFlashCards.length + 1 + i; out[i].youtube = ""; out[i].ok = 0; out[i].repeat = 0; } storedFlashCards = storedFlashCards.concat(out); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_createFlashcardDOM(frontText, backText) {\n const cardContainer = document.createElement('div');\n cardContainer.classList.add('flashcard-box');\n cardContainer.classList.add('show-word');\n\n const wordSide = document.createElement('div');\n wordSide.classList.add('flashcard');\n wordSide.class...
[ "0.6679222", "0.6679222", "0.6668698", "0.6651906", "0.5889314", "0.57875365", "0.57804394", "0.5614467", "0.559772", "0.55033606", "0.54974455", "0.5446191", "0.5437365", "0.54142797", "0.54136115", "0.53959346", "0.5383729", "0.53130126", "0.5298589", "0.52947754", "0.52773...
0.6262859
4
Create a string from flashcards database
function flashcardsToSave() { let saveTextArea = document.querySelector("#saveFlashcardWords"); cardsToSaveArray = storedFlashCards.map(function (el) { arr = []; for (let k in el) { if ( k == "cardID" || k == "ok" || k == "repeat" || k == "youtube" || k == "" || k == "empty" ) { continue; } else { arr.push(el[k]); } } return arr; }); cardsToSaveArray2 = cardsToSaveArray.map(function (el) { if (el.length == 2) { el.splice(1, 0, "-"); } else { el.splice(1, 0, "-"); el.splice(3, 0, "-"); } el.push("\n"); return el; }); cardsToSaveArrayToString = cardsToSaveArray2.map(function (el) { el = String(el).replace(/,-,/g, " - "); el = el.replace(/,\n/, "\n"); return el; }); cardsToSaveToString = String(cardsToSaveArrayToString); cardsToSaveToString = cardsToSaveToString.replace(/\n,/g, "\n"); saveTextArea.value = cardsToSaveToString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cardToString(){ \n // not sure if is prototype or just function\n\n var number; //rank \n var suit;\n\n switch (this.number) {\n case \"A\" :\n number = \"Ace\";\n break;\n case \"2\" :\n number = \"Two\";\n break;\n case \"3\" :\n number = \"Three\";\n break;\n ...
[ "0.59964985", "0.5802495", "0.5791379", "0.5770093", "0.572363", "0.5723144", "0.56455123", "0.56441593", "0.55666375", "0.55661523", "0.5501067", "0.5493857", "0.54920423", "0.54764336", "0.5449563", "0.5446059", "0.5409039", "0.53889835", "0.5387067", "0.53455615", "0.53366...
0.5364134
19
Check if browser is already in full screen
function checkFullScreen() { if ((window.fullScreen) || (window.innerWidth == screen.width && window.innerHeight == screen.height)) { console.log("Yes"); } else { console.log("No"); toggleFullScreen(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fullScreenCheck() {\n if (document.fullscreenElement) return;\n return document.documentElement.requestFullscreen();\n}", "function isFullScreen() {\n return window.fullScreen || (window.innerWidth == screen.width && window.innerHeight == screen.height);\n}", "function isFullScreen() {\n return ...
[ "0.8016148", "0.7704504", "0.76758903", "0.7569065", "0.75649625", "0.7553847", "0.7503396", "0.74950075", "0.74854714", "0.74749744", "0.7434379", "0.7408569", "0.73504394", "0.7232741", "0.72245306", "0.72192407", "0.72054565", "0.71647924", "0.71578306", "0.71545666", "0.7...
0.7843703
1
HIGH SCORING MAGIC Check for Local Storage
function isLocalStorageWorking() { try { return 'localStorage' in window && window['localStorage'] !== null; } catch (e) { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkStorageItem() {\n return localStorage.getItem(localBook) !== null;\n}", "function checkForStorage() {\n return typeof(Storage) !== \"undefined\"\n}", "function check_local_storage() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API\n try {\n ...
[ "0.7636655", "0.7473045", "0.7427741", "0.7413296", "0.7326227", "0.72658384", "0.71965635", "0.7174501", "0.716655", "0.7116387", "0.71091855", "0.7100746", "0.7099761", "0.7061529", "0.7056042", "0.7053511", "0.70080763", "0.699136", "0.69880384", "0.6980019", "0.6971494", ...
0.67469
43
Call on the function to Reset us back to the start.
function reset() { started = false; count = 0; return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n\nstart();\n\n}", "function reset() {\n resetFunc();\n }", "function reset() { }", "function reset() {\n stop();\n pauseTimePassed = 0;\n functionsToCallOnReset.forEach(f => f());\n }", "function reset() {\n\n }", "Reset() {}", "Reset() {\n\n }", "funct...
[ "0.8204527", "0.8113986", "0.7890155", "0.785407", "0.78191113", "0.7681902", "0.7669293", "0.7568866", "0.7524224", "0.7523944", "0.745424", "0.74365956", "0.72729814", "0.7249985", "0.7232091", "0.7226963", "0.7223879", "0.7213932", "0.71744233", "0.71744233", "0.71744233",...
0.73400724
12
==================================================== = Funcion para agregar usuario = ====================================================
function AddUsuario(req, res){ let avatar = ""; if (req.file) { // console.dir(req.file); avatar = req.file.filename; } const pass = req.body.pass if( /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]{10,60}[^'\s]/.exec(pass)) { const usuario = { nombre: req.body.nombre, edad: req.body.edad, avatar: avatar, email: req.body.email, pass: sha512(req.body.pass), rol: req.body.rol }; conn('Usuario').insert(usuario).then(result => { res.status(200).json({ succes: true, resp: "Usuario guardado correctamente", data: result[0], file: req.file }); }).catch(error => { res.status(500).send({ succes: false, resp: 'error', error: `${error}`, req: req.body }); }); } else { res.status(500).send({ succes: false, resp : 'LA contraseña debe contener números, caráctes especiales y al menos una mayúsicula' }) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function criaUser() {\r\n var Usuarios = {\r\n email: formcliente.email.value,\r\n nome: formcliente.nome.value,\r\n pontos: formcliente.pontos.value,\r\n senha: formcliente.senha.value,\r\n sexo : formcliente.sexo.value\r\n };\r\n addUser(Usuarios);\r\n}", "createUsua...
[ "0.77804697", "0.73716885", "0.7221612", "0.6943766", "0.69363385", "0.6908232", "0.68310773", "0.6823718", "0.6814748", "0.67254764", "0.6705308", "0.66802764", "0.66591024", "0.66506535", "0.66436327", "0.6624465", "0.6593723", "0.65904176", "0.65860415", "0.657059", "0.655...
0.6532353
21
===== End of Funcion para agregar usuario ====== /========================================= = Update de usuario = =========================================
function UpdateUsuario(req, res){ if (req.usuario.rol === 1 || req.usuario.nombre === req.body.nombre) { const idUsuario = req.params.idUsuario; const usuario = { nombre: req.body.nombre, edad: req.body.edad, email: req.body.email, pass: sha512(req.body.pass), rol: req.body.rol || 2 }; conn('Usuario').where('idUsuario', idUsuario).update(usuario).then(result => { if (result != 0) { res.status(200).send({ succes: true, resp: "Usuario actualizado correctamente", data: result }); } else{ res.status(500).send({ succes: false, resp: "No se actualizó ningun usuario" }); } }).catch(error => { res.status(500).send({ succes: false, resp: "Error al actualizar el usuario", error: `${error}`, user: user, params: req.body }); }); } else { res.status(500).send({ succes: false, resp: "No tiene permisos para actualizar el usaurio" }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function update(OID_USUARIO,USUARIO){\n\t\n\t/*INSERCION DE DATOS*/\n\t\n\t$(\"#txt_usuario\").val(USUARIO);\n\t\n\t$(\"#txt_usuario\").attr(\"USER\",OID_USUARIO);\n\t\n\t$(\"#btn_enviar_usuario\").text(\"Actualizar\")\n\t\t\n\t\n}//FINAL DE LA ACTUALIZACION DE UN REGISTRO", "function modificarUsuario(\n id,\n ...
[ "0.7378415", "0.73284143", "0.72158355", "0.71927077", "0.69349563", "0.6908207", "0.67544615", "0.6748086", "0.6737534", "0.67308295", "0.6724809", "0.6710676", "0.66908425", "0.66616553", "0.66342485", "0.66146684", "0.65938395", "0.6578623", "0.6562931", "0.65460294", "0.6...
0.64839494
23
===== End of logueo ====== /================================= = VerifToken = =================================
function VerifToken(req, res, next){ let token = req.get('token'); jwt.verify(token, process.env.SEED_TOKEN, (err, decoded) => { if (err) { res.status(500).send({ succes:false, error: err }); } else { req.usuario = decoded.usuario; next(); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokenHandler( result )\n{\n $( \"#app-status-ul\" ).append( '<li>token: ' + result + '</li>' );\n}", "function _token(){\n\tvar len = util_args2int() || 32;\n\tvar suid = require('rand-token').suid;\n\tvar token = suid(len);\n\tconsole.log( esrever.reverse(token) );\n}", "function showToken(respons...
[ "0.57728505", "0.57672375", "0.57497686", "0.5748823", "0.56736195", "0.5600588", "0.55926174", "0.55657256", "0.55538857", "0.55421114", "0.5527276", "0.5502193", "0.5492844", "0.5464654", "0.54621464", "0.54611063", "0.5452202", "0.54483", "0.5440748", "0.5440483", "0.54334...
0.6139094
0
this can be replaced with fs.copyFileSync if node 8.5+ is required in package.json
function copySync(src, dest) { if (!fs.existsSync(src)) { return false; } if ( 'win32' == os.platform() ) { var data = fs.readFileSync(src, 'utf-8'); fs.writeFileSync(dest, data); } else { fs.createReadStream(src).pipe(fs.createWriteStream(dest)); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "copySync(src, dest) {\n const current = this.findNode(src);\n // if (!current) {\n // throw new HexletFsError(errors.code.ENOENT, src);\n // }\n // if (current.getMeta().isDirectory()) {\n // throw new HexletFsError(errors.code.EISDIR, src);\n // }\n \n // const { dir, base } = path....
[ "0.775956", "0.7309893", "0.7278469", "0.7272375", "0.7258658", "0.71832585", "0.7132804", "0.70504946", "0.70234233", "0.6828825", "0.68181366", "0.67915547", "0.67416734", "0.6739172", "0.6713597", "0.6680305", "0.66508955", "0.65694433", "0.65694433", "0.65694433", "0.6532...
0.67755187
12
convert mm/dd/yyyy strings to Date objects
function mmddyyyyToDate(dateString) { var split = dateString.split("/"); return new Date(split[2], split[0] - 1, split[1]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convertStr2Date(dateStr)\r\n{\r\n\t//wrap firt four char to year\r\n\tvar year = parseInt(dateStr.substring(0,4));\r\n\r\n\t//get month str\r\n\tvar sMonth = dateStr.substring(4,6);\r\n\r\n\t//splice the '0' when sMonth like '01','02',,...\r\n\tif('0'==sMonth.charAt(0))\r\n\t\tsMonth = sMonth.substring(1,...
[ "0.71350735", "0.7062008", "0.70036495", "0.6872586", "0.6844754", "0.68180287", "0.67998827", "0.6773076", "0.65806746", "0.6575949", "0.6560446", "0.6549368", "0.6547575", "0.6538812", "0.6536198", "0.6536198", "0.6536198", "0.6536198", "0.6521352", "0.6516348", "0.65109104...
0.7243855
0
appends html for each result takes two args, array to render and jQuery selector where items should be rendered
function renderResultsArray(array, target) { $(target).empty(); array.sort(function (a, b) { var textA = a.Name.toUpperCase(); var textB = b.Name.toUpperCase(); return (textA < textB) ? -1 : (textA > textB) ? 1 : 0; }); for (var i = 0; i < array.length; i++) { $(target).append("<div class='libResult'><a href='" + array[i].Link + "' target='_blank'><h2>" + array[i].Name + "</h2></a>Published: <span class='facetDate'>" + array[i].Year + "</span><p>" + array[i].MetaDescription + "</p></div>"); } $('#count').html(array.length); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderResults(res) {\n $(\"#results-area\").empty();\n for (var i = 0; i < res.matches.length; i++) {\n var matches = res.matches[i];\n\n var div = $(\"<div>\");\n div.addClass(\"result\");\n\n var ul = $(\"<ul>\");\n ul.attr(\"recipe-id\", matches.id);\n\n ...
[ "0.6387082", "0.63637924", "0.6209841", "0.61521375", "0.61026263", "0.6096698", "0.6088534", "0.60826087", "0.6080385", "0.6075667", "0.60712624", "0.6005628", "0.5953067", "0.5952239", "0.59506476", "0.5921395", "0.5893163", "0.5876897", "0.58762795", "0.5875973", "0.586698...
0.578305
26
TAGS indicate the currently applied filters (search or facets) and remove corresponding filter on click
function displayFacetTags(facetObj) { $("#facetTags").empty(); _.forOwn(facetObj, function (value, key) { if (facetObj[key].length) { $(facetObj[key]).each(function () { //Needs Tag Template $("#facetTags").append("<div facet='" + key + "' class='facetTag' value='" + this + "'>[x] " + this + "</div>"); }); } }); $(".facetTag").each(function (i, tag) { $(tag).click(function (e) { var facet = e.target.getAttribute('facet'); var value = e.target.attributes.value.textContent; //Uncheck the corresponding input on click $("input[name='" + facet + "'][value='" + value + "']").prop('checked', false).change(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearFilterTag() {\n lastFilter = null;\n hideClearFilterBtn();\n // Show all articles\n SetNodesVisibility(\"article\", true);\n // Show all sections\n SetNodesVisibility(\"section\", true);\n}", "function removeFilter(){\r\n\t$('.filter_btn').remove();\r\n\t$('.filter_btn_wrap').remo...
[ "0.71176887", "0.6927449", "0.68139267", "0.68029016", "0.6758489", "0.67303795", "0.66831243", "0.66536933", "0.6632786", "0.6597781", "0.65788597", "0.6560191", "0.6530841", "0.6394518", "0.63681716", "0.63535804", "0.6340867", "0.63241863", "0.627386", "0.6272106", "0.6264...
0.0
-1
Displays a tag with the search term that can be clicked to clear search
function displaySearchTag(searchTerm) { $("#countCopy").html(" for: <strong>" + searchTerm + "</strong> <span id='clearSearch'>Clear Search</span>"); $("#clearSearch").click(function () { //reset global array, search field contents, and result count on page SearchArray = []; $("#search").val(""); $("#countCopy").html(""); //restore inputs to all facets var facetsToRender = getApplicableFacets(AllLib); renderFacetInputs(facetsToRender); applyFilters(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clear () {\n self.searchTerm = '';\n search();\n }", "function clearSearchText () {\n // Set the loading to true so we don't see flashes of content.\n // The flashing will only occur when an async request is running.\n // So the loading process will stop when the re...
[ "0.7134636", "0.6828675", "0.6828675", "0.682581", "0.68016094", "0.6751084", "0.6735517", "0.6728522", "0.66995066", "0.66995066", "0.66868895", "0.6665313", "0.66345114", "0.66290665", "0.6609459", "0.66066897", "0.6592361", "0.6583079", "0.65684146", "0.65619206", "0.65395...
0.769905
0
Main Angular bundling processing.
function generateNgBundle(ngPkg) { return __awaiter(this, void 0, void 0, function* () { log.info(`Generating bundle for ${ngPkg.fullPackageName}`); const artifactFactory = new ng_artifacts_factory_1.NgArtifactsFactory(); const baseBuildPath = `${ngPkg.buildDirectory}/ts${ngPkg.pathOffsetFromSourceRoot}`; const artifactPaths = artifactFactory.calculateArtifactPathsForBuild(ngPkg); // 0. CLEAN BUILD DIRECTORY log.info('Cleaning bundle build directory'); yield rimraf_1.rimraf(ngPkg.buildDirectory); // 1. ASSETS log.info('Processing assets'); yield assets_1.processAssets(ngPkg.sourcePath, baseBuildPath); // 2. NGC log.info('Running ngc'); const es2015EntryFile = yield ngc_1.ngc(ngPkg, baseBuildPath); // XX: see #46 - ngc only references to closure-annotated ES6 sources yield sorcery_1.remapSourceMap(`${baseBuildPath}/${ngPkg.flatModuleFileName}.js`); // 3. FESM15: ROLLUP log.info('Compiling to FESM15'); yield rollup_1.rollup({ moduleName: ngPkg.packageNameWithoutScope, entry: es2015EntryFile, format: 'es', dest: artifactPaths.es2015, externals: ngPkg.libExternals }); yield sorcery_1.remapSourceMap(artifactPaths.es2015); // 4. FESM5: TSC log.info('Compiling to FESM5'); yield tsc_1.downlevelWithTsc(artifactPaths.es2015, artifactPaths.module); yield sorcery_1.remapSourceMap(artifactPaths.module); // 5. UMD: ROLLUP log.info('Compiling to UMD'); yield rollup_1.rollup({ moduleName: ngPkg.packageNameWithoutScope, entry: artifactPaths.module, format: 'umd', dest: artifactPaths.main, externals: ngPkg.libExternals }); yield sorcery_1.remapSourceMap(artifactPaths.main); // 6. UMD: Minify log.info('Minifying UMD bundle'); const minifiedFilePath = yield uglify_1.minifyJsFile(artifactPaths.main); yield sorcery_1.remapSourceMap(minifiedFilePath); // 7. SOURCEMAPS: RELOCATE ROOT PATHS log.info('Remapping source maps'); yield sorcery_1.relocateSourceMapRoot(ngPkg); // 8. COPY SOURCE FILES TO DESTINATION log.info('Copying staged files'); yield transfer_1.copySourceFilesToDestination(ngPkg, baseBuildPath); // 9. WRITE PACKAGE.JSON and OTHER DOC FILES log.info('Writing package metadata'); const packageJsonArtifactPaths = artifactFactory.calculateArtifactPathsForPackageJson(ngPkg); yield package_1.writePackage(ngPkg, packageJsonArtifactPaths); log.success(`Built Angular bundle for ${ngPkg.fullPackageName}`); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bundle() {\n return b.bundle()\n // log errors if they happen\n .on('error', gutil.log.bind(gutil, 'Browserify Error'))\n .pipe(source('stripe_express_angular.js'))\n //.pipe(uglify())\n // optional, remove if you don't need to buffer file contents\n .pipe(buffer())\n .pipe(ngannotat...
[ "0.6609535", "0.6416092", "0.63818115", "0.63776296", "0.62974554", "0.62883836", "0.6248147", "0.61762017", "0.61543673", "0.606588", "0.59894866", "0.59604114", "0.5945811", "0.5902008", "0.58489144", "0.58359253", "0.58315784", "0.5828818", "0.57688624", "0.57617563", "0.5...
0.59167045
13
true if f is contained by one of the layers listed in this_.layers
function layersContain(f) { // if a single layer is used, it is simple if (!Array.isArray(this_.layers)) return this_.layers.getSource().hasFeature(f); // otherways iterate over layer sources and return true if found something for (var i=0;i<this_.layers.length;i++) if (this_.layers[i].getSource().hasFeature(f)) return true; // return false if no results return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function F(e){return e.layers.some((e=>null!=e.layerDefinition.visibilityField))}", "function MatchingFeatureTypes() {\n\tfor (var i=0; i < checkedLayers.length-1; i++) {\n\t\tfor (var j=i+1; j < checkedLayers.length; j++) {\n\t\t\tif (checkedLayers[i].protocol.featureType != checkedLayers[j].protocol.featureTyp...
[ "0.6350343", "0.5971203", "0.5919843", "0.55278057", "0.55161625", "0.55132467", "0.5477452", "0.5400826", "0.5356923", "0.52706295", "0.52531236", "0.52361584", "0.5229913", "0.52187705", "0.52044857", "0.51867014", "0.5181223", "0.5174418", "0.51342785", "0.5120446", "0.512...
0.85632825
0
filter hogs that are greased
adjustNameForPic(name) { return name.toLowerCase().replace(/ /g,"_"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static good() {\n return this.all().filter(doge => doge.isGoodDog)\n }", "function gooseFilter(birds){\n const geese = ['African', 'Roman Tufted', 'Toulouse', 'Pilgrim', 'Steinbacher'];\n return birds.filter(bird => !geese.includes(bird));\n}", "function gooseFilter(birds) {\n var geese = [\"Afr...
[ "0.63419795", "0.62515277", "0.61753416", "0.60929", "0.59767246", "0.5671999", "0.5626187", "0.5508197", "0.54815096", "0.5479069", "0.53502834", "0.53426504", "0.53275716", "0.53228074", "0.5315339", "0.5300763", "0.5297628", "0.5297628", "0.5286056", "0.52816385", "0.52695...
0.0
-1
Handle rendering result of finished challenge
function renderExamResult() { console.log('renderExamResult() has been used.'); hideElements(['challenge', 'progress', 'timer']); showElement('.result'); var summary = validateExamAnswers(); var score = summary.score; var title; var subtitle; var image; var html = ''; subtitle = getMessage('result_score', 'Your score is ${score}.', ['<strong>'+score+'%</strong>']) + ' '; if (score == 100) { title = getMessage('result_perfect', 'Perfect'); subtitle += getMessage('result_perfect_details', 'Will you repeat this?'); image = 'passed'; } if (score >= 80 && score < 100) { title = getMessage('result_great', 'Great'); subtitle += getMessage('result_great_details', 'You would pass exam.'); image = 'passed'; } if (score >= 50 && score < 80) { title = getMessage('result_not_good', 'Not good'); subtitle += getMessage('result_not_good_details', 'You can do it better.'); image = 'failed'; } if (score < 50) { title = getMessage('result_poor', 'Poor'); subtitle += getMessage('result_poor_details', 'You have to do it better.'); image = 'failed'; } if (score == 0) { title = getMessage('result_terrible', 'Terrible'); subtitle += getMessage('result_terrible_details', 'Start to learn wise.'); image = 'epic-fail'; } html += '<div class="row">'; html += '<div class="col mb-3">'; html += '<div class="card text-center result-box">'; // html += '<div class="card text-center col-sm-6 col-md-6 col-lg-8 col-xl-12">'; html += ' <div class="card-header">'; // html += allExams[exam].exam.toUpperCase() + ' exam result'; html += getMessage('exam_result_header', '${name} exam result', [allExams[exam].description]); // html += ' Service Mapping exam result'; html += ' </div>'; html += ' <a href="#" onclick="javascript:renderExamResultDetails();">'; html += ' <div class="card-body">'; html += ' <div class="col-sm-6 result-image '+image+'"></div>'; html += ' <h1 class="card-title">'+title+'</h1>'; html += ' <p class="card-text">'+subtitle.replace('%d%', '<strong>'+score+'%</strong>')+'</p>'; // html += '<a href="#" class="btn btn-primary">Go somewhere</a>'; html += ' </div>'; html += ' </a>'; html += '</div>'; html += '</div>'; html += '</div>'; html += '<div class="row row-cols-1 row-cols-md-2">'; html += ' <div class="col mb-3 col-sm-6 col-md-6">'; html += ' <div class="card h-100 text-center text-success border-success result-box">'; html += ' <a href="#" onclick="javascript:renderExamResultDetails(\'correct\');">'; html += ' <div class="card-body">'; html += ' <h1 class="card-title">'+summary.correct.length+'</h1>'; html += ' <p class="card-text">' + getMessage('exam_result_correct', 'Questions answered correctly.') + '</p>'; html += ' </div>'; html += ' </a>'; html += ' </div>'; html += ' </div>'; html += ' <div class="col mb-3 col-sm-6 col-md-6">'; html += ' <div class="card h-100 text-center text-danger border-danger result-box">'; html += ' <a href="#" onclick="javascript:renderExamResultDetails(\'wrong\');">'; html += ' <div class="card-body">'; html += ' <h1 class="card-title">'+summary.wrong.length+'</h1>'; html += ' <p class="card-text">' + getMessage('exam_result_incorrect', 'Questions with incorrect or missing answer.') + '</p>'; html += ' </div>'; html += ' </a>'; html += ' </div>'; html += ' </div>'; html += '</div>'; // html += '<div class="row">'; // html += ' <div class="col text-center mt-3 mb-3">'; // html += '<button id="repeat-exam" onclick="javascript:repeatExam();" class="btn btn-secondary">Repeat same questions</button>'; // html += '<button id="retry-exam" onclick="javascript:retryExam();" class="btn btn-primary">Retry new questions</button>'; // html += ' </div>'; // html += '</div>'; html += '<div class="row row-cols-1 row-cols-md-2">'; html += ' <div class="col text-center mb-3 col-sm-6 col-md-6">'; html += ' <button id="retry-exam" onclick="javascript:retryExam();" class="btn btn-primary">' + getMessage('retry_exam', 'Retry new questions') + '</button>'; html += ' </div>'; html += ' <div class="col text-center mb-3 col-sm-6 col-md-6">'; html += ' <button id="repeat-exam" onclick="javascript:repeatExam();" class="btn btn-secondary">' + getMessage('repeat_exam', 'Repeat same questions') + '</button>'; html += ' </div>'; html += '</div>'; // renderElement('.result', result + '<p class="advice">' + advice + '</p>' + html); renderElement('.result', html); state = 'exam_result_rendered'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "IsFinishedRendering() {}", "function renderFinalResult() {\n //console.log('Final result is being rendered');\n $('.result').html(generateFinalResult());\n}", "function doSomethingAfterRendering(){\n displayLoading() // 로딩화면 보여주기\n fetchServer(); // 서버에서 데이터 가져오기\n }", "renderNext() {\n\n ...
[ "0.6549023", "0.65190035", "0.63434786", "0.63130915", "0.6147523", "0.61348695", "0.5994861", "0.5951863", "0.5951863", "0.58953464", "0.5872451", "0.5872451", "0.5854163", "0.58281255", "0.5826414", "0.58133674", "0.5799243", "0.5760289", "0.57406795", "0.57405114", "0.5722...
0.61181676
6
Handle rendering result of finished challenge
function renderExamResultDetails(type) { console.log('renderExamResultDetails() has been used.'); hideElements(['challenge', 'progress', 'timer']); showElement('.result'); var summary = validateExamAnswers(); var className; var list = questions.answered; var html = ''; html += '<div class="row">'; html += ' <div class="col mb-3">'; html += ' <div class="list-group mb-3">'; list.forEach(function(item, i) { className = item == 'correct' ? 'success' : 'danger'; if (!type || type == 'common') { html += '<a href="#" onclick="javascript:backToChallenge('+(i-1)+', \'result\', \'common\');" class="list-group-item list-group-item-action list-group-item-'+className+'">'+replaceBBCode(questions.used[i-1].name)+'</a>'; } else { if (type == item) { html += '<a href="#" onclick="javascript:backToChallenge('+(i-1)+', \'result\', \''+item+'\');" class="list-group-item list-group-item-action list-group-item-'+className+'">'+replaceBBCode(questions.used[i-1].name)+'</a>'; } } }); if (type == 'correct' || type == 'wrong') { var answered = type == 'correct' ? 'correctly' : 'incorrectly'; var message = 'Questions answered ' + answered + ' not found.'; if (summary[type].length == 0) { html += '<div class="alert alert-warning mb-2" role="alert">' + message + '</div>'; } } html += ' </div>'; html += ' <div class="col text-center mb-3">'; html += ' <button id="exam-results" onclick="javascript:renderExamResult();" class="btn btn-secondary">' + getMessage('back_to_result', 'Back to exam result') + '</button>'; html += ' </div>'; html += '</div>'; html += '</div>'; // renderElement('.result', result + '<p class="advice">' + advice + '</p>' + html); renderElement('.result', html); state = 'exam_result_rendered'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "IsFinishedRendering() {}", "function renderFinalResult() {\n //console.log('Final result is being rendered');\n $('.result').html(generateFinalResult());\n}", "function doSomethingAfterRendering(){\n displayLoading() // 로딩화면 보여주기\n fetchServer(); // 서버에서 데이터 가져오기\n }", "renderNext() {\n\n ...
[ "0.6547684", "0.6517691", "0.6343127", "0.6313358", "0.6146963", "0.6133606", "0.6118089", "0.59932953", "0.5951353", "0.5951353", "0.5895151", "0.587132", "0.587132", "0.5853065", "0.5828799", "0.58244926", "0.58150434", "0.5798163", "0.5760096", "0.5741008", "0.574051", "...
0.5662912
26
When the user starts the quiz the following will happen
function startTheQuiz(event) { // Console registers the button click console.log("button-click"); // Sets the 'hide' attribute to the instructionPage to render it invisible instructionsPageEl.setAttribute("class", "hide"); // Removes the 'hide' attribute to the quiz questions to make them visible revealQuiz.removeAttribute("class"); // Sets the css styling to the questions revealQuiz.setAttribute("class", "question-container "); // Display questions displayQuestions(); // Begin the countdown on the timer timerInterval = setInterval(beginCountDown, 1000) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startQuiz () {}", "function handleQuiz() {\n startQuiz();\n handleAnswers();\n nextQuestion();\n restartQuiz();\n}", "function startQuiz() {\n $landing.remove()\n $content.prepend($question)\n startTimer()\n nextQuestion()\n }", "function startQuiz() {\n ...
[ "0.7631363", "0.74026304", "0.7196005", "0.7114977", "0.7096575", "0.7084622", "0.7072316", "0.70604944", "0.70404375", "0.70265174", "0.7002061", "0.6925727", "0.6911931", "0.6910664", "0.6845653", "0.6842675", "0.6826532", "0.68139637", "0.67937136", "0.67902374", "0.678844...
0.0
-1
The countdown timer functionality
function beginCountDown() { // Countdown by the interval indentified in timerInterval time--; // When the time runs out (i.e. reaches zero) do the following... if (time <= 0) { playerScoreEl.textContent = score + "/" + questionsList.length; // Remove the 'hide' css class to display the store score page storeScore.removeAttribute("class"); // Apply the css styling to the store score page storeScore.setAttribute("class", "store-container"); // Clear the timer clearInterval(timerInterval); // Set timer to zero time = 0; // Reapply 'hide' css class to make the quiz section invisible revealQuiz.setAttribute("class", "hide"); }; // Display time left as a text value in the timer element of the html timeLeftelement.textContent = time; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countDownTimer() {\n\n // Figure out the time to launch\n timeToLaunch();\n\n // Write to countdown component\n $(\"#days .timer-number\").text(days);\n $(\"#hours .timer-number\").text(hrs);\n $(\"#minutes .timer-number\").text(min);\n $(\"#seconds .timer-...
[ "0.8190231", "0.8184831", "0.7932729", "0.7911588", "0.78903395", "0.78064907", "0.7792165", "0.776902", "0.77527094", "0.7746211", "0.77241665", "0.77108943", "0.7673265", "0.7661267", "0.7653265", "0.7647084", "0.76440513", "0.7642752", "0.76382565", "0.76183826", "0.759461...
0.0
-1
Function to display the list of questions
function displayQuestions() { // Define the current question as the question the question highlighted by the index "pointer" var currentQuestion = questionsList[currentQuestionIndex]; // Log the question selected from the array for display in console console.log(currentQuestion); // Render selected question to question element in the html questionDiv.textContent = currentQuestion.question; // Render corresponding question answers to buttons based on index answerAbutton.textContent = currentQuestion.answers[0]; answerBbutton.textContent = currentQuestion.answers[1]; answerCbutton.textContent = currentQuestion.answers[2]; answerDbutton.textContent = currentQuestion.answers[3]; // // // Onclick event checkAnswer answerAbutton.onclick = checkAnswer; answerBbutton.onclick = checkAnswer; answerCbutton.onclick = checkAnswer; answerDbutton.onclick = checkAnswer; // Log player response in the console console.log(answerAbutton.onclick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestions() {\n //gets the current question from global variable currentQuestion\n // display a question\n currentQuestion++;\n $(\".questions\").text(triviaQuestions[currentQuestion].questions);\n }", "function displayQuestionsAndAnswers(questionsList) {\n\n\tdispl...
[ "0.7728403", "0.76283187", "0.75002", "0.7418989", "0.7409846", "0.738368", "0.73158026", "0.7313801", "0.72930115", "0.7276038", "0.72704273", "0.7252555", "0.7235857", "0.7221486", "0.7220048", "0.71926653", "0.7142348", "0.71397704", "0.71376187", "0.712726", "0.7123401", ...
0.0
-1
Create a function to store intials and score
function savePlayerScoreInitials(event) { // Prevent he page from refreshing and losing the data event.preventDefault(); // Register the button click console.log("button-click"); // Create a variable to use the input initials var playerInitials = document.getElementById("initialsForm"); // Log the form value for dislpay console.log(playerInitials.value); // If player does not submit their intials prompt them to do so if (playerInitials.value === "") { // Alert displays message to input initials alert("Please submit intials."); // If initials form is not empty or blank, then the player can save score } if (playerInitials.value !== "") { // Create a currentScore object to which tells the browser what to place in local storage var currentScore = { score: score, initials: playerInitials.value }; //Display currentScore in the console for viewing console.log(currentScore); // getlocalStorageItem, new variable to hold value var highscores = // Retrieve the data from the DOM JSON.parse(window.localStorage.getItem("high-score-list")) || []; // Adding the new player score highscores.push(currentScore); // Combiming old and new players scores and adding them to storage window.localStorage.setItem("high-score-list", JSON.stringify(highscores)); // Move to the highscore page window.location.href = "./highscorepage.html"; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scoreAnswers(){}", "function getScore(){\n return score\n}", "function Score() { }", "function getScore() {\n num1 = 2,\n num2 = 3;\n\n function add() {\n return name + ' scored ' + (num1 + num2);\n }\n\n return add();\n}", "posibleScores(){\n\n }", "function addScore(answe...
[ "0.684514", "0.6830317", "0.68151903", "0.65294975", "0.65251535", "0.6519645", "0.64931375", "0.64818865", "0.64371014", "0.6414867", "0.6410893", "0.6407935", "0.6353215", "0.62757456", "0.62686324", "0.62683886", "0.6227815", "0.6218472", "0.6216511", "0.6202789", "0.61738...
0.0
-1
Constructor Sets type of template to 'BodyTemplate1'
constructor() { super(); this.type = 'BodyTemplate7'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n super(template);\n }", "constructor(templateInfo){\n\t\tthis.templateInfo = templateInfo;\n\t}", "constructor (template, name) {\n\t\tif (template instanceof DataType) {\n\t\t\tthis.type = template;\n\t\t\tthis.name = null;\n\t\t\tthis.modelName = null;\n\t\t\tthis.model = null;\n\t...
[ "0.6243404", "0.61946875", "0.59188026", "0.5787224", "0.5734301", "0.5619204", "0.5606267", "0.55844307", "0.5459901", "0.5402338", "0.535991", "0.53564686", "0.52782893", "0.52664226", "0.5236249", "0.52264607", "0.52166456", "0.52106637", "0.5204904", "0.5188302", "0.51694...
0.7914559
0
Add departments, roles, employees View departments, roles, employees Update employee roles
function menu() { inquirer.prompt([{ type: "list", message: "what would you like to do?", choices: ["add departments", "add roles", "add employees", "view departments", "view roles", "view employee", "update employee roles"], name: "selection" }]).then(function (userInput) { switch (userInput.selection) { case "add departments": addDepartment() break case "add roles": addRole() break case "add employees": addEmployee() break case "view departments": viewDepartments() break case "view roles": viewRoles() break case "view employee": viewEmployee() break case "update employee roles": updateEmployeeRole() break } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor (AllEmployeeName,AllEmployeeDepartment,AllEmployeeByManager,AddEmployee,\n RemoveEmployee,UpdateEmployeeRole,UpdateEmployeeManager)\n {\n this.AllEmployeeName = AllEmployeeName\n this.AllEmployeeDepartment = AllEmployeeDepartment\n this.AllEmployeeByManager = AllEmployeeB...
[ "0.66058195", "0.63354146", "0.62910527", "0.6278551", "0.6240448", "0.6224264", "0.6140536", "0.6105456", "0.60995615", "0.6017961", "0.59728533", "0.59688604", "0.59678864", "0.59516704", "0.5938653", "0.59094274", "0.59014827", "0.58938515", "0.5877086", "0.5875699", "0.58...
0.0
-1
la funcion handleRegister llega desde navBar container como props y hace que se cierre el modal si esta abierto y que se abra si esta cerrado!!!!
render() { return ( <div> <RegisterModal handleSubmit={this.handleSubmit} handleRegister={this.props.handleRegister} handleChanges={this.handleChanges} /> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleRegister() {\n navigation.navigate('SignUp');\n }", "function handleRegister(e) {\n\n e.preventDefault();\n\n if (!setPassword || !setConfirmpass || !setEmail || !setCellPhone || !setAddress || !setCountry || !setName || !setLastName) {\n setTimeout((e) => {\n ...
[ "0.6718139", "0.6576076", "0.6424759", "0.63756156", "0.62653357", "0.6224625", "0.6192854", "0.6126806", "0.60798216", "0.60772437", "0.6074369", "0.6027761", "0.6012791", "0.59998065", "0.59851015", "0.5923791", "0.592197", "0.59067184", "0.586691", "0.58664876", "0.5865402...
0.6579263
1
function to set value and formula of clicked cell
function setCell(v, currFormula) { let address = addressInput.value; let cell = getClickedCell(); cell.innerText = v; let { rid, cid } = getValueOfRC(address); sheetDB[rid][cid].value = v; sheetDB[rid][cid].formula = currFormula; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickCell(ref) {\n //var rcArray = ref.id.split('_'); \n // alert(\"You selected row \" + rcArray[0] + \" and column \" + rcArray[1]);\n\n //Set Colour of previous id back to the rest of the grid\n document.getElementById(prevSelect).style.background = \"#C3DAF9\";\n\n //Set Colour of se...
[ "0.70288885", "0.67332155", "0.6292799", "0.62528706", "0.62113047", "0.6206088", "0.6190872", "0.6190872", "0.61873597", "0.618615", "0.615176", "0.59196335", "0.589872", "0.58873296", "0.58755124", "0.58435076", "0.5790213", "0.57709265", "0.5769433", "0.5758778", "0.571956...
0.74177825
0
to set parents of curr cell (which we got from formula)
function setParents(currFormula) { let arr = currFormula.split(" "); for (let i = 0; i < arr.length; i++) { let c = arr[i].charCodeAt(0); // if it starts from A-Z if (c >= 65 && c <= 90) { let { rid, cid } = getValueOfRC(arr[i]); // address nikala and then putted it in children array sheetDB[rid][cid].children.push(addressInput.value); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setParentCHArray(formula, chAddress) {\r\n let formulaTokens = formula.split(\" \");\r\n for (let i = 0; i < formulaTokens.length; i++) {\r\n let ascii = formulaTokens[i].charCodeAt(0);\r\n // ascii valid or not\r\n if (ascii >= 65 && ascii <= 90) {\r\n let { rid, cid...
[ "0.6189308", "0.58609384", "0.58184016", "0.5812562", "0.58069843", "0.5588556", "0.55669147", "0.5478237", "0.54714036", "0.54548585", "0.5436084", "0.5433979", "0.537615", "0.5358216", "0.5354825", "0.53545636", "0.5304146", "0.52902573", "0.52790225", "0.52786595", "0.5272...
0.708428
0
to evaluate the Formula
function evaluate(currFormula) { let arr = currFormula.split(" "); for (let i = 0; i < arr.length; i++) { let c = arr[i].charCodeAt(0); if (c >= 65 && c <= 90) { let { rid, cid } = getValueOfRC(arr[i]); arr[i] = sheetDB[rid][cid].value; } } let newFormula = arr.join(" "); return eval(newFormula); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Evaluate() {\n var formula = document.getElementById('FormulaDisplay').getElementsByTagName('span')[0].innerHTML;\n if (formula == \"Formula\") {\n return;\n }\n\n var status = document.getElementById('AlgoSwitchBtn').innerHTML;\n var ret = 0;\n if (status == \"eval()\") {\n ret = EvaluateWith...
[ "0.72837645", "0.7181563", "0.708325", "0.69951546", "0.6898795", "0.6894564", "0.679737", "0.6783374", "0.67771614", "0.667763", "0.6651325", "0.66241294", "0.6570554", "0.6422185", "0.64049196", "0.63947386", "0.6379637", "0.6326924", "0.6318592", "0.63140136", "0.6299109",...
0.6699116
9
dfs call to update every cell
function updateChildren(currCell) { let chArray = currCell.children; for (let i = 0; i < chArray.length; i++) { let childAddress = chArray[i]; let { rid, cid } = getValueOfRC(childAddress); let v = evaluate(sheetDB[rid][cid].formula); // updating value sheetDB[rid][cid].value = v; let childCell = document.querySelector(`.cell[rid="${rid}"][cid="${cid}"]`); childCell.innerText = v; updateChildren(sheetDB[rid][cid]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCells() {\n\t\t\tconsole.log('Updating cells')\n\t\t\tfor(i = 0; i < maxRow; i++) {\n\t\t\t\tfor(j = 0; j < maxCol; j++) {\n\t\t\t\t\tcellID = j+'_'+i;\n\t\t\t\t\tif(cells[cellID].state != cells[cellID].nextState) { // change in the cell\n\t\t\t\t\t\tconsole.log('Change in cell state detected.')\n\t...
[ "0.6287326", "0.61173844", "0.5994043", "0.59815717", "0.59409595", "0.5829536", "0.5827112", "0.57655126", "0.5762216", "0.57593155", "0.57492024", "0.5748371", "0.5731793", "0.5723411", "0.57179344", "0.57172775", "0.5710803", "0.5692366", "0.56762636", "0.56698537", "0.566...
0.58022827
7
Berechnet Wege und Distanzen und Sichtlinien
function calculatePath (startIndex, endIndex, onlyMeasure = false) { // startIndex ist der Index im TileArray von dem der Pfad startet // endIndex ist der Index im TileArray zu dem der Pfad geht // onlyMeasure = true begrenzt den Pfad nicht auf die maximale Bewegungsweite während einem Kampf let mappedList = []; let frontierList = []; let frontierListValues = []; let activeNode; let pathFound = false; let pathToTravel = []; let distance = 0; //Fange Ausnahmen ab startIndex = endIndex if (startIndex == endIndex || endIndex == undefined) { return { first: pathToTravel, second: distance } } // finde A und füge ihn der frontierList hinzu {name, wayPointUsefulness} tileArray[startIndex].entryPoint = "Start"; tileArray[startIndex].distanceTravelled = 0; tileArray[startIndex].wayPointUsefulness = tileArray[startIndex].distanceTravelled + tileArray[startIndex].estimatedWayToB(endIndex); tileArray[startIndex].difDegree = Phaser.Math.Angle.BetweenPoints(tileArray[startIndex], tileArray[endIndex]); frontierList.push(tileArray[startIndex]); // gehe folgende Schleife solange durch bis es einen Weg gibt while (pathFound == false) { // Wenn kein Weg möglich ist brich diese Schleife ab if (frontierList.length == 0) { pathToTravel = []; break; } // gehe frontierList durch nach niedrigster wayPointUsefulness + Tiebreaker (geringster Winkelunterschied zur Luftlinie) frontierListValues.length = 0; for (let i = 0; i < frontierList.length; i++) { let difDegree = Math.abs(Phaser.Math.Angle.ShortestBetween(tileArray[startIndex].difDegree, frontierList[i].difDegree))/1000; frontierListValues.push(frontierList[i].wayPointUsefulness + difDegree); } activeNode = frontierListValues.indexOf(Math.min(...frontierListValues)); // Wenn Knoten mit Niedrigster wayPointUsefulness schon das Ziel ist, ist A* fertig if (frontierList[activeNode].name == endIndex) { pathFound = true; // unterbricht diese Schleife und damit das Pfadsuchen let backtraceIndex = endIndex; // Sucht den Index des Zielfeldes pathToTravel.unshift(backtraceIndex); // Fügt das Zielfeld dem Pfad hinzu while (tileArray[tileArray[backtraceIndex].entryPoint].name != startIndex) { pathToTravel.unshift(tileArray[backtraceIndex].entryPoint); backtraceIndex = tileArray[backtraceIndex].entryPoint; } break; } // berechne für diesen alle neighbors frontierList[activeNode].checkForNeighbors(); // Füge Neighbors des aktuellen Knotens der Frontierlist hinzu for (let i = 0; i < frontierList[activeNode].neighbors.length; i++) { let distanceTravelled = frontierList[activeNode].distanceTravelled + frontierList[activeNode].neighborsDistance[i]; if (containsObject(frontierList[activeNode].neighbors[i], frontierList)) { if (distanceTravelled < frontierList[activeNode].neighbors[i].distanceTravelled) { frontierList[activeNode].neighbors[i].distanceTravelled = distanceTravelled; frontierList[activeNode].neighbors[i].wayPointUsefulness = frontierList[activeNode].neighbors[i].distanceTravelled + frontierList[activeNode].neighbors[i].estimatedWayToB(endIndex); frontierList[activeNode].neighbors[i].entryPoint = frontierList[activeNode].name; } } else if (containsObject(frontierList[activeNode].neighbors[i], mappedList)) { continue; } else { frontierList[activeNode].neighbors[i].distanceTravelled = frontierList[activeNode].distanceTravelled + frontierList[activeNode].neighborsDistance[i]; frontierList[activeNode].neighbors[i].wayPointUsefulness = frontierList[activeNode].neighbors[i].distanceTravelled + frontierList[activeNode].neighbors[i].estimatedWayToB(endIndex); frontierList[activeNode].neighbors[i].entryPoint = frontierList[activeNode].name; frontierList[activeNode].neighbors[i].difDegree = Phaser.Math.Angle.BetweenPoints(frontierList[activeNode].neighbors[i], tileArray[endIndex]) frontierList.push(frontierList[activeNode].neighbors[i]); } } // Füge den aktiven Knoten der mappedList hinzu und Lösche den aktven Knoten aus der frontierList mappedList.push(frontierList[activeNode]); frontierList.splice(activeNode,1); } // wenn gerade ein Kampf ist soll die Bewegung begrenzt sein auf die Maximale Bewegungsweite des aktiven Charakters if (fightmode == true && onlyMeasure == false) { movementStopper: for (let l = 0; l < pathToTravel.length; l++) { if (tileArray[pathToTravel[l]].distanceTravelled > activeChar.movementCounter) { pathToTravel.length = l; break movementStopper; } } } // wenn das Ziefeld der Bewegung besetzt ist, wird die Bewegung gekürzt checkEnd: while (pathToTravel.length > 0) { if (checkFor (tileArray[pathToTravel[pathToTravel.length-1]].occupiedBy, Figure) || checkFor (tileArray[pathToTravel[pathToTravel.length-1]].occupiedBy, Enemy)) { pathToTravel.length = pathToTravel.length-1; } else { break checkEnd; } } // speichert die Entfernung bis zum Ende des Pfades if (pathToTravel.length > 0) { distance += tileArray[pathToTravel[pathToTravel.length-1]].distanceTravelled; } // räumt alle Tiles wieder auf clearNodes(); return { first: pathToTravel, second: distance } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wechselAnsicht(){\n\t\tif(ansichtsWechsel){\n\t\t\tschalteKlassen();\n\t\t\tansichtsWechsel = false;\n\t\t}\n\t\telse {\n\t\t\tschalteKlassen();\n\t\t\tansichtsWechsel = true;\n\t\t}\n\t}", "function doesburgRuimZichtTrein(){\r\n \r\n that.MIDDEN.removeEventListener(\"doesburgRuimZ...
[ "0.6026772", "0.59223944", "0.5921918", "0.5854884", "0.5821017", "0.5817643", "0.57714784", "0.576244", "0.57589287", "0.57547605", "0.57545835", "0.5685373", "0.56742775", "0.55853194", "0.55574757", "0.5556815", "0.55312705", "0.55082744", "0.5495807", "0.549186", "0.54896...
0.0
-1
ZmProfileUserCtrl is use to retrieve user list from services
function ZmProfileUserCtrl(zmUserService) { var vm = this; var vm.viewMode = true; var about = {}; //Method vm.deleteUser = deleteUser; vm.addUser = addUser; zmUserService.readListOfUser(function(data){ vm.contacts = data; }); /** * @name deleteUser * @param index,id * @description Delete user from list * @return success or failure of deleted user */ function deleteUser(index,id){ zmUserService.deleteUser(id,function(data){ if(data.status==true){ angular.forEach(contacts, function(value, key) { if(value['userid']==id){ contacts.splice(i,1); } }) } }); } /** * @name addUser * @param addUserData // this is an object of user data * @description Add user in list * @return new added user data */ function addUser(addUserData){ zmUserService.addUser(addUserData,function(data){ vm.contacts = data; }); } /** * @name readUser * @param id * @description read user detail * @return user details */ function readUser(id){ viewMode = false; zmUserService.readUser(id,function(data){ vm.about.contact = data ; }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetUsers() {\n UserApi.getUser().then(function (response) {\n $scope.user = response.data;\n }), function () {\n aler(\"Unable to load users info\");\n }\n }", "function getProfileData() {\n // obtener los datos del usuario al iniciar sesión\n IN.A...
[ "0.6907308", "0.6850841", "0.6767247", "0.6745933", "0.6708694", "0.6661176", "0.6640582", "0.66327035", "0.66024053", "0.6586556", "0.6576485", "0.6571571", "0.65334123", "0.6475877", "0.6473198", "0.64632905", "0.64446497", "0.6444295", "0.6443883", "0.64241606", "0.6419983...
0.72267175
0
makes list out of array
function MakeList(array,string) { var list = document.createElement('ul'); list.setAttribute("id","main-list-text") for (var i = 0; i < array.length; i++) { var item = document.createElement('li'); item.setAttribute("class","list-item"); var pic = document.createElement('img'); pic.setAttribute("class","list-image") pic.src = i + '.jpg'; item.appendChild(pic); var name = document.createTextNode(array[i][0]); item.appendChild(name); item.appendChild(document.createTextNode(" - ")); var description = document.createTextNode(array[i][1]); item.appendChild(description); item.appendChild(document.createTextNode(" Price: $")); var price = document.createTextNode(array[i][2]); item.appendChild(price); var button = document.createElement("button"); button.setAttribute("class","cart-button"); button.innerHTML = "Add to cart"; button.onclick = function(){AddToCart(item)}; item.appendChild(button); list.appendChild(item); } return list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ex_array2list(array) {\n var list = null;\n for (var i = array.length - 1; i >= 0; i--) {\n list = {\n value: array[i],\n rest: list\n };\n }\n\n return list;\n}", "function arrayToList() {\n\n}", "function listToArray() {\n\n}", "function arrayToList(input) {\n var list = nul...
[ "0.7719182", "0.7689467", "0.72997934", "0.72427326", "0.721595", "0.7184993", "0.717856", "0.7172836", "0.713598", "0.70843476", "0.70741373", "0.7028002", "0.7020976", "0.7017312", "0.70139974", "0.70139974", "0.70139974", "0.70139974", "0.70139974", "0.699273", "0.6991291"...
0.0
-1
Note: LocalStorage converts the value to string We are using empty string as a marker for null/undefined values.
function save(storage, name, value) { var key = propsPrefix + name; if (value == null) value = ''; storage[key] = value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSavedValue(v) {\n if (typeof(Storage) !== \"undefined\") {\n if (!localStorage.getItem(v)) {\n return \"\";// You can change this to your defualt value.\n }\n return localStorage.getItem(v);\n }\n else {\n console.log(\"Sorry, your browser does not support web storage...\");\n }\...
[ "0.73474133", "0.70992845", "0.70069605", "0.6979284", "0.6904166", "0.6892429", "0.6872708", "0.6823086", "0.6807765", "0.67978907", "0.67918617", "0.67007184", "0.6696803", "0.6666163", "0.66422147", "0.6616094", "0.66032463", "0.6600857", "0.65549135", "0.6551202", "0.6548...
0.6099296
98
Function for build main window for gallery (with photo)
function buildWithMiniGallery() { for (photoIndex = 0; photoIndex < miniPhoto.length; photoIndex++){ urlmin = miniPhoto[photoIndex]; let urlOriginal =urls[photoIndex]; photo = document.createElement('div'); photo.style.backgroundImage = 'url(' + urlmin + ')'; photo.classList.add('photo'); photo.url = urlOriginal; photo.type = 'image'; photo.addEventListener( 'click', function () { // Keep one panorama if ( panorama ) { return; } // Dynamically generate panorama if ( this.type === 'image' ) { panorama = new PANOLENS.ImagePanorama( this.url ); } else if ( this.type === 'video' ) { panorama = new PANOLENS.VideoPanorama( this.url, { autoplay: true } ); } else { return; } panorama.addEventListener( 'progress', function ( event ) { progress = event.progress.loaded / event.progress.total * 100; progressBar.style.width = progress + '%'; if ( progress === 100 ) { progressBar.style.opacity = 0; } }); viewer.add( panorama ); panoramaContainer.classList.add( 'open' ); }, false ); galleryContainer.appendChild(photo); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initiateApp(){\n\t/*BONUS FUNCTIONALITY: add jquery sortable call here to allow resorting of the images\n\t\t//on change, rebuild the images array into the newly sorted order\n\t\tDocumentation: http://api.jqueryui.com/sortable/\n\t\tExample or sorting in action: https://jqueryui.com/sortable/\n\t*/\n\tma...
[ "0.67850745", "0.67161065", "0.6709732", "0.6516482", "0.6490064", "0.64112794", "0.6366736", "0.6345432", "0.6326202", "0.6316291", "0.6279892", "0.62481153", "0.6246578", "0.6220746", "0.6164861", "0.615947", "0.6112987", "0.606816", "0.6043015", "0.60337114", "0.60283357",...
0.6103071
17
Setup container for image panorama
function setupPanolens() { viewer = new PANOLENS.Viewer({container: mainContainer}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\t\t\tif (!container) return;\n\t\t\trequestImages();\n\t\t\tbuildLayout();\n\t\t}", "_initContainer() {\n this._element.classList.add('carousel');\n\n this._element.append(this._createContainerHeader());\n\n this._cardsContainer = this._createContainerContent();\n ...
[ "0.6269188", "0.60151124", "0.5990365", "0.5983682", "0.59760267", "0.5749327", "0.57397646", "0.57266194", "0.5720707", "0.57166696", "0.5680916", "0.560975", "0.5598776", "0.55916435", "0.5560125", "0.5541513", "0.55287504", "0.5515471", "0.5508581", "0.5500087", "0.5494124...
0.61522496
1
Function for dispose image from viewer
function disposePanorama() { panorama.dispose(); viewer.remove(panorama); panorama = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_close() {\n this.attachmentViewer.close();\n }", "function closePreview() {\n\n if (dom.preview) {\n dom.preview.setAttribute('src', '');\n dom.preview.parentNode.removeChild(dom.preview);\n dom.preview = null;\n }\n\n }", "dispose() {\n previ...
[ "0.6884756", "0.6531087", "0.6528546", "0.64235795", "0.6351768", "0.63494164", "0.6151829", "0.6151829", "0.6151829", "0.6151829", "0.6151829", "0.6124591", "0.610524", "0.609266", "0.6083179", "0.60512644", "0.6016726", "0.6004432", "0.5947265", "0.5941945", "0.5918436", ...
0.63185453
6
Write a simple closure of your own creation. Keep it simple!
function Sekai() { console.log('This is the World we live in now'); const monsters = "We're attacked all the time"; const factions = 'We protect each other, that is how we survive!' function status() { const fighting = `working on a mission, but ${monsters}`; const living = `sitting inside the wall that was build to keep on ${factions}`; console.log(`this is a ruff existence ${fighting} for our lives`); function change() { const live = 'relax and live a peaceful wonderful life'; console.log(`one day we will live in a world where ${living} changes and we can actually just ${live}`); }; change() }; status() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makefunc(x) {\r\n// return function() { return x; }\r\n// return new Function($direct_func_xxx$);\r\n return new Function(\"return x;\")\r\n}", "function closureOfYourOwnCreation() {\n let name = \"Russ\";\n function greetme() {\n return \"my name is \" + name;\n };\n return greetme();\n}"...
[ "0.7312501", "0.7298056", "0.720971", "0.704959", "0.6895199", "0.68849075", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6884829", "0.6762497", "0.6741086", "0.6741086", "0.6677295", "0.66642284", "0.6662686", "...
0.0
-1
play audio for example( text to speak) VI author :manh quoc since 15/05/2014
function playExampleVi(text) { var audio = new Audio(); audio.src = 'http://www.vnspeak.com/speakit.php?txt=' + text; audio.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function play(text){\n const utterance = new SpeechSynthesisUtterance(text);\n utterance.rate = 1;\n utterance.pitch = 1;\n speechSynthesis.speak(utterance);\n}", "function speak(text){\n //micInstance.stop();\n var params = {\n text: text,\n voice: config.TextToSpeech.voice,\n ...
[ "0.7800973", "0.7701055", "0.76497346", "0.7584689", "0.7577453", "0.74940395", "0.7481287", "0.7474552", "0.74637717", "0.7413998", "0.7382842", "0.73822683", "0.73559296", "0.7350704", "0.73222005", "0.7297825", "0.72805077", "0.726676", "0.7249282", "0.72331136", "0.723187...
0.8273581
0
play audio for vocabulary VI author :manh quoc since 15/05/2014
function playSound(link_sound) { var audio = new Audio(); audio.src = link_sound; audio.play(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function playExampleVi(text) {\n var audio = new Audio();\n audio.src = 'http://www.vnspeak.com/speakit.php?txt=' + text;\n audio.play();\n}", "function speakVO(){\n var audio = new Audio('../../asset/VOfiles/PerspectivesVO_minigameoverview.wav');\n audio.volume = 1;\n audio.play()\n}", "func...
[ "0.755609", "0.7266116", "0.6969187", "0.6906913", "0.6843901", "0.6825436", "0.6771817", "0.67580813", "0.6755751", "0.672183", "0.6692583", "0.66786754", "0.6678258", "0.6643091", "0.6611351", "0.6608474", "0.65847903", "0.65493417", "0.6524302", "0.6513881", "0.65008575", ...
0.0
-1
ajax get vocabulary by id VI author :manh quoc since 16/05/2014
function get_word_vi(id){ $.ajax({ url: '/get_word_vi.json', contentType: "application/json; charset=utf-8", data:{id:id}, dataType:'json', success: function(data) { length = data.length; var text=""; var word = data[0]; text +='<div class="vocabulary">'+word.word_vietnamese+'</div>'; if(word.sound_word && word.sound_word!=""){ text +='<a href="javascript:void(0)" onclick="playSound(\'/vietnamese/'+word.sound_word+'\');">'; text +='<img src="/images/icon_sound.ico" class="img_sound">'; text +='</a>'; } text +='<br>'; text+='<ul>'; var translates = data[1]; var ts_length= translates.length; for (var i = 0; i<ts_length; i++){ text+='<li>'+translates[i]+'</li>'; } text+='</ul>'; $("#word").html(text); set_tbdy_ex(data[2]); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetExampleSentencesForVocabulary(vocabulary, complete) {\n $('section#example-sentences-section').detach();\n $.get('https://jeshuam.pythonanywhere.com/wanikani-sentences/' + vocabulary, complete);\n }", "function getVocab(jsonurl,dropdown){\n\t$(dropdown).html('');\n\tvar xmlhttp = new...
[ "0.67540085", "0.63091654", "0.6293923", "0.6053257", "0.59211355", "0.59023136", "0.58762443", "0.58736396", "0.58509284", "0.58041173", "0.5735589", "0.5730386", "0.5685226", "0.5619698", "0.5609453", "0.5592281", "0.55850494", "0.55677813", "0.5558895", "0.55414975", "0.55...
0.625001
3
ajax get vocabulary by id JA author :manh quoc since 16/05/2014
function get_word_ja(id){ $.ajax({ url: '/get_word_ja.json', contentType: "application/json; charset=utf-8", data:{id:id}, dataType:'json', success: function(data) { length = data.length; var text=""; var word = data[0]; text +='<div class="vocabulary">'+word.word_japanese+'</div>'; if(word.sound_word && word.sound_word!=""){ text +='<a href="javascript:void(0)" onclick="playSound(\'/vietnamese/'+word.sound_word+'\');">'; text +='<img src="/images/icon_sound.ico" class="img_sound">'; text +='</a>'; } text +='<br>'; text+='<ul>'; var translates = data[1]; var ts_length= translates.length; for (var i = 0; i<ts_length; i++){ text+='<li>'+translates[i]+'</li>'; } text+='</ul>'; $("#word").html(text); set_tbdy_ex(data[2]); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function GetExampleSentencesForVocabulary(vocabulary, complete) {\n $('section#example-sentences-section').detach();\n $.get('https://jeshuam.pythonanywhere.com/wanikani-sentences/' + vocabulary, complete);\n }", "function getVocab(jsonurl,dropdown){\n\t$(dropdown).html('');\n\tvar xmlhttp = new...
[ "0.67844725", "0.6462619", "0.6391545", "0.6305669", "0.6129021", "0.6089749", "0.6069965", "0.59455967", "0.5925337", "0.5914498", "0.5844768", "0.58181155", "0.5804807", "0.5725558", "0.5696323", "0.569487", "0.56375164", "0.5604902", "0.5601568", "0.55952215", "0.5587784",...
0.5889572
10
set data for table example author :manh quoc since 16/05/2014
function set_tbdy_ex(ex){ var length = ex.length; var text = ''; if (length>0){ for(var i = 0; i<length; i++){ text+='<tr>'; text+='<td>'+ex[i].ex_japanese+'<a onclick="playExampleJa(\''+ex[i].ex_japanese+'\');" href="javascript:void(0)"><img class="img_sound" src="/images/sound-on.png" ></a></td>'; text+='<td>'+ex[i].ex_vietnamese+'<a onclick="playExampleVi(\''+ex[i].ex_vietnamese+'\');" href="javascript:void(0)"><img class="img_sound" src="/images/sound-on.png" ></a></td>'; text+='</tr>'; } } $("#body_example").html(text); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setTable() {\r\n\r\n\r\n }", "function initTable(meta_id, ethnicity, gender, age, location, bbtype, wfreq) {\n var table = d3.select(\"#sample-metadata\");\n table.append(\"tbody\").text(\"ID: \" + meta_id[0]);\n table.append(\"tbody\").text(\"Ethnicity: \" + ethnicity[0]);\n tabl...
[ "0.6968699", "0.6912302", "0.6870353", "0.6842698", "0.6724879", "0.6716793", "0.6706567", "0.6659363", "0.66073364", "0.65850055", "0.6552198", "0.6542589", "0.6536317", "0.65273154", "0.6488279", "0.6472285", "0.6452759", "0.6451714", "0.6401292", "0.6357701", "0.63514364",...
0.0
-1
groupsAll: Group[] = [];
function GroupListComponent(groupsService) { this.groupsService = groupsService; this.GroupsCount = 1; this.groups = []; this.isLoading = false; this.totalGroups = 0; this.groupsPerPage = 10; this.currentPage = 1; this.pageSizeOptions = [10, 20, 50, 100]; this.filterByTitle = true; this.filterByDesc = true; this.filterByImage = true; this.groups = []; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getGroups() {\n return [ ...this.groups ];\n }", "constructor(groups = []) {\n this.groups = groups;\n }", "function all() {\n\t if (resetNeeded) reset(), resetNeeded = false;\n\t return groups;\n\t }", "addgroup(group)\n {\n this.groupList.push(group);\n }", "co...
[ "0.7629767", "0.6949085", "0.6657869", "0.6603317", "0.6547434", "0.654111", "0.64273477", "0.6414482", "0.621242", "0.61276823", "0.6113712", "0.60587543", "0.60575503", "0.60473436", "0.59694403", "0.59603816", "0.5958502", "0.5928393", "0.5918536", "0.5913152", "0.5911011"...
0.0
-1
Promise.all waits for all fulfillments (or the first rejection).
function All(promiseArray) { return new Promise(function(resolve,reject) { var args = Array.prototype.slice.call(promiseArray); var results = [] if(args.length === 0) return resolve(results); var remaining = args.length; function res(i,val) { if(val && (typeof val === 'object' || typeof val === 'function') ) { var then = getThen(val); if(typeof then === 'function') { // console.log("then is a function", val.state) // while(val.state === PENDING) { //// console.log("waiting") // //wait // } //hey already fulfilled, yowzers. no need to call then if(val.state === FULFILLED) { // console.log("case 1") args[i] = val.value; if (--remaining === 0) { resolve(args); } return; } if(val.state === REJECTED) { // console.log("case 2") reject(val.value); } //if promise succeeded, add its value to args , otherwise call the main reject val.then(function(val) { // console.log("calling then success", val) args[i] = val; //succeed makes remaining go down by 1. if we hit 0, we have resolved the main promise!! if (--remaining === 0) { resolve(args); } // res(i,val.value); } , reject) } else { args[i] = val.value; if (--remaining === 0) { resolve(args); } return; } } } for(var i = 0; i < args.length; ++i){ res(i, args[i]) } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function All(promises) {\n return new Promise((resolve, reject) => { // this line is used to return new promise\n let count = promises.length;\n\n function nextPromise() {\n if (--count === 0) resolve('done');\n } // call resolve when all the promises are done\n promises.f...
[ "0.7260185", "0.70084006", "0.69186074", "0.67234796", "0.6679983", "0.6603845", "0.6443431", "0.6301312", "0.6289097", "0.627264", "0.6238128", "0.6202523", "0.61139196", "0.6094278", "0.6059812", "0.6014387", "0.5986338", "0.5950519", "0.5946129", "0.5946129", "0.5946129", ...
0.73166996
0
CARREGAMENTO DE IMAGEM EM TELA, APOS SALVA
function carregarImagem( img ){ var caminho = img.substr(51); carregar = new Image(); carregar.src = "/gestaopessoas/fwk/uploads/imagens/" + caminho; document.getElementById("imagemView").innerHTML = "Carregando..."; setTimeout( "verificaCarregamento()", 1 ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_proximaImgVivo() {\n\t\t//mudar index (como vetor circular)\n\t\tthis._indexImgVivo = (this._indexImgVivo + 1) % this._vetorImgsVivo.length;\n\t\t//mudar img em formaGeometrica\n\t\tthis._colocarImgVivoAtual();\n\t}", "function retrocederFoto() {\r\n // se incrementa el indice (posicionActual)\r\n\r\n ...
[ "0.70710325", "0.69651085", "0.6887236", "0.68638325", "0.67325246", "0.6618682", "0.66158", "0.64881605", "0.6472034", "0.6459893", "0.6445468", "0.6417515", "0.6396942", "0.63862914", "0.637846", "0.6357614", "0.6316603", "0.6311926", "0.6251772", "0.61466914", "0.6133277",...
0.60246885
26
Encapsulated handling of ChromeOS accounts options page.
function UIAccountTweaks() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function options() {\n if (chrome.runtime.openOptionsPage) {\n chrome.runtime.openOptionsPage();\n } else {\n window.open(chrome.runtime.getURL('options.html'));\n }\n}", "function openOptions() {\n chromeRuntime.openOptionsPage();\n }", "function optionsPage(){\n\tchrome.tabs.create({url: chrome....
[ "0.6509128", "0.643601", "0.6429056", "0.62365544", "0.6232405", "0.62116486", "0.6068299", "0.6013058", "0.59330124", "0.5815011", "0.58141273", "0.5704569", "0.56406975", "0.5632301", "0.5610681", "0.5599098", "0.55825627", "0.557165", "0.55613244", "0.55384636", "0.5526717...
0.55058616
23
load local storage There is no load button, I want the information to always be on the page no matter what. The only time this wouldn't hold true is if the user did not push the save button. A load feature is needed that runs on page refresh, but, after the elements are generated.
function loadTextOnRefresh(){ // Local storage needs to be applied every time the page is refreshed, once for every textarea. for (let i = 0; i < localStorage.length; i++) { // Remember, the keys in this have a different use than normal, they need to be used direct values to a textarea // This pulls out the id of the location, saved as the string "#key(i)". i is a variable with the values 0-8 // key.(i) is a constant in programming language, // "#key(i)" refers to the id tag of <textarea>. var locationKey = localStorage.key(i); // This pulls out the value of the key var value = localStorage.getItem(locationKey); // Check for integrity of data. //console.log("loaded locationKey: ", locationKey); //console.log("loaded location's value: ", value); // I want locationKey to direct where to load the value to. note we use val and not text; textarea text is a value. $(locationKey).val(value); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function load() {\n let savedNotes = localStorage.getItem(\"dataNotes\");\n let savedTitle = localStorage.getItem(\"dataTitle\");\n if (savedNotes) {\n notes.value = savedNotes;\n }\n if (savedTitle) {\n notesTitle.value = savedTitle;\n headerTitleChange()\n }\n}", "function loadPage(){\n\tupdateT...
[ "0.7340561", "0.72412854", "0.7174614", "0.7140139", "0.7032891", "0.6989227", "0.697797", "0.69056296", "0.6801492", "0.6756415", "0.6756256", "0.6731978", "0.67255616", "0.6718316", "0.6709526", "0.6706711", "0.6676052", "0.6652542", "0.66427267", "0.6639707", "0.6633537", ...
0.0
-1
A helper function used to read a Node.js readable stream into a string
async function streamToString(readableStream) { return new Promise((resolve, reject) => { const chunks = []; readableStream.on("data", (data) => { chunks.push(data.toString()); }); readableStream.on("end", () => { resolve(chunks.join("")); }); readableStream.on("error", reject); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function readStreamToString(stream, encoding) {\n const buffer = await concatStreamToBuffer(stream);\n return buffer.toString(encoding);\n}", "function stringifyStream(stream) {\n if (!stream.available())\n return '';\n return NetUtil.readInputStreamToString(stream, stream.available());\n}", "...
[ "0.7432239", "0.7143612", "0.70744026", "0.70744026", "0.70319986", "0.6994736", "0.64316815", "0.62230486", "0.6169126", "0.60963106", "0.607317", "0.604716", "0.59517944", "0.59178513", "0.5892043", "0.5878504", "0.5867298", "0.5867298", "0.5867298", "0.5847346", "0.5832332...
0.7051193
4
Build the response processing.
function cb (_error, _response, _context) { if(_error) { callback({errorMessage: _error.message, errorCode: _error.code},null,_context); } else if (_response.statusCode >= 200 && _response.statusCode <= 206) { var parsed = JSON.parse(_response.body); parsed = parsed.map(function(model){ return new RetrieveAListOfAllClientsResponse(model); }); callback(null,parsed,_context); } else { callback({errorMessage: "HTTP Response Not OK", errorCode: _response.statusCode, errorResponse: _response.body}, null, _context); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processResponse(){\n for(var key in returnData){\n\n //collecting the data in ref to identifier\n var data = returnData[key+\"\"];\n\n //Splitting up the values to send through\n //to load images\n var newData = data.split(\",\");\n var img = ne...
[ "0.6002283", "0.59602237", "0.5925454", "0.5770329", "0.57217765", "0.5680902", "0.55307674", "0.5517639", "0.54310423", "0.5430753", "0.5407032", "0.538594", "0.5318221", "0.530612", "0.53015006", "0.5248709", "0.5248709", "0.5243197", "0.52383584", "0.5216402", "0.5215162",...
0.0
-1
Build the response processing.
function cb (_error, _response, _context) { if(_error) { callback({errorMessage: _error.message, errorCode: _error.code},null,_context); } else if (_response.statusCode >= 200 && _response.statusCode <= 206) { var parsed = JSON.parse(_response.body); parsed = new GetAClientResponse(parsed); callback(null,parsed,_context); } else { callback({errorMessage: "HTTP Response Not OK", errorCode: _response.statusCode, errorResponse: _response.body}, null, _context); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processResponse(){\n for(var key in returnData){\n\n //collecting the data in ref to identifier\n var data = returnData[key+\"\"];\n\n //Splitting up the values to send through\n //to load images\n var newData = data.split(\",\");\n var img = ne...
[ "0.60029536", "0.5960582", "0.5924561", "0.5772009", "0.5722367", "0.5682929", "0.55326617", "0.55188656", "0.54323906", "0.5431956", "0.54075855", "0.53885597", "0.53192455", "0.5306786", "0.5301451", "0.52494186", "0.52494186", "0.52443665", "0.52392626", "0.52179724", "0.5...
0.0
-1
Build the response processing.
function cb (_error, _response, _context) { if(_error) { callback({errorMessage: _error.message, errorCode: _error.code},null,_context); } else if (_response.statusCode >= 200 && _response.statusCode <= 206) { var parsed = JSON.parse(_response.body); parsed = new UpdateAClientResponse(parsed); callback(null,parsed,_context); } else { callback({errorMessage: "HTTP Response Not OK", errorCode: _response.statusCode, errorResponse: _response.body}, null, _context); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processResponse(){\n for(var key in returnData){\n\n //collecting the data in ref to identifier\n var data = returnData[key+\"\"];\n\n //Splitting up the values to send through\n //to load images\n var newData = data.split(\",\");\n var img = ne...
[ "0.6002283", "0.59602237", "0.5925454", "0.5770329", "0.57217765", "0.5680902", "0.55307674", "0.5517639", "0.54310423", "0.5430753", "0.5407032", "0.538594", "0.5318221", "0.530612", "0.53015006", "0.5248709", "0.5248709", "0.5243197", "0.52383584", "0.5216402", "0.5215162",...
0.0
-1
Called when submitting the new Contact Form This method will pull data from the form use the provided function to give the data an id then add that data to the contacts list. Then reset the form hints: push: resources/push.jpg
function addContact(event) { event.preventDefault() let form = event.target let contact = { id: generateId(), name: form.name.value, phone: form.phone.value, emergencyContact: form.emergencyContact.checked } contacts.push(contact) saveContacts() form.reset() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSubmit() {\n const { name, address } = contact;\n const query = panelType === EDIT\n ? updateContactAndUpdateList\n : createContactAndUpdateList;\n\n const hasError = validateContactForm({ name, address });\n setInputErrors(hasError || initialInputErrorState);\n\n if (!hasError)...
[ "0.6640774", "0.6616997", "0.65311724", "0.65068716", "0.6506463", "0.65040535", "0.646034", "0.6437268", "0.6411922", "0.63516825", "0.6350708", "0.6349736", "0.6315593", "0.629967", "0.6251821", "0.6247863", "0.6239264", "0.6234966", "0.6216151", "0.6215584", "0.621217", ...
0.6529768
3
Converts the contacts array to a JSON string then Saves the string to localstorage at the key contacts
function saveContacts() { window.localStorage.setItem("contacts", JSON.stringify(contacts)) drawContacts() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function objectifySavedContacts() {\n var contacts = localStorage.getItem('data');\n\n if (contacts) {\n var objectifiedContacts = contacts.split(';')\n .map(function (cont) {\n return JSON.parse(cont);\n });\n\n return objectifiedContacts;\n } else {\n ...
[ "0.7874502", "0.785383", "0.718564", "0.718564", "0.7055259", "0.66296285", "0.65681624", "0.656396", "0.6492313", "0.6492313", "0.64775234", "0.64382607", "0.6412804", "0.6327026", "0.62833315", "0.6269512", "0.6267317", "0.6234663", "0.62132865", "0.62116766", "0.62030566",...
0.7933733
1
Attempts to retrieve the contacts string from localstorage then parses the JSON string into an array. Finally sets the contacts array to the retrieved array
function loadContacts() { let storedContacts = JSON.parse(window.localStorage.getItem("contacts")) if (storedContacts) { contacts = storedContacts } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function objectifySavedContacts() {\n var contacts = localStorage.getItem('data');\n\n if (contacts) {\n var objectifiedContacts = contacts.split(';')\n .map(function (cont) {\n return JSON.parse(cont);\n });\n\n return objectifiedContacts;\n } else {\n ...
[ "0.7682105", "0.74538445", "0.7427342", "0.7427342", "0.65688753", "0.63805896", "0.6359794", "0.6355172", "0.6355172", "0.63196856", "0.62251", "0.6200032", "0.61742085", "0.6168036", "0.6155979", "0.6137415", "0.60017496", "0.59408987", "0.5910093", "0.5866516", "0.5860901"...
0.7454966
2
This function targets the contactslist on the DOM and adds a new div element for each of the contacts in the contacts array
function drawContacts() { let contactListElement = document.getElementById("contact-list") let contactsTemplate = "" contacts.forEach(contact => { contactsTemplate += ` <div class="contact-card card mt-1 mb-1 ${contact.emergencyContact ? 'emergency-contact' : ''}"> <h3 class="mt-1 mb-1">${contact.name}</h3> <div class="d-flex space-between"> <p> <i class="fa fa-fw fa-phone"></i> <span>${contact.phone}</span> </p> <i class="action fa fa-trash text-danger" onclick="removeContact('${contact.id}')"></i> </div> </div> ` }) contactListElement.innerHTML = contactsTemplate }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayContacts(){\n\n\tsection.innerHTML ='';\n\tarrayOfContacts.sort(sortArrayOfContacts);\n\tfor (contactItem of arrayOfContacts){\n\n\t\tlet contactContainer = createElement(section, 'div', '', 'class', 'contact-container');\n\t\tlet contactLogo = createElement(contactContainer, 'div', '<img src=\"./p...
[ "0.78620464", "0.74986744", "0.7492149", "0.73235124", "0.7312934", "0.7246438", "0.71162766", "0.70881903", "0.7070048", "0.7021647", "0.7012335", "0.68832874", "0.68716264", "0.684689", "0.6727739", "0.66785574", "0.6656947", "0.6653212", "0.66209716", "0.65940344", "0.6588...
0.7131808
6
Toggles the visibility of the AddContact Form
function toggleAddContactForm() { document.getElementById('new-contact-form').classList.toggle("hidden") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleAddContactForm() {\n let root = document.documentElement;\n\n let newContact = document.getElementById(\"new-contact-form\")\n let plusMinus = document.getElementById(\"plus-minus\")\n\n if (contactAdd) {\n contactAdd = false\n\n newContact.classList.add(\"hidden\")\n plusMinus.classLis...
[ "0.7425844", "0.73780584", "0.73464274", "0.71892333", "0.7073225", "0.69898903", "0.69515646", "0.69515646", "0.6882336", "0.68518496", "0.6841175", "0.6796149", "0.6783407", "0.6753915", "0.6747339", "0.67363393", "0.6732894", "0.67059624", "0.6691466", "0.669002", "0.66834...
0.8115395
1
Handles users joining a game, checks for blank field values
function joinRoom() { var u = document.getElementById("username").value; if(u === "") { setJoinError("Please choose a username"); return; } var r = document.getElementById("room").value; if(r === "") { setJoinError("Please enter a room"); return; } var c = document.getElementById("color").value; if(c === "") { setJoinError("Please choose a color"); return; } r = r.replace(/\s+/g, ''); // Remove whitespace from room name r = r.toLowerCase(); var join_message = {username: u, room: r, color: c}; Game = new MultiplayerGame(u, r); socket.emit('join', join_message) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function joinGame() {\n let userName = gameNameInput.value;\n if (checkUserName(userName)) {\n if (userName === \"\") {\n userName = \"$guest\";\n }\n const code = gameCodeInput.value;\n if (code == \"\") {\n sock.emit('newGame', userName);\n } else {\n sock.emit('joinGame', code, u...
[ "0.7245107", "0.6900979", "0.6641419", "0.63158107", "0.6312569", "0.63025564", "0.6240452", "0.62165165", "0.6203466", "0.6158552", "0.6060773", "0.6019133", "0.59771013", "0.59715575", "0.5970541", "0.59682566", "0.59607536", "0.59232706", "0.5905644", "0.5887385", "0.58705...
0.61841595
9
Hides the join room box when the user successfully joins a room
function HideJoinRoom(){ document.getElementById('join-room').style.display="none"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function join_room_pop() {\n join_room.css(\"display\", \"block\");\n }", "function func_join_room_pop() {\n join_room.css(\"display\", \"block\");\n}", "function joinUserRoom(name) {\r\n divHome.hide();\r\n divRoom.show();\r\n socket.emit(\"joinRoom\", name);\r\n currentRoom = name;\r\n}", "fun...
[ "0.73671794", "0.711415", "0.7018985", "0.7014223", "0.6890914", "0.67102593", "0.657768", "0.64558214", "0.64250296", "0.63839626", "0.63670045", "0.6249279", "0.62368983", "0.6214901", "0.6105152", "0.5992302", "0.59902316", "0.5959945", "0.5956927", "0.5953859", "0.5928470...
0.74466616
0
If there is an error during joining a room display the error message
function setJoinError(error) { var errorMessage = document.getElementById("join-error-message"); errorMessage.innerHTML = error; errorMessage.style.display = "block"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleJoinRoom(room_name){\n clearErrors();\n socket.emit(\"join_room\", room_name);\n }", "function authenticateJoin(username,room){\n if(!Rooms.checkRoom(room)){\n return 'room doesn\\'t exist';\n }\n else if(Rooms.checkPlayerCount(room)>7){\n return 'room full'...
[ "0.67747873", "0.6403214", "0.6387755", "0.6316273", "0.6233587", "0.6143143", "0.6020871", "0.5988205", "0.59799033", "0.5979633", "0.596777", "0.59042066", "0.5834663", "0.5832642", "0.57825625", "0.5730718", "0.57248497", "0.5722479", "0.57219696", "0.5720209", "0.57074535...
0.6417398
1
Wenn gescrollt wird, wird der Header kleiner
function scrollFunction() { let nav = document.querySelector("nav"); if ( document.body.scrollTop > 100 || document.documentElement.scrollTop > 100 ) { nav.classList.remove("bigHeader"); } else { nav.classList.add("bigHeader"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function eltdOnWindowScrollHeader() {\n \n }", "function scrollHeader() {\n\n}", "function headerScroll () {\n let Y = document.documentElement.scrollTop || document.body.scrollTop;\n if (Y > 596) {\n header.classList.add('header-scrolled-view')\n scrollToTopBu...
[ "0.7877331", "0.78570306", "0.75043046", "0.7493926", "0.7400849", "0.7379417", "0.73742247", "0.7329301", "0.73267597", "0.73223066", "0.73019695", "0.7272011", "0.7244297", "0.7242242", "0.72191083", "0.7206793", "0.716412", "0.71464586", "0.71278316", "0.71278316", "0.7109...
0.0
-1
lasse den toTopButton nach kurzem Scrollen erscheinen
function scrollFunction_topBtn() { if ( document.body.scrollTop > 20 || document.documentElement.scrollTop > 20 ) { toTopBtn.style.display = "block"; } else { toTopBtn.style.display = "none"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function toTop(){\n\tif (window.pageYOffset >= bottomPage){\n\t\ttoTopButton.style.display = 'inline';\n\t} else {\n\t\ttoTopButton.style.display = 'none';\n\t}\n}", "function setGoToTopBtn() {\n ...
[ "0.7818979", "0.7753655", "0.7702032", "0.7668609", "0.7632984", "0.74900806", "0.7475701", "0.74687123", "0.74464184", "0.7431721", "0.7430168", "0.74076843", "0.7398159", "0.73770446", "0.73452365", "0.7340058", "0.7324103", "0.7303548", "0.7270449", "0.7226559", "0.719594"...
0.75374466
5
When the user clicks on the button, scroll to the top of the document
function topFunction() { document.body.scrollTop = 0; // For Safari document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n ...
[ "0.8499684", "0.8493862", "0.8238682", "0.80306077", "0.80239034", "0.80125797", "0.7994999", "0.79572564", "0.79508185", "0.7945779", "0.7924484", "0.7909982", "0.79083693", "0.7896633", "0.7890989", "0.78718835", "0.7841969", "0.7820104", "0.781835", "0.7801471", "0.7772324...
0.0
-1
angle i radianer. returnerer grader.
function toDegrees (angle) { return angle * (180 / Math.PI); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function radian(angle) {\n\treturn angle * ( Math.PI / 180.0 );\n}", "function calculateRadian(angle) {\n angle = angle % 360;\n if (angle < 0) {\n angle = angle + 360;\n }\n var arc = (2 * Math.PI * angle) / 360;\n if (arc < 0) {\n arc = arc + 2 * Math.PI;\n }\n return arc;\n }",...
[ "0.65768534", "0.65631247", "0.6491227", "0.6391563", "0.6344395", "0.62783176", "0.6182877", "0.6173574", "0.6168147", "0.61585635", "0.61464757", "0.6135943", "0.61336344", "0.6115736", "0.6113112", "0.6093375", "0.60602605", "0.59973824", "0.5950196", "0.59410775", "0.5925...
0.0
-1
angle i grader. returnerer radianer.
function toRadians (angle) { return angle * (Math.PI / 180); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateAngle() {\n const normalizedData = this.gameOver ? ((this.time / -this.terminalVelocity) / 2) + 0.5 : this.time / -this.terminalVelocity;\n this.angle = this.gameOver ? normalizedData * -135 + 90 : normalizedData * -45;\n }", "angle() {\n return this.get(Math.PI * 2, true)\n }...
[ "0.6367025", "0.6366582", "0.63504946", "0.6342919", "0.62972134", "0.6272394", "0.62671894", "0.618377", "0.6174784", "0.6146543", "0.6136298", "0.61265355", "0.6114728", "0.60730803", "0.6069066", "0.6054807", "0.59934473", "0.5979129", "0.5972087", "0.5954314", "0.5893452"...
0.0
-1
counter for current layer
function Start () { DontDestroyOnLoad(GameObject.Find("GLOBAL")); layers = new Array(); clearLayers(); interp = GameObject.Find("Interpreter").GetComponent("Interpreter"); P = GameObject.Find("player").GetComponent("PlayerPosition"); level = GameObject.Find("GLOBAL").GetComponent("GLOBAL").levelVar; overlay = GameObject.Find("overlay"); infoBox = GameObject.Find("infoBox").GetComponent("infoBox"); conditionsB = new boolean[10]; for(i = 0; i < 10; i++){ conditionsB[i] = false; } conditions = new String[10]; conditions[0] = "Alex is NOT a Jellyfish"; conditions[1] = "Alex is NOT Under Water"; conditions[2] = "Alex is a Jellyfish"; conditions[3] = "Alex is Blue"; conditions[4] = "Alex is Next to a Bubble"; conditions[5] = ""; conditions[6] = ""; conditions[7] = ""; conditions[8] = ""; conditions[9] = ""; actions = new String[10]; actions[0] = "Alex.MoveRight()"; actions[1] = "Alex.MoveLeft()"; actions[2] = "Alex.MoveUp()"; actions[3] = "Alex.MoveDown()"; actions[4] = "Alex.PopBubble()"; actions[5] = ""; actions[6] = ""; actions[7] = ""; actions[8] = ""; actions[9] = ""; tree = new CNode(); root = new RootNode(tree); failDict["playerFail"] = "Try making a player and moving it to the correct position"; failDict["repeatFail"] = "Try adding a repeat loop with the correct amount of loops"; var levelHelp : String = "level"+level+"info"; levelInfo = GameObject.Find(levelHelp).GetComponent(levelHelp); helpText = levelInfo.info[infoSequence]; if(level == 0){ ifButton.interactable = false; repButton.interactable = false; actButton.interactable = false; } else if(level == 1){ ifButton.interactable = false; repButton.interactable = false; actButton.interactable = true; } else if(level == 2){ ifButton.interactable = false; repButton.interactable = true; actButton.interactable = true; } else if (level == 3){ ifButton.interactable = true; repButton.interactable = false; actButton.interactable = true; } else{ ifButton.interactable = true; repButton.interactable = true; actButton.interactable = true; } numLines = levelInfo.numLines; code = new String[numLines]; prepLevel(); infoOn = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "incrementCounter() {\n\t\tmodel.currentCat.clickCount++;\n\t\tcatView.render();\n\t}", "getLayerTurnCount() {\n return this.current == null ? this.ltm : this.ltm + this.countLayerTurns(this.current);\n }", "function findNumberOfLayerByName(LayerName,theComp) {\n for (var i = theComp.numLayers; i >= 1; i...
[ "0.6899662", "0.6692119", "0.6300984", "0.6199439", "0.61806005", "0.61682564", "0.6167804", "0.6149912", "0.6138976", "0.6120965", "0.59938574", "0.5976998", "0.5969883", "0.5925013", "0.59175915", "0.5912138", "0.59092486", "0.58787555", "0.5872846", "0.58677024", "0.584914...
0.0
-1
Validate the proper flags are passed in.
validateFlags (flags) { // Exit if wallet not specified. const name = flags.name if (!name || name === '') { throw new Error('You must specify a wallet with the -n flag.') } const avax = flags.avax if (isNaN(Number(avax))) { throw new Error('You must specify a quantity in AVAX with the -q flag.') } const sendAddr = flags.sendAddr if (!sendAddr || sendAddr === '') { throw new Error('You must specify a send-to address with the -a flag.') } const addrBuffer = this.xchain.parseAddress(sendAddr) const isValid = Boolean(addrBuffer) if (!isValid) { // console.log(sendAddr) throw new Error( 'You must specify a valid avalanche address with the -a flag' ) } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validateFlags (flags) {\n // console.log(`flags: ${JSON.stringify(flags, null, 2)}`)\n\n // Exit if wallet not specified.\n const name = flags.name\n if (!name || name === '') {\n throw new Error('You must specify a wallet with the -n flag.')\n }\n\n const qty = flags.qty\n if (isNaN(Numb...
[ "0.7580194", "0.68912417", "0.6631517", "0.6447321", "0.6212512", "0.6022667", "0.5986614", "0.58006656", "0.5790068", "0.5762083", "0.57354116", "0.5709845", "0.5624311", "0.5568451", "0.55644643", "0.5514563", "0.551083", "0.55020386", "0.5495023", "0.5488235", "0.54589206"...
0.7224797
1
Selects a UTXO from an array of UTXOs based on this optimization criteria: 1. The UTXO must be larger than or equal to the amount of AVAX to send. 2. The UTXO should be as close to the amount of AVAX as possible. i.e. as small as possible Returns a single UTXO object.
async selectUTXO (avax, utxos, isnAvax = false) { let candidateUTXO = {} const avaxBuffer = await this.xchain.getAVAXAssetID() const assetDetail = await this.xchain.getAssetDescription(avaxBuffer) const txFee = await this.xchain.getTxFee() // 1 nAVAX is equal to 0.000000001 AVAX let navax = avax if (!isnAvax) { navax = parseFloat(avax) * Math.pow(10, assetDetail.denomination) } const total = navax + txFee.toNumber() // if it's a new wallet if (!utxos) { utxos = [] } // Loop through each address. for (var i = 0; i < utxos.length; i++) { const thisAddr = utxos[i] // Loop through each UTXO for each address. for (let j = 0; j < thisAddr.utxos.length; j++) { const thisUTXO = Object.assign({}, thisAddr.utxos[j]) thisUTXO.hdIndex = thisAddr.hdIndex // The UTXO must be greater than or equal to the send amount. if (thisUTXO.amount < total) { continue } // Automatically assign if the candidateUTXO is an empty object. if (!candidateUTXO.amount) { candidateUTXO = thisUTXO continue } // Replace the candidate if the current UTXO is closer to the send amount. if (candidateUTXO.amount > thisUTXO.amount) { candidateUTXO = thisUTXO } } } return candidateUTXO }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUTXO(fromAddress) {\n let utxos = []\n for(const block of this.chain) {\n for(const tx of block.transactions){\n // get all output tx\n for (let i=0; i<tx.txOut.length;i++) {\n if (tx.txOut[i].toAddress == fromAddress) {\n ...
[ "0.6049517", "0.5976764", "0.58927256", "0.55318934", "0.50106394", "0.49723512", "0.4892732", "0.48218334", "0.47638175", "0.47315502", "0.4613066", "0.4458016", "0.44563848", "0.4439036", "0.44355077", "0.44121075", "0.4404022", "0.43973127", "0.43871105", "0.43833047", "0....
0.6444737
0
Copyright (C) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
function test(arg0, arg1) { this.prop0 = arg0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "static final private internal function m106() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "createObjectContext2() {\n...
[ "0.5743052", "0.554041", "0.5310376", "0.5295104", "0.5238483", "0.5193789", "0.5070014", "0.5056497", "0.5013669", "0.50099355", "0.49654922", "0.49243867", "0.49135813", "0.48785093", "0.48777246", "0.4875294", "0.4858597", "0.48262426", "0.48089305", "0.47947955", "0.47649...
0.0
-1
DOWHATITSAYS Function takes the data from my random.txt file and passes it as a search value in the corresponding function
function random() { fs.readFile('./random.txt', 'utf8', function (err, data) { if (err) { return console.log(err); } else { console.log(data); //Converts data in text file into array var arr = data.split(","); var value = arr[1]; // If command name at index[0] matches the string, invoke the function if (arr[0] === "movie-this") { myMovie(value); } else if (arr[0] === "spotify-this-song") { mySpotify(value); } else if (arr[0] === "concert-this") { myBand(value); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomSearch() {\n \n fs.readFile(\"random.txt\", \"utf8\", function(err, data) {\n if (err) {\n return console.log(err);\n }\n console.log(data);\n data = data.split(\",\");\n SC(data[0], data[1]);\n });\n}", "function randomSearch() {\n\nfs.readFile(\"random.txt\", \"utf8\", fun...
[ "0.8111461", "0.8044331", "0.8035373", "0.79593414", "0.7946281", "0.79402626", "0.79124606", "0.7830428", "0.7823847", "0.77044487", "0.7701434", "0.7674267", "0.76117796", "0.7581757", "0.7574511", "0.7560774", "0.75397086", "0.75125337", "0.7504293", "0.75031275", "0.74898...
0.74650234
22
Function created to storeCities.
function storeCities(){ localStorage.setItem("savedCity", JSON.stringify(savedCity)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function storeCities() {\n localStorage.setItem(\"cities\", JSON.stringify(cities));\n }", "function storeCities(){\n localStorage.setItem(\"cities\", JSON.stringify(citiesArray));\n }", "function savCities() {\n localStorage.setItem(\"saveCity\", JSON.stringify(cities));\n }", ...
[ "0.7364514", "0.727036", "0.7249595", "0.7217401", "0.7169838", "0.7124404", "0.71230304", "0.70661855", "0.70453733", "0.70103073", "0.6864415", "0.67993104", "0.6799254", "0.66988915", "0.667225", "0.6649938", "0.6637085", "0.66249996", "0.65786314", "0.65729344", "0.656227...
0.7499474
0