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
Show search panel results
function showSearchPanelResults(searchPanelInstance, features){ if(features.length){ // Here we select where to show the search results var targetComponent = null; if(typeof(mapSearchPanelOutputRegion) == 'undefined'){ mapSearchPanelOutputRegion = 'default'; } // These option are for different output modes var collapsible = true; var autoHeight = true; switch(mapSearchPanelOutputRegion){ case 'right': targetComponent = Ext.getCmp('RightPanel'); break; case 'bottom': targetComponent = Ext.getCmp('BottomPanel'); collapsible = false; // No collapsible in bottom break; case 'popup': if(typeof(Ext.getCmp('SearchResultsPopUp')) == 'undefined'){ targetComponent = new Ext.Window( { id: 'SearchResultsPopUp', layout: 'fit', width: "80%", height: 300, modal: false, closeAction: 'hide' }); } autoHeight = false; // No scrollbars if true collapsible = false; // No collapsible in popup targetComponent = Ext.getCmp('SearchResultsPopUp'); break; case 'default': default: targetComponent = searchPanelInstance; break; } // Make sure it's shown and expanded targetComponent.show(); targetComponent.collapsible && targetComponent.expand(); // Delete and re-create try { Ext.getCmp('SearchPanelResultsGrid').destroy(); } catch(e) { // Eventually log... } searchPanelInstance.resultsGrid = new Ext.grid.GridPanel({ id: 'SearchPanelResultsGrid', title: searchResultString[lang], collapsible: collapsible, collapsed: false, store: searchPanelInstance.store, columns: searchPanelInstance.gridColumns, autoHeight: autoHeight, // No vert. scrollbars in popup if true!! viewConfig: { forceFit: true } }); searchPanelInstance.resultsGrid.on('rowclick', searchPanelInstance.onRowClick, searchPanelInstance); targetComponent.add(searchPanelInstance.resultsGrid); targetComponent.doLayout(); // Always make sure it's shown and expanded searchPanelInstance.resultsGrid.show(); searchPanelInstance.resultsGrid.collapsible && searchPanelInstance.resultsGrid.expand(); } else { // No features: shouldn't we warn the user? Ext.MessageBox.alert(searchPanelTitleString[lang], searchNoRecordsFoundString[lang]); try { Ext.getCmp('SearchPanelResultsGrid').destroy(); } catch(e) { // Eventually log... } searchPanelInstance.resultsGrid = null; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onShowSearchResultPanel() {\n mediator.getView('searchResult');\n }", "function show_results() {\n\t\t$('#mc_btns').hide();\n\t\t$('#progress-box').hide();\n\t\t$('#result-btns').show();\n\t\t$('#page-title').html('Results').hide().fadeIn(500);\n\t}", "function showResults(search) {\n\t//sho...
[ "0.8149672", "0.74154586", "0.7351451", "0.73156697", "0.71737444", "0.716216", "0.7157756", "0.7067799", "0.70615697", "0.7057377", "0.6979734", "0.6970673", "0.6956325", "0.6879121", "0.68723845", "0.68686473", "0.6864502", "0.6855489", "0.68504167", "0.68268293", "0.680230...
0.6778393
21
function to display a loadMask during lengthy load operations
function displayLoadMask() { if (mapIsLoading) { // check if layer is still loading loadMask = new Ext.LoadMask(Ext.getCmp('MapPanel').body, {msg:mapLoadingString[lang]}); loadMask.show(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maskWC (sLoadingText, aMaskEl)\n// ---------------------------------------------------------------------\n{\n // ++g_nMaskCnt;\n if (!sLoadingText)\n {\n sLoadingText = getString(\"ait_loading\");\n }\n aMaskEl = aMaskEl || document.body;\n Ext.get (aMaskEl).mask (sLoadingText, 'x-mask-loading');...
[ "0.6589804", "0.6279969", "0.62251884", "0.62251884", "0.61610055", "0.6148395", "0.6046313", "0.6045253", "0.60235906", "0.599463", "0.5974879", "0.595893", "0.59328926", "0.59071106", "0.5888625", "0.5886988", "0.58783716", "0.5834538", "0.582026", "0.5809646", "0.5743445",...
0.82097787
0
function for the help viewer
function scrollToHelpItem(targetId) { Ext.get(targetId).dom.scrollIntoView(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ListHelp() {\n}", "function displayHelp()\r\n{\r\n dwscripts.displayDWHelp(HELP_DOC);\r\n}", "function displayHelp()\n{\n dwscripts.displayDWHelp(HELP_DOC);\n}", "function displayHelp()\r\n{\r\n dwscripts.displayDWHelp(helpDoc);\r\n}", "function displayHelp()\n{\n // Replace the following call...
[ "0.7966596", "0.78671783", "0.77850354", "0.7770311", "0.7760902", "0.7679154", "0.7390747", "0.7337917", "0.73221624", "0.7283328", "0.72699034", "0.7244186", "0.7110629", "0.70616406", "0.70450634", "0.69755924", "0.6964677", "0.69352305", "0.6930826", "0.6920032", "0.68757...
0.0
-1
function that creates a permalink
function createPermalink(){ var visibleLayers = Array(); var permalink; var permalinkParams = {}; visibleLayers = getVisibleLayers(visibleLayers, layerTree.root.firstChild); visibleLayers = uniqueLayersInLegend(visibleLayers); var visibleBackgroundLayer = getVisibleBackgroundLayer(); var startExtentArray = geoExtMap.map.getExtent().toArray(); var startExtent = startExtentArray[0] + "," + startExtentArray[1] + "," + startExtentArray[2] + "," + startExtentArray[3]; if (!norewrite){ var servername = location.href.split(/\/+/)[1]; permalink = "http://"+servername; if (gis_projects) { permalink += gis_projects.path + "/"; } else { permalink += "/"; } permalink += wmsMapName+"?"; } else { permalink = urlArray[0] + "?map="; permalink = permalink + "/" + wmsMapName.replace("/", ""); //add .qgs if it is missing if (!permalink.match(/\.qgs$/)) { permalink += ".qgs"; } permalink += "&"; } // extent permalinkParams.startExtent = startExtent; // visible BackgroundLayer permalinkParams.visibleBackgroundLayer = visibleBackgroundLayer; // visible layers and layer order permalinkParams.visibleLayers = visibleLayers.toString(); // layer opacities as hash of <layername>: <opacity> var opacities = null; for (layer in wmsLoader.layerProperties) { if (wmsLoader.layerProperties.hasOwnProperty(layer)) { var opacity = wmsLoader.layerProperties[layer].opacity; // collect only non-default values if (opacity != 255) { if (opacities == null) { opacities = {}; } opacities[layer] = opacity; } } } if (opacities != null) { permalinkParams.opacities = Ext.util.JSON.encode(opacities); } //layer order permalinkParams.initialLayerOrder = layerOrderPanel.orderedLayers().toString(); // selection permalinkParams.selection = thematicLayer.params.SELECTION; if (permaLinkURLShortener) { permalink = encodeURIComponent(permalink + decodeURIComponent(Ext.urlEncode(permalinkParams))); } else { permalink = permalink + Ext.urlEncode(permalinkParams); } return permalink; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async createPermalink () {\n\t\tawait this.createLink();\t// create the link as needed\n\t\tawait this.updateCodemark();\t// update the codemark as needed\n\t\treturn this.url;\n\t}", "async createPermalink () {\n\t\tif (this.attributes.teamId) {\n\t\t\tthis.attributes.permalink = await new PermalinkCreator({\n\...
[ "0.79330873", "0.77881384", "0.7000295", "0.68960154", "0.6393846", "0.6296471", "0.62498486", "0.6001344", "0.5988778", "0.58598423", "0.57202786", "0.56535584", "0.563193", "0.56004936", "0.5586757", "0.55185944", "0.55019873", "0.5462223", "0.54512304", "0.54414064", "0.54...
0.68169504
4
apply initial exclusive layer groups: only a single layer of a group may be active, or none
function initExclusiveLayerGroups() { if (wmsLoader.projectSettings.capability.exclusiveLayerGroups.length == 0) { // no exclusive layer groups return; } // collect initially active layers var activeLayers = []; layerTree.root.firstChild.cascade(function(node) { if (node.isLeaf() && node.attributes.checked) { activeLayers.push(wmsLoader.layerTitleNameMapping[node.text]); } }); // collect layers of exclusive layer groups var layersToUncheck = []; for (var i=0; i<wmsLoader.projectSettings.capability.exclusiveLayerGroups.length; i++) { var exclusiveGroup = wmsLoader.projectSettings.capability.exclusiveLayerGroups[i]; // get first group layer from active layers var activeLayerName = null; for (var l=0; l<exclusiveGroup.length; l++) { var groupLayerName = exclusiveGroup[l]; if (activeLayers.indexOf(groupLayerName) != -1) { activeLayerName = groupLayerName; break; } } // collect inactive group layers for (var l=0; l<exclusiveGroup.length; l++) { var groupLayerName = exclusiveGroup[l]; if (groupLayerName != activeLayerName) { // add layer to uncheck if not yet in list if (layersToUncheck.indexOf(groupLayerName) == -1) { layersToUncheck.push(groupLayerName); } } } } if (layersToUncheck.length > 0) { // update layer tree layerTree.root.firstChild.cascade(function(node) { if (node.isLeaf() && node.attributes.checked) { // uncheck layer node if (layersToUncheck.indexOf(wmsLoader.layerTitleNameMapping[node.text]) != -1) { node.getUI().toggleCheck(false); } } }); layerTree.fireEvent("leafschange"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "triggerToggleLayerGroup() {\n const datasetID = this.props.dataset.id;\n const addLayerGroup = !this.props.isLayerGroupAdded(datasetID);\n this.props.toggleLayerGroup(datasetID, addLayerGroup);\n }", "function ungroupLayerSet() { //拆散图层组\n\n\tvar desc = new ActionDescriptor(),\n\t\tref = new ActionRefe...
[ "0.63897187", "0.6238217", "0.59500057", "0.5940096", "0.58018565", "0.5796252", "0.575776", "0.5668572", "0.566853", "0.5607042", "0.5525891", "0.5509979", "0.55065703", "0.55026186", "0.5478508", "0.5455876", "0.5426737", "0.54110414", "0.53863806", "0.5379702", "0.53762865...
0.7612339
0
get best image format for a list of layers
function imageFormatForLayers(layers) { var format = origFormat; if (layerImageFormats.length > 0 && origFormat.match(/8bit/)) { for (var f = 0; f < layerImageFormats.length; f++) { var layerImageFormat = layerImageFormats[f]; for (var l = 0; l < layerImageFormat.layers.length; l++) { if (layers.indexOf(layerImageFormat.layers[l]) != -1) { format = layerImageFormat.format; break; } } if (format != origFormat) { break; } } } return format; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBestLayer(layers = []) {\n //finde den besten Layer (z.B. mit den meisten Eyetracking- und Mausdaten)\n // let bestLayerHelper = {};\n // for (let layerNumber in layers) {\n // //der in dem Schleifendurchlauf betrachtete Layer\n // const layer = layers[layerNumber];\n // /...
[ "0.6525973", "0.62801224", "0.5884315", "0.5884315", "0.5884315", "0.5884315", "0.5813669", "0.5790409", "0.5781936", "0.57566226", "0.56323624", "0.56116", "0.5567938", "0.5496423", "0.5426627", "0.54193187", "0.5376723", "0.5269856", "0.5190717", "0.51744556", "0.5173934", ...
0.76829535
0
export functions , draw and modify version
function setExportBoxHeight(newValue, oldValue) { if (oldValue != '') { exportBoxValues.height = Math.round(newValue * (exportBoxValues.dpi / 25.4)); var scale = newValue / oldValue; if (exportBoxValues.lockaspectratio) { var ratio = 1; exportBoxValues.width = exportBoxValues.width * scale; Ext.getCmp('ExportWidthField').setValue(Ext.getCmp('ExportWidthField').getValue() * scale); } else { var ratio = 1 / scale; } var origin = exportLayer.features[0].geometry.getCentroid(); exportLayer.features[0].geometry.resize(scale, origin, ratio); exportLayer.redraw(); } else if (Ext.getCmp('ExportWidthField').getValue() != '') { drawExportBox(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw () { //change name to generate?? also need to redo\n return null;\n }", "function draw() {}", "function draw() {}", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "function drawOnDemand(){\n\n\n}", "_draw() {\n\n }", "function updateDraw(){\r\n ...
[ "0.6704778", "0.6581565", "0.6581565", "0.6471182", "0.64127046", "0.6407515", "0.6339987", "0.63242733", "0.6276098", "0.6276098", "0.6276098", "0.6276098", "0.6242511", "0.6242511", "0.6242511", "0.6172286", "0.61575127", "0.6153804", "0.61525553", "0.61419815", "0.6132425"...
0.0
-1
this function checks if layers and layergroups are outside scalelimits. if a layer is outside scalelimits, its label in the TOC is being displayed in a light gray
function setGrayNameWhenOutsideScale() { if ( grayLayerNameWhenOutsideScale ) { //only if global boolean is set //layers //------ var allLayersWithIDs = new Array(); //iterate layer tree to get title and layer-id layerTree.root.firstChild.cascade( function (n) { if (n.isLeaf()) { allLayersWithIDs.push([n.text,n.id]); } } ); //iterate ProjectSettings for (var i=0;i<wmsLoader.projectSettings.capability.layers.length;i++){ MaxScale = Math.round(wmsLoader.projectSettings.capability.layers[i].maxScale); //if no MaxScale is defined if (MaxScale < 1){ MaxScale = 1; } MinScale = Math.round(wmsLoader.projectSettings.capability.layers[i].minScale); //if no MinScale is defined if (MinScale < 1){ //if not defined, this value is very small MinScale = 150000000; //within terrestrial dimensions big enough } //set content gray if (wmsLoader.projectSettings.capability.layers[i].maxScale > geoExtMap.map.getScale() || wmsLoader.projectSettings.capability.layers[i].minScale < geoExtMap.map.getScale()) { for (var j=0;j<allLayersWithIDs.length;j++){ //comparison layerTree and info from getProjectsettings if (allLayersWithIDs[j][0] == wmsLoader.projectSettings.capability.layers[i].title) { layerTree.root.findChild('id', allLayersWithIDs[j][1], true).setCls('outsidescale');//add css for outside scale strTOCTooltip = tooltipLayerTreeLayerOutsideScale[lang] + ' 1:' + MaxScale + ' - 1:' + MinScale layerTree.root.findChild('id', allLayersWithIDs[j][1], true).setTooltip(strTOCTooltip); layerTree.root.findChild('id', allLayersWithIDs[j][1], true).isOutsideScale = true; layerTree.root.findChild('id', allLayersWithIDs[j][1], true).MinScale = MinScale; layerTree.root.findChild('id', allLayersWithIDs[j][1], true).MaxScale = MaxScale; } } // reset gray } else { for (var j=0;j<allLayersWithIDs.length;j++){ if (allLayersWithIDs[j][0] == wmsLoader.projectSettings.capability.layers[i].title) { layerTree.root.findChild('id', allLayersWithIDs[j][1], true).setTooltip(''); //empty tooltip node = layerTree.root.findChild('id', allLayersWithIDs[j][1], true); //remove css class node.ui.removeClass('outsidescale'); //remove css class layerTree.root.findChild('id', allLayersWithIDs[j][1], true).isOutsideScale = false; layerTree.root.findChild('id', allLayersWithIDs[j][1], true).MinScale = MinScale; layerTree.root.findChild('id', allLayersWithIDs[j][1], true).MinScale = MaxScale; } } } } // layer-groups // ------------ var arrLayerGroups = new Array(); //array containing all layer-groups var arrOutsideScale = new Array(); //array with the state of all layers within the group var arrMaxScale = new Array(); //array with the defined max-scale of the group var arrMinScale = new Array(); //array with the defined min-scale of the group //iterate layer tree layerTree.root.firstChild.cascade( function (n) { if (!(n.isLeaf())) { layerTree.root.findChild('id', n.id, true).cascade( function (m) { // has to be a leaf and outside scale if (m.isLeaf()){ arrOutsideScale.push(m.isOutsideScale); arrMaxScale.push(m.MaxScale); arrMinScale.push(m.MinScale); } }); //arrLayerGroups: layer-id, layer-name, boolean if currently outside scale, maxscale, minscale arrLayerGroups.push([n.id, n.text, arrOutsideScale, arrMaxScale, arrMinScale]); } // empty arrays for next iteration arrOutsideScale = []; arrMaxScale = []; arrMinScale = []; }); //iterate all leaf layers within a group for (var i=0;i<arrLayerGroups.length;i++){ bolGroupOutsideScale = true; MinScale = 0; //set an extreme minscale MaxScale = 150000000; //set an extreme maxscale for (var j=0;j<arrLayerGroups[i][2].length;j++){ //in each iteration take the bigger minscale if (MinScale < arrLayerGroups[i][4][j]){ MinScale = arrLayerGroups[i][4][j]; } //in each iteration take the smallest maxscale if (MaxScale > arrLayerGroups[i][3][j]){ MaxScale = arrLayerGroups[i][3][j]; } //if one single leaf layer is visible, the group has as well to be visible if ( !arrLayerGroups[i][2][j] ){ //[2] = arrOutsideScale bolGroupOutsideScale = false; } } //the group is invisible if ( bolGroupOutsideScale ) { layerTree.root.findChild('id', arrLayerGroups[i][0], true).setCls('outsidescale'); // add css class strTOCTooltip = tooltipLayerTreeLayerOutsideScale[lang] + ' 1:' + MaxScale + ' - 1:' + MinScale layerTree.root.findChild('id', arrLayerGroups[i][0], true).setTooltip(strTOCTooltip); //the group is visible } else { node = layerTree.root.findChild('id', arrLayerGroups[i][0], true); //remove css class node.ui.removeClass('outsidescale'); //remove css class layerTree.root.findChild('id', arrLayerGroups[i][0], true).setTooltip(''); } } } if (enableWmtsBaseLayers) { updateScaleBasedWmtsLayersVisibility(geoExtMap.map.getScale()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e(e,n,i){if(n.flatten((({sublayers:e})=>e)).length!==e.length)return!0;return!!e.some((e=>e.originIdOf(\"minScale\")>i||e.originIdOf(\"maxScale\")>i||e.originIdOf(\"renderer\")>i||e.originIdOf(\"labelingInfo\")>i||e.originIdOf(\"opacity\")>i||e.originIdOf(\"labelsVisible\")>i||e.originIdOf(\"source\")>i))...
[ "0.6307542", "0.5996981", "0.59932214", "0.5752637", "0.5732391", "0.56810063", "0.5630802", "0.5493847", "0.54737294", "0.54506564", "0.5450406", "0.5376089", "0.530375", "0.53016484", "0.52903545", "0.5256135", "0.5247978", "0.5247314", "0.5242489", "0.52411246", "0.5238207...
0.7099726
0
so far supports only Firefox, Chrome and Opera (buggy) could be extended in the future to use something like
function sourceFromStacktrace() { try { throw new Error(); } catch ( e ) { if (e.stacktrace) { // Opera return e.stacktrace.split("\n")[6]; } else if (e.stack) { // Firefox, Chrome return e.stack.split("\n")[4]; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isFirefox(){\n\treturn navigator.userAgent.indexOf('Gecko/')>0;\n}", "function hackUserAgent(){\n if (navigator.userAgent.search('Firefox')!==-1)\n active='mouseup.webcrawler';\n}", "function css_browser_selector(e){var r=e.toLowerCase(),i=function(e){return r.indexOf(e)>-1},t=\"gecko\",o=\"...
[ "0.63365144", "0.6279534", "0.6122125", "0.6112479", "0.60847294", "0.58074266", "0.58074266", "0.58074266", "0.5801848", "0.5783436", "0.5783436", "0.5783436", "0.5783436", "0.5783436", "0.5783436", "0.57709545", "0.57705885", "0.5754153", "0.5750997", "0.5747006", "0.574424...
0.0
-1
returns a new Array with the elements that are in a but not in b
function diff( a, b ) { var result = a.slice(); for ( var i = 0; i < result.length; i++ ) { for ( var j = 0; j < b.length; j++ ) { if ( result[i] === b[j] ) { result.splice(i, 1); i--; break; } } } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayDiff(a, b) {\n let result = []\n\n result = a.filter(ele => !b.includes(ele)) \n \n\n return result\n}", "function array_diff(a, b) {\r\n let finalArr = a.filter(function(a) {\r\n return !b.includes(a)});\r\n return final...
[ "0.82911384", "0.82779413", "0.8142924", "0.8138582", "0.81050986", "0.81028783", "0.7998012", "0.79424125", "0.7909976", "0.7894401", "0.78242", "0.7797435", "0.77629966", "0.77026093", "0.76710844", "0.7670596", "0.7629665", "0.7611424", "0.7599579", "0.7599043", "0.7579853...
0.7138789
53
stack to avoiding loops from circular referencing Call the o related callback with the given arguments.
function bindCallbacks(o, callbacks, args) { var prop = QUnit.objectType(o); if (prop) { if (QUnit.objectType(callbacks[prop]) === "function") { return callbacks[prop].apply(callbacks, args); } else { return callbacks[prop]; // or undefined } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "detail(...args) {\n callback(...args);\n }", "call(callback, ...names) {\n const {\n stack\n } = this;\n const {\n length\n } = stack;\n let value = getLast(stack);\n\n for (const name of names) {\n value = value[name];\n stack.push(name, value);\n }\n...
[ "0.6151141", "0.6016803", "0.57246983", "0.5700363", "0.5602306", "0.55900764", "0.5589768", "0.5587611", "0.5572122", "0.55470407", "0.5535641", "0.5521688", "0.5478867", "0.5468258", "0.5468258", "0.5448612", "0.5448032", "0.54171836", "0.54171836", "0.54130816", "0.5403996...
0.55102986
13
for string, boolean, number and null
function useStrictEquality(b, a) { if (b instanceof a.constructor || a instanceof b.constructor) { // to catch short annotaion VS 'new' annotation of a declaration // e.g. var i = 1; // var j = new Number(1); return a == b; } else { return a === b; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isPrimitive(value){return typeof value==='string'||typeof value==='number'||typeof value==='boolean';}", "function isPrimitive(value){return typeof value==='string'||typeof value==='number'||typeof value==='boolean';}", "function isPrimitive(value){return typeof value==='string'||typeof value==='numbe...
[ "0.7381792", "0.7381792", "0.6962432", "0.68389475", "0.68389475", "0.6703971", "0.6703971", "0.6703971", "0.6703971", "0.66652465", "0.66652465", "0.6602444", "0.6602444", "0.658943", "0.65838563", "0.65795565", "0.65550643", "0.65550643", "0.65550643", "0.65550643", "0.6555...
0.0
-1
Function to populate month name, year, and populate dates (adding or removing table rows as needed)
function printCalendar(year = defaultYearValue, month = defaultMonthValue) { //set defaults for parameters to today's year and date if not provided var thisDate = new Date (year, month); var thisYear = thisDate.getFullYear(); var thisMonth = thisDate.getMonth(); var dateValue = thisDate.getDate(); //returns 1-31 var dayValue = thisDate.getDay(); //returns 0-6 var firstDate = new Date(year, month, 1); var firstDayValue = firstDate.getDay(); //to know which day on first row to start on var numberOfDaysInMonth = new Date(year, month + 1, 0).getDate(); /*console.log("month in print cal: " + month); console.log("year in print cal: " + year);*/ /*Print moth name & year*/ document.getElementById("monthLabel").innerHTML = monthNameArray[month]; document.getElementById("yearLabel").innerHTML = thisYear; /*Add an extra row to table if needed*/ if(numberOfDaysInMonth + firstDayValue > 35){ var row = table.insertRow(6); var cellIdBase = parseInt(35, 10); var numberCellsToAdd = (numberOfDaysInMonth + firstDayValue) - 35; for (var i=0; i< numberCellsToAdd; i++){ var newCellId = cellIdBase + i; row.insertCell(i).setAttribute("id", "c" + newCellId); } } /*Populate calendar dates*/ var i=0; do { document.getElementById("c" + firstDayValue).innerHTML = i+1; dateHolder.push(i+1); i++; firstDayValue++; } while (i<numberOfDaysInMonth); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateMonth(month, year) {\n\n //Initialisieren des 1. gewuenschten Monats month im Jahr year\n var dt = new Date(year, month, 1);\n var ct = 0;\n\n //Ist der 1. eines Monats ein Montag, ansonsten gehe zum letzten Montag vor dem 1.\n while (dt.getDay() !== 1) {\n dt = new Date(year...
[ "0.6735977", "0.6646715", "0.6570881", "0.65015596", "0.6467753", "0.638965", "0.63804156", "0.63526314", "0.6329986", "0.6300602", "0.62774956", "0.6260706", "0.625348", "0.62503475", "0.62444645", "0.62438047", "0.62138647", "0.61977965", "0.6164012", "0.6162928", "0.616261...
0.6637944
2
Function to remove data from calendar so that navigation between months doesn't cause overlap
function clearCalendar() { for (var i = 0; i<35; i++) { document.getElementById("c"+i).innerHTML =""; } if(table.rows.length >6){ table.deleteRow(6); } dateHolder.length =0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function eraseForMonths() {\n eraseDays();\n setUpCalendar(currentDate);\n}", "removeMonthOverview () {\n this.items\n .selectAll ('.item-block-month')\n .selectAll ('.item-block-rect')\n .transition ()\n .duration (this.settings.transition_duration)\n .ease (d3.easeLinear)\n ...
[ "0.77282315", "0.7604135", "0.69815797", "0.6969459", "0.68167526", "0.6565822", "0.65581083", "0.6507041", "0.65002173", "0.6403687", "0.6351278", "0.6313507", "0.62849325", "0.62436", "0.6242865", "0.61985207", "0.61952615", "0.61874694", "0.6182711", "0.61441046", "0.61035...
0.6522502
7
Function to move to next month
function nextMonth(){ clearCalendar(); var newMonth =""; var newYear=0; if (displayedMonth == 11) { newMonth = 0; newYear = displayedYear + 1; displayedMonth = 0; displayedYear = displayedYear + 1; } else { newMonth = displayedMonth+ 1; displayedMonth = displayedMonth + 1; newYear = displayedYear; } //console.log("newMonth: " + newMonth); //console.log("newYear: " + newYear); //console.log("displayedMonth: " + displayedMonth); //console.log("displayedYear: " + displayedYear); printCalendar(newYear, newMonth); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextMonth(){\n setDate(1);\n getStartDay();\n renderDays();\n calendarMonthAndYear.innerText = months[setCal.month] + \" \" + setCal.year;\n }", "function nextMonth() {\n // -- add one month to the viewDate --/\n $directive.viewDate.setDate(1);\n ...
[ "0.8419958", "0.82215583", "0.80941474", "0.80797505", "0.8067942", "0.7876407", "0.7872111", "0.77928907", "0.77617645", "0.76835895", "0.76754457", "0.7644924", "0.7587343", "0.7528253", "0.7501121", "0.7477259", "0.7239996", "0.72141606", "0.7198018", "0.7176866", "0.71271...
0.7657514
11
Function to move to next month
function previousMonth(){ clearCalendar(); var newMonth =""; var newYear=0; if (displayedMonth == 0) { //console.log("IF! 0"); newMonth = 11; newYear = displayedYear - 1; displayedMonth = 11; displayedYear = displayedYear - 1; } else { //console.log("ELSE!"); newMonth = displayedMonth - 1; displayedMonth = displayedMonth - 1; newYear = displayedYear; } // console.log("newMonth: " + newMonth); // console.log("newYear: " + newYear); //console.log("displayedMonth: " + displayedMonth); //console.log("displayedYear: " + displayedYear); printCalendar(newYear, newMonth); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nextMonth(){\n setDate(1);\n getStartDay();\n renderDays();\n calendarMonthAndYear.innerText = months[setCal.month] + \" \" + setCal.year;\n }", "function nextMonth() {\n // -- add one month to the viewDate --/\n $directive.viewDate.setDate(1);\n ...
[ "0.8421461", "0.8221818", "0.80959976", "0.80807745", "0.80692595", "0.7876335", "0.78731066", "0.77936506", "0.7762997", "0.76837665", "0.76770383", "0.76589346", "0.76460993", "0.7588513", "0.7529623", "0.7501605", "0.7479279", "0.7239434", "0.7214741", "0.7199656", "0.7178...
0.0
-1
Do nothing here, as this is not really a 'filter', and we do not want this to filter the httpRequest in any way.
static filterHttpRequest (request) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_request_filter_on_request_page() {}", "filter() {\n\t}", "filter() {\n\t}", "function block() { return new Filter(function () { return false; }); }", "async processRequest(_operationResponse) {\n /* no_op */\n }", "_dummyRequest(request) {\n console.log(\"\\n-------------------...
[ "0.65203387", "0.61868197", "0.61868197", "0.6081533", "0.57972354", "0.57011545", "0.5590274", "0.55641294", "0.55419326", "0.54653203", "0.54418397", "0.54269993", "0.53626436", "0.53607255", "0.53084534", "0.52883613", "0.52758664", "0.52757007", "0.52747136", "0.52747136", ...
0.78771555
0
called when the application loads
function CrearBD(){ //alert("DEBUGGING: we are in the onBodyLoad() function"); if (!window.openDatabase) { alert('Error con la Base de Datos'); return; } db = openDatabase(shortName, version, displayName,maxSize); db.transaction(function(tx){ //tx.executeSql( 'DROP TABLE ViajesGPl',nullHandler,nullHandler); tx.executeSql( 'CREATE TABLE IF NOT EXISTS BDViajes (Ruta TEXT NOT NULL, Magna DECIMAL(18,2) NULL, Premium DECIMAL(18,2) NULL, Diesel DECIMAL(18,2) NULL, Auto TEXT NOT NULL, Litros DECIMAL(18,2) NOT NULL, Combustible TEXT NOT NULL, KilometrajeInicial DECIMAL(18,2) NOT NULL, KilometrajeFinal DECIMAL(18,2) NULL, Rendimiento DECIMAL(18,2) NULL, Fecha DATE NOT NULL)',[],nullHandler,errorHandler); },errorHandler,successCallBack); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "init() {\n // Action to execute on load of the app\n }", "function onLoaded()\n\t{\n\t\twindow.initExhibitorsList();\n\t\twindow.initFloorPlans();\n\t\twindow.initConciege();\n\t\twindow.initAmenities();\n\t\twindow.initVisas();\n\t}", "function applicationLoaded() {\n initiateController();\n }",...
[ "0.74027157", "0.7277106", "0.72681385", "0.71761066", "0.7131263", "0.71186876", "0.7100112", "0.6992198", "0.6959564", "0.69529486", "0.6949132", "0.6934162", "0.6895081", "0.6794033", "0.67488104", "0.6676154", "0.6670383", "0.6658405", "0.6654034", "0.6644819", "0.6642490...
0.0
-1
Package for PCM (Pulsecode modulation) data processing Describes methods for audio processing.
function IAudioRecorder() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function synthesizeAudioData(aPreOutputBuffer, aStartIndex, aAudioFrames) {\n // int zSamplesToProcess=aSamplesPerChannel;\n var zSamples = aAudioFrames * myChannels;\n var zVolChannelZero = Math.floor(((myAUDV[0] << 2) * myVolumePercentage) / 100);\n var zVolChannelOne = Math.floor(((m...
[ "0.6633939", "0.6182436", "0.61664873", "0.5997021", "0.597515", "0.59680074", "0.5922837", "0.5872827", "0.5725503", "0.56994855", "0.5684742", "0.5634318", "0.5585186", "0.55558264", "0.5546597", "0.54904324", "0.5489873", "0.5473008", "0.5442178", "0.54232836", "0.5414246"...
0.49611503
90
valida competidor (tratamento de erros) e adiciona erros no vetor de erros
function validaCompetidor(competidor) { var erros = []; if (competidor.largada.length == 0) { erros.push("A largada não pode ser em branco"); } if (competidor.competidor.length == 0) { erros.push("O competidor não pode ser em branco"); } if (competidor.tempo.length == 0) { erros.push("O tempo não pode ser em branco"); } if (!validaLargada(competidor.largada)) { erros.push("A largada é inválida"); } if (!validaTempo(competidor.tempo)) { erros.push("O tempo é inválido"); } return erros; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doAceptar(){\r\n\tvar error = \"\";\r\n\t$j(\".error\").each( function(){ $j(this).removeClass(\"error\");});\r\n\t\r\n\tif ( $j('#nombre').val().replace(/^\\s*/, '')==\"\" ){\r\n\t\terror += \"<li>Cliente</li>\";\r\n\t\t$j('#nombre').addClass(\"error\");\r\n\t}\r\n\t\r\n\tif ( $j('#email').val().replace(...
[ "0.64757085", "0.64431095", "0.6434141", "0.64282477", "0.6422546", "0.6394693", "0.635704", "0.63330203", "0.6239344", "0.6225913", "0.61776406", "0.61654526", "0.61515427", "0.6139425", "0.61233777", "0.61064094", "0.6090101", "0.60893613", "0.607488", "0.6062314", "0.60511...
0.69003063
0
exibe mensagems de erro
function exibeMensagensDeErro(erros) { var ul = document.querySelector("#mensagens-erro"); ul.innerHTML = ""; erros.forEach(function(erro) { var li = document.createElement("li"); li.textContent = erro; ul.appendChild(li); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function error(msg) {\n alertify.alert('<img src=\"/images/cancel.png\" alt=\"Error\">Error!', msg);\n }", "function fallo() {\n return error(\"Reportar fallo\");\n}", "function error(){\n return \"Invaild e-mail or password!\";\n }", "function mostrarError(err){\n ...
[ "0.72028387", "0.71101004", "0.70031583", "0.6936272", "0.6936272", "0.6926672", "0.69160444", "0.6880918", "0.68707734", "0.68667746", "0.68470687", "0.68379694", "0.68287385", "0.6815974", "0.6811743", "0.67968345", "0.67850876", "0.6782818", "0.67740446", "0.67697686", "0....
0.0
-1
Create a function 'addNumbers' that takes a number as an argument. 'addNumbers' should add up all the numbers from 1 to the number you passed to the function. For example, if the input is 4 then your function should return 10 because 1 + 2 + 3 + 4 = 10. create a function with input number set a condtional if num is less than or equal to 1 return num recursive call return
function addNumbers(num) { if(num <= 1) { return num } return num + addNumbers(num - 1) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numberSum(num) {\n if(num == 1) {\n return 1;\n }\n else {\n return num + numberSum(num - 1);\n }\n}", "function numberSum(num) {\n if(num == 1) {\n return 1;\n }\n else {\n return num + numberSum(num - 1);\n }\n}", "function addNumbers(num){\n let result;\n while (num > 0) {\n ...
[ "0.7538226", "0.7538226", "0.72371554", "0.72154796", "0.70560026", "0.69642884", "0.68568873", "0.6837586", "0.6828734", "0.6780858", "0.6773384", "0.6769926", "0.6680691", "0.6637689", "0.66249305", "0.6622949", "0.6601578", "0.65892774", "0.6589263", "0.65838516", "0.65751...
0.8433195
0
console.log(addNumbers(5)) / Create a function "between50And500" that takes a number as an argument. "between50And500" should return a true if the number passed to it is between 50 and 500 exclusive. For example, if the input is 45 then your function should return false and if the input is 472 it should return true. create a function with input number initialize for loop with index starting at 1, and go up until num set condition if it's true return true if false return false output should be boolean true or false
function between50and500(num) { for(let i = 1; i <= num; i++) { if(num > 50 && num < 500) { return true } else { return false } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function between50and500(num){\n // console.log(num > 50 && num < 500)\n return (num > 50 && num < 500)\n}", "function fiveAndGreaterOnly(numbers) {\n // your code here\n}", "function checkNumber(numbersArray) { return numbersArray >= 5; }", "function fiveEx(p, o) {\n let insideNumber;\n let inbetween...
[ "0.7260147", "0.70935845", "0.6982522", "0.6714427", "0.6622951", "0.6556341", "0.65446925", "0.6505263", "0.65042156", "0.64400035", "0.6432569", "0.6421076", "0.63858145", "0.63853514", "0.6360893", "0.6353601", "0.6346918", "0.63247067", "0.63121563", "0.63110125", "0.6284...
0.778311
0
console.log(between50and500(61), 'this is for 50and500') console.log(between50and500(31), 'should return false') / Create a function "divBy100" that takes a number as an argument. "divBy100" should return a true if the number passed to it is divisible by 100. For example, if the input is 120 then your function should return false and if the input is 600 it should return true. create a function with input num set modular 100; if equals 0; return true else return false
function divBy100(num) { if(num % 100 === 0) { return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function between50and500(num){\n // console.log(num > 50 && num < 500)\n return (num > 50 && num < 500)\n}", "function between50and500(num) {\n for(let i = 1; i <= num; i++) {\n if(num > 50 && num < 500) {\n return true\n } else {\n return false\n }\n }\n}", "function isBetween(num) {\n ...
[ "0.79628634", "0.77896285", "0.7614185", "0.75966084", "0.75555646", "0.7546572", "0.75312537", "0.74327064", "0.7430446", "0.7216211", "0.7165842", "0.71589977", "0.71533215", "0.71323603", "0.7126646", "0.71148235", "0.70952827", "0.7075341", "0.7072521", "0.7064518", "0.70...
0.75709194
4
console.log(divBy100(710)) console.log(divBy100(700)) / Create a function "negativeOrEven" that takes a number as an argument. "negativeOrEven" should return a true if the number passed to it is a negative number OR it is an even number. For example, if the input is 7 then your function should return false and if the input is 3 it should return true. create a function with input number set two conditions; check if the number is less than zero, or if the number mod 2 equals 0 output will be a boolean
function negativeOrEven(num) { if(num < 0 || num % 2 === 0) { return true } else { return false } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function divisible(num) {\nif(num % 100 == 0){\n return true;\n}else\nreturn false;\n\n}", "function divBy100(num) {\n if(num % 100 === 0) {\n return true\n } else {\n return false\n }\n}", "function divBy100(num) {\n return (num % 100 === 0)\n}", "function divisible(num) {\n return...
[ "0.76788616", "0.7634025", "0.74168044", "0.74019736", "0.7308278", "0.72731155", "0.72004133", "0.7180394", "0.71737236", "0.7168937", "0.7160632", "0.7156411", "0.7149154", "0.71377355", "0.71330357", "0.71046287", "0.7091212", "0.70893675", "0.7072615", "0.70600915", "0.70...
0.6933389
44
console.log(negativeOrEven(20)) console.log(negativeOrEven(87)) / Create a function "passAllTests" that takes an array of functions and another value as arguments. Each function in your array will return a boolean value. "passAllTests" should pass your value argument to each function. If all functions in your array return true then "passAllTests" will return true. Otherwise "passAllTests" should return false create a function with input array and value initialize a variable to true loop through the array, set conditional pass each index to the value if true; variable stays true if false; reassign the variable to be false return variable
function passAllTests(arrFuncs, valueArg) { let isTrue = true for(let i = 0; i < arrFuncs.length; i++) { if(arrFuncs[i](valueArg) === true) { isTrue = true } else { return false; } } return isTrue }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function passAllTests(arrOfFuncs, value) {\n for (let i = 0; i < arrOfFuncs.length; i++) {\n if (!arrOfFuncs[i](value)) {\n return false;\n }\n }\n return true;\n}", "function every(arrayArg,test){\n//loop through the array \n for(var i=0; i<arrayArg.length; i++){\n//the array is accepted as an ar...
[ "0.73820233", "0.72553957", "0.72227246", "0.7046869", "0.6879429", "0.68482465", "0.6690346", "0.663028", "0.6598253", "0.6592069", "0.65910125", "0.6527881", "0.6521416", "0.65211225", "0.6484792", "0.6474867", "0.645466", "0.64283454", "0.64189285", "0.640167", "0.6388606"...
0.749197
0
console.log(passAllTests(functionsArr, 250)) console.log(passAllTests(functionsArr, 300)) / Define a function "isPalindrome" that takes a string, and returns a boolean value indicating whether the string is a palindrome (a palindrome is any string that has the same value when reversed for example, "LEVEL" or "RACECAR") create function that reverses, splits, joins input string set new string varialbe to an empty string split, reverse, then join return the newstring create palindrome function with input string set condtional with string and see if it equals invoking reverse funtion with string passed in
function reverse(string) { let split = "" split = string.split('').reverse().join('') return split }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkPal(string){\n var newSplitString = string.split('');\n console.log(`Split String : ${newSplitString}`);\n var newReverseString = newSplitString.reverse();\n console.log(`Reverse string : ${newReverseString}`);\n var newJoinString = newReverseString.join(\"\");\n console.log(`Join s...
[ "0.7133543", "0.70340705", "0.70277864", "0.69195074", "0.6897911", "0.6885694", "0.68594754", "0.68586373", "0.6825957", "0.6812347", "0.68109417", "0.67944103", "0.67717206", "0.6755872", "0.67464024", "0.6735601", "0.67330545", "0.6683324", "0.66658145", "0.66404724", "0.6...
0.0
-1
console.log(isPalindrome("LEVEL")) console.log(isPalindrome("hello")) / Create a function "add" that takes an argument (a number) and returns a function. The returned function should also take one argument (a number) and return the sum of its argument and the argument that was originally past to "add" Example: const addBy10 = add(10) addBy10(20) > 30 create a function with input number output should return a function which takes one argument (number) returns sum of it's argument and the argument in the previous function
function addTen(num) { return function addNum(n) { return num + n; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addingMath(num, addingFunction){\r\n return num + addingFunction();//we have to \r\n}", "function palindrome(a,call)\n{\nvar res=0;\nvar s='';\nvar n=[];\nif(call(a)==a)\n{\nreturn \"palindrome\"\n}\nelse\n{\nreturn \"not a palindorme\"\n}\n}", "function add(){\n let sumFunc = sumOfThirty(...
[ "0.6575899", "0.6277251", "0.62276244", "0.6214441", "0.6105831", "0.6091405", "0.6056858", "0.60514385", "0.6028215", "0.60084933", "0.5997353", "0.5993668", "0.599056", "0.59902596", "0.59902596", "0.59881383", "0.59853625", "0.59779406", "0.59684795", "0.59634864", "0.5952...
0.57789606
73
console.log(added10(5)) Write a function "getLength" that returns the length of a string. Accomplish this without using any loops, native JS methods, or the length property. create a function with input string set base case through string length counting down by 1 until string length is = 1 output string length
function getLength(string, index = 0) { if(string[index] === undefined) { return index; } return getLength(string, index + 1) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RunLength(str) {\n\n // code goes here\n return str\n\n}", "function stringLength(string,count=0){\n if ( string.slice(0) === \"\" ) return count; //console.log(count);\n return stringLength(string.slice(1),count+1);\n}", "function stringLength(str){\nvar result =0;\nwhile(str != \"\"){\n\n \t...
[ "0.783266", "0.76564664", "0.745688", "0.7421909", "0.7202736", "0.71726745", "0.7168809", "0.7145943", "0.7049176", "0.70311135", "0.703008", "0.7013376", "0.7009365", "0.69934535", "0.694041", "0.694041", "0.694041", "0.69090796", "0.68500656", "0.6821083", "0.68207264", ...
0.6717058
26
set the path to use in the fetch request
setPath (callback) { // provide random parameter "thisparam", which will be rejected this.path = `/posts?teamId=${this.team.id}&streamId=${this.teamStream.id}&thisparam=1`; callback(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fetchPath( newpath: string ) {\n fetch( '/files', {\n method: 'post',\n headers: {\n 'Content-type': 'application/json'\n },\n body: JSON.stringify({\n path: this.getCWD() ? path.resolve( this.getCWD(), newpath ) : './'\n }...
[ "0.7036319", "0.6580499", "0.6518277", "0.6421893", "0.62237376", "0.6179531", "0.61403465", "0.60616136", "0.6027527", "0.5963468", "0.5950418", "0.5926494", "0.5795893", "0.5795686", "0.5791057", "0.57902193", "0.57832074", "0.5776752", "0.577005", "0.5751301", "0.5745839",...
0.55161095
33
Override to use PatternVisitor we overrode.
visitPattern(node, options, callback) { if (!node) { return; } if (typeof options === 'function') { callback = options; options = { processRightHandNodes: false }; } const visitor = new PatternVisitor(this.options, node, callback); visitor.visit(node); if (options.processRightHandNodes) { visitor.rightHandNodes.forEach(this.visit, this); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Pattern() {\n }", "constructor(pattern){\n //\n //Construct the parent.\n super(pattern);\n }", "constructor(pattern){\n //\n //Consturct the super constructor.\n super(pattern,'g');\n }", "function STIXPatternListener() {\n\tantlr4.tree.ParseTr...
[ "0.67489964", "0.65757245", "0.64462817", "0.60840034", "0.6071314", "0.59319896", "0.5829151", "0.5826701", "0.5817403", "0.57974076", "0.57974076", "0.57974076", "0.5744598", "0.56779313", "0.5649064", "0.5591914", "0.5550594", "0.5535888", "0.55266243", "0.5436963", "0.542...
0.6803011
0
Override. Visit `node.typeParameters` and `node.returnType` additionally to find `typeof` expressions.
visitFunction(node) { const { type, id, typeParameters, params, returnType, body } = node; const scopeManager = this.scopeManager; const upperScope = this.currentScope(); // Process the name. if (type === types_1.AST_NODE_TYPES.FunctionDeclaration && id) { upperScope.__define(id, new experimental_utils_1.TSESLintScope.Definition('FunctionName', id, node, null, null, null)); // Remove overload definition to avoid confusion of no-redeclare rule. const { defs, identifiers } = upperScope.set.get(id.name); for (let i = 0; i < defs.length; ++i) { const def = defs[i]; if (def.type === 'FunctionName' && def.node.type === types_1.AST_NODE_TYPES.TSDeclareFunction) { defs.splice(i, 1); identifiers.splice(i, 1); break; } } } else if (type === types_1.AST_NODE_TYPES.FunctionExpression && id) { scopeManager.__nestFunctionExpressionNameScope(node); } // Open the function scope. scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); const innerScope = this.currentScope(); // Process the type parameters this.visit(typeParameters); // Process parameter declarations. for (let i = 0; i < params.length; ++i) { this.visitPattern(params[i], { processRightHandNodes: true }, (pattern, info) => { if (pattern.type !== types_1.AST_NODE_TYPES.Identifier || pattern.name !== 'this') { innerScope.__define(pattern, new experimental_utils_1.TSESLintScope.ParameterDefinition(pattern, node, i, info.rest)); this.referencingDefaultValue(pattern, info.assignments, null, true); } }); } // Process the return type. this.visit(returnType); // Process the body. if (body && body.type === types_1.AST_NODE_TYPES.BlockStatement) { this.visitChildren(body); } else { this.visit(body); } // Close the function scope. this.close(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TypeofTypeAnnotation(node, print) {\n\t this.push(\"typeof \");\n\t print.plain(node.argument);\n\t}", "function TypeofTypeAnnotation(node, print) {\n\t this.push(\"typeof \");\n\t print.plain(node.argument);\n\t}", "function TypeofTypeAnnotation(node, print) {\n this.push(\"typeof \");\n print....
[ "0.63855946", "0.63855946", "0.6337871", "0.5985986", "0.59039664", "0.5822962", "0.58082587", "0.5699378", "0.56935424", "0.56851244", "0.5678837", "0.5678837", "0.56318885", "0.5628263", "0.5606798", "0.5586454", "0.5550081", "0.5525175", "0.5507126", "0.5359425", "0.535604...
0.49115095
80
Override. Don't create the reference object in the type mode.
Identifier(node) { this.visitDecorators(node.decorators); if (!this.typeMode) { super.Identifier(node); } this.visit(node.typeAnnotation); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getReference() {\n mustInherit();\n }", "function ReferenceToObject(o, r, f) {\n // TODO : seems like I should output the desiredClass information here\n // maybe all references have a name, index, etc. and then the are either undefined\n // what about clobber, can I get an index in an index and then that wo...
[ "0.5769283", "0.5671791", "0.56470495", "0.5646003", "0.5646003", "0.5646003", "0.5646003", "0.5640608", "0.5627695", "0.5627695", "0.5600289", "0.5600289", "0.55617654", "0.555032", "0.55361533", "0.5532351", "0.55198705", "0.55198705", "0.5494705", "0.54331046", "0.5418186"...
0.0
-1
Don't create the reference object for the key if not computed.
ClassProperty(node) { const upperTypeMode = this.typeMode; const { computed, decorators, key, typeAnnotation, value } = node; this.typeMode = false; this.visitDecorators(decorators); if (computed) { this.visit(key); } this.typeMode = true; this.visit(typeAnnotation); this.typeMode = false; this.visit(value); this.typeMode = upperTypeMode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shallowProperty(key) {\n return function(obj) {\n return obj == null ? void 0 : obj[key];\n };\n }", "function shallowProperty(key) {\n return function(obj) {\n return obj == null ? void 0 : obj[key];\n };\n }", "function shallowProperty(key) {\n return function(obj) {\n ...
[ "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5897251", "0.5612076", "0.55985045", "0.55828106", "0.55572534", "0.55173606", "0.55173606", "0.55028814", "0.55028814", "0.5476353", "0.5472209", "0.545235", "0.545235"...
0.0
-1
Override. Visit call expression.
CallExpression(node) { this.visitTypeParameters(node); this.visit(node.callee); node.arguments.forEach(this.visit, this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CallExpression(node, print) {\n\t print.plain(node.callee);\n\n\t this.push(\"(\");\n\n\t var isPrettyCall = node._prettyCall && !this.format.retainLines && !this.format.compact;\n\n\t var separator;\n\t if (isPrettyCall) {\n\t separator = \",\\n\";\n\t this.newline();\n\t this.indent();\n\t...
[ "0.7055646", "0.7055646", "0.6912887", "0.6781301", "0.67125803", "0.67125803", "0.6670544", "0.6592914", "0.6406094", "0.62578416", "0.6112439", "0.61092705", "0.6025362", "0.5993078", "0.5987108", "0.59021384", "0.58816135", "0.58739346", "0.58288455", "0.5779929", "0.57426...
0.76877934
0
Visit optional member expression.
OptionalMemberExpression(node) { this.visit(node.object); if (node.computed) { this.visit(node.property); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isMemberOptional(node) {\n switch (node.type) {\n case utils_1.AST_NODE_TYPES.TSPropertySignature:\n case utils_1.AST_NODE_TYPES.TSMethodSignature:\n case utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition:\n case utils_1.AST_NODE_TYPES.PropertyDefinition:\n case uti...
[ "0.72638094", "0.60792464", "0.575961", "0.5671042", "0.5537067", "0.5537067", "0.5438472", "0.5438472", "0.5438472", "0.52460855", "0.5189921", "0.51878893", "0.51337385", "0.5067663", "0.5032017", "0.50065076", "0.5001416", "0.49751812", "0.49751812", "0.49579543", "0.49163...
0.82389426
0
Visit optional call expression.
OptionalCallExpression(node) { this.visitTypeParameters(node); this.visit(node.callee); node.arguments.forEach(this.visit, this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isOptionalOptionalCallExpression(node) {\n return (node.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression &&\n // this flag means the call expression itself is option\n // i.e. it is foo.bar?.() and not foo?.bar()\n node.optional);\n}", "function parseNoCallExpr() {\n c...
[ "0.75082976", "0.63943857", "0.6356074", "0.6276941", "0.5937039", "0.5763123", "0.5743164", "0.5663026", "0.55844384", "0.5575244", "0.5541972", "0.5541972", "0.5541972", "0.5448456", "0.5429165", "0.5429165", "0.5428071", "0.5418215", "0.5410078", "0.5410078", "0.5336382", ...
0.8270302
0
Define the variable of this function declaration only once. Because to avoid confusion of `noredeclare` rule by overloading.
TSDeclareFunction(node) { const scopeManager = this.scopeManager; const upperScope = this.currentScope(); const { id, typeParameters, params, returnType } = node; // Ignore this if other overload have already existed. if (id) { const variable = upperScope.set.get(id.name); const defs = variable === null || variable === void 0 ? void 0 : variable.defs; const existed = defs === null || defs === void 0 ? void 0 : defs.some((d) => d.type === 'FunctionName'); if (!existed) { upperScope.__define(id, new experimental_utils_1.TSESLintScope.Definition('FunctionName', id, node, null, null, null)); } } // Open the function scope. scopeManager.__nestEmptyFunctionScope(node); const innerScope = this.currentScope(); // Process the type parameters this.visit(typeParameters); // Process parameter declarations. for (let i = 0; i < params.length; ++i) { this.visitPattern(params[i], { processRightHandNodes: true }, (pattern, info) => { innerScope.__define(pattern, new experimental_utils_1.TSESLintScope.ParameterDefinition(pattern, node, i, info.rest)); // Set `variable.eslintUsed` to tell ESLint that the variable is used. const variable = innerScope.set.get(pattern.name); if (variable) { variable.eslintUsed = true; } this.referencingDefaultValue(pattern, info.assignments, null, true); }); } // Process the return type. this.visit(returnType); // Close the function scope. this.close(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function foo() {\n a = 1; // no declaration\n}", "function foo() {\n\ta = 1;\t// `a` not formally declared\n}", "function foo() {\n\ta = 3;\n\n\t//console.log( a );\t// 3\n\n\tvar a;\t\t\t\t// declaration is \"hoisted\"\n // to the top of `foo()`\n}", "function foo() {\n a = 3;\n...
[ "0.6452602", "0.64449865", "0.6136066", "0.6061973", "0.6027008", "0.6012318", "0.5997244", "0.5997244", "0.59782624", "0.5847118", "0.58056253", "0.5783792", "0.5744532", "0.5698111", "0.569544", "0.5693675", "0.5657812", "0.55944777", "0.55708855", "0.5560843", "0.55068755"...
0.58068705
10
Create reference objects for the references in parameters and return type.
TSEmptyBodyFunctionExpression(node) { const upperTypeMode = this.typeMode; const { typeParameters, params, returnType } = node; this.typeMode = true; this.visit(typeParameters); params.forEach(this.visit, this); this.visit(returnType); this.typeMode = upperTypeMode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ReferenceToObject(o, r, f) {\n // TODO : seems like I should output the desiredClass information here\n // maybe all references have a name, index, etc. and then the are either undefined\n // what about clobber, can I get an index in an index and then that would not work\n // should the second loop be doi...
[ "0.6230035", "0.5872314", "0.5870682", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.5867747", "0.57621855", "0.57524574", "0.57404864", "0.57404864", "0.5694966",...
0.0
-1
Don't make variable because it declares only types. Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
TSInterfaceDeclaration(node) { this.visitTypeNodes(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_type() {\n tree.addNode('type', 'branch');\n if (foundTokensCopy[parseCounter][1] == 'int') {\n match('int', parseCounter);\n parseCounter++;\n } else if (foundTokensCopy[parseCounter][1] == 'string') {\n match('string', parseCounter);\n parseCounter++;\n } el...
[ "0.58858746", "0.58368564", "0.5826715", "0.57162446", "0.5668555", "0.5668555", "0.5585563", "0.5585563", "0.55811375", "0.55398476", "0.5510413", "0.5464499", "0.5436088", "0.54202086", "0.5418953", "0.5368937", "0.5345962", "0.53455883", "0.5313088", "0.529631", "0.5277158...
0.0
-1
Don't make variable because it declares only types. Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
TSClassImplements(node) { this.visitTypeNodes(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_type() {\n tree.addNode('type', 'branch');\n if (foundTokensCopy[parseCounter][1] == 'int') {\n match('int', parseCounter);\n parseCounter++;\n } else if (foundTokensCopy[parseCounter][1] == 'string') {\n match('string', parseCounter);\n parseCounter++;\n } el...
[ "0.58864784", "0.5839879", "0.5824313", "0.57177603", "0.5672717", "0.5672717", "0.55865353", "0.55865353", "0.55816233", "0.55388767", "0.55121714", "0.54630387", "0.54358697", "0.5420922", "0.5420816", "0.53716373", "0.53464085", "0.5344339", "0.53124994", "0.5295558", "0.5...
0.0
-1
Don't make variable because it declares only types. Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
TSIndexSignature(node) { this.visitTypeNodes(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_type() {\n tree.addNode('type', 'branch');\n if (foundTokensCopy[parseCounter][1] == 'int') {\n match('int', parseCounter);\n parseCounter++;\n } else if (foundTokensCopy[parseCounter][1] == 'string') {\n match('string', parseCounter);\n parseCounter++;\n } el...
[ "0.58845335", "0.5837593", "0.5822618", "0.5714619", "0.56684077", "0.56684077", "0.5583225", "0.5583225", "0.5580578", "0.5539787", "0.5508642", "0.5459345", "0.54351276", "0.5418386", "0.54161954", "0.53692025", "0.53459704", "0.5343195", "0.5309313", "0.52924657", "0.52745...
0.0
-1
Switch to the type mode and visit child nodes to find `typeof x` expression in type declarations.
TSTypeAnnotation(node) { this.visitTypeNodes(node); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parse_type() {\n tree.addNode('type', 'branch');\n if (foundTokensCopy[parseCounter][1] == 'int') {\n match('int', parseCounter);\n parseCounter++;\n } else if (foundTokensCopy[parseCounter][1] == 'string') {\n match('string', parseCounter);\n parseCounter++;\n } el...
[ "0.61191785", "0.5871666", "0.5708964", "0.5628587", "0.5628587", "0.5404643", "0.53770334", "0.5364447", "0.53539765", "0.53539765", "0.53485525", "0.53485525", "0.53423786", "0.53335994", "0.52903", "0.527996", "0.527996", "0.52652687", "0.52536625", "0.52406645", "0.515614...
0.0
-1
Set the renderer dimensions to the max dimension of the canvas. This assumes a 1:1 aspect ratio but improves the output resolution.
updateRenderDimensions(window) { const maxDimension = Math.max(this.renderer.domElement.clientWidth, this.renderer.domElement.clientHeight); // Set the pixel ratio to set the correct resolution for high PPI displays. this.renderer.setPixelRatio(window.devicePixelRatio); this.renderer.setSize(maxDimension, maxDimension, false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resizeRendererToDisplaySize(renderer) {\n const canvas = renderer.domElement;\n const width = canvas.clientWidth;\n const height = canvas.clientHeight;\n if (canvas.width !== width || canvas.height !== height) {\n renderer.setSize(width, height, false);\n camera.aspect = width / height;\n cam...
[ "0.7195864", "0.70655566", "0.6999726", "0.6969948", "0.6908046", "0.6898273", "0.6883981", "0.6883981", "0.6883981", "0.6874813", "0.6862567", "0.6803807", "0.6799166", "0.6738441", "0.67171466", "0.6690709", "0.66885686", "0.66601175", "0.66293794", "0.6617392", "0.6540151"...
0.7074093
1
var isFunction = require('ampisfunction'); var isString = require('ampisstring'); Operations Validates blank values using ampisempty.
function _validateIsNotBlank(def){ return !isEmpty(def.attrValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_Blank(input) {\n return input === \"\";\n}", "function isemptyornull(value)\n {\n return !(typeof value === \"string\" && value.length > 0);\n }", "function isBlank(a) {\n\n var result;\n\n if(typeof a !== \"string\"){\n\n result = \"Input in not a string\";\n }\n else{\n ...
[ "0.68257105", "0.67737716", "0.6753433", "0.65869224", "0.6528154", "0.6528154", "0.6528154", "0.64979964", "0.64329606", "0.64114463", "0.6363601", "0.6285536", "0.62772655", "0.62772655", "0.6268604", "0.6246536", "0.62436664", "0.624187", "0.62308824", "0.6197532", "0.6187...
0.6212462
19
Validates email types using regex.
function _validateIsEmail(def){ var emailRegEx = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/i; return emailRegEx.test(def.attrValue); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate(email) {\n const expression = /(?!.*\\.{2})^([a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+(\\.[a-z\\d!#$%&'*+\\-\\/=?^_`{|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+)*|\"((([ \\t]*\\r\\n)?[ \\t]+)?([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\...
[ "0.7049878", "0.7049878", "0.69638234", "0.6949918", "0.6941737", "0.68965524", "0.68579966", "0.68572617", "0.68569", "0.6833825", "0.6832657", "0.6811848", "0.67991656", "0.6786166", "0.67670184", "0.67631036", "0.6736413", "0.6732129", "0.672803", "0.6708648", "0.670558", ...
0.0
-1
2) Get even 1000 Write a function that would get the sum of all the even numbers from 1 to 1000. You may use a modulus operator for this exercise.
function p2(){ var sum = 2; for (var i = 0; i <= 1000; i += 2) { sum += i } console.log(sum) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getEvenTo1000(){\n var sum = 0;\n for (let i = 0; i < 1001; i++) {\n if (i % 2 === 0) {\n sum = sum + i;\n }\n else { }\n }\n return sum;\n}", "function even(){\n\n var sum=0;\n for (var i=1;i<=1000;i++){\n if(i%2===0){\n sum = sum + i;...
[ "0.8794161", "0.8728479", "0.8694277", "0.85407156", "0.85249156", "0.84369636", "0.84103787", "0.83410627", "0.82883567", "0.8211501", "0.80717033", "0.80698", "0.8033441", "0.80173373", "0.79497075", "0.7912", "0.7905024", "0.784779", "0.7805671", "0.77900153", "0.7786158",...
0.71928567
53
3) Sum odd 5000 Write a function that returns the sum of all the odd numbers from 1 to 5000. (e.g. 1+3+5+...+4997+4999).
function p3(){ var sum = 0; for (var i = 1; i <= 5000; i += 2) { sum += i console.log(sum) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sum_odd_5000() {\n var sum = 0;\n for(var i = 1; i <= 5000; i++) {\n if (i % 2 === 1)\n sum += i;\n }\n return sum; \n}", "function sumOdd5000() {\n var sum = 0;\n for (var i=1; i < 5001; i += 2) {\n sum += i;\n }\n return sum;\n}", "function sumOdd5000(){\n var...
[ "0.9221249", "0.9126858", "0.9107496", "0.9077863", "0.89906025", "0.8914302", "0.88922673", "0.8888605", "0.88254225", "0.8723807", "0.86246985", "0.85700715", "0.8545162", "0.8492023", "0.843178", "0.8409407", "0.83609897", "0.80882657", "0.7953452", "0.794784", "0.7937302"...
0.7573506
29
4) Iterate an array Write a function that returns the sum of all the values within an array. (e.g. [1,2,5] returns 8. [5,2,5,12] returns 14).
function p4(){ var arr = [1,3,2,4,36,43,6,5,98] var sum = 0 for(var i =0; i < arr.length; i++){ sum += arr[i] } console.log("The sum of all values within the array is: " + sum) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iterArray(arr){\n var sum = 0;\n for(var i = 0; i < arr.length; i++){\n sum += arr[i];\n }\n return sum;\n}", "function sumArray(array){\n var total = 0;\n array.forEach(function(element){\n total += element;\n });\n return total;\n}", "function sum(array) {\n ...
[ "0.837891", "0.82869095", "0.82690966", "0.824598", "0.82402873", "0.823698", "0.82215154", "0.82206374", "0.8201376", "0.81974834", "0.819674", "0.8194736", "0.8177565", "0.81337255", "0.813273", "0.8130468", "0.8127297", "0.812674", "0.8126363", "0.81220233", "0.81188697", ...
0.8223445
6
5) Find max Given an array with multiple values, write a function that returns the maximum number in the array. (e.g. for [3,3,5,7] max is 7)
function p5(){ var arr = [1,3,22,43,65,103,1002,1738,1990,1776] var sum = 0 for(var i = 0; i < arr.length; i++){ if(arr[i] > sum){ sum = arr[i] } } console.log("The largest number in the array is: " + sum) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maxNumber (arr)\n{\n var maximum = arr.reduce((max, x) => {\n if (x>max)\n { max =x;}\n return max\n } )\n return maximum\n}", "function findMax(arr){\n //sort the array\n //Math.max\n //array.reduce\n //use for loops and if statements\n //return Math.max(...arr);\n return arr.reduce(fu...
[ "0.85597146", "0.8540721", "0.8534123", "0.8513138", "0.85048735", "0.8481239", "0.8481239", "0.84763986", "0.8434584", "0.8398678", "0.8386918", "0.8371824", "0.83488256", "0.83172756", "0.8315867", "0.83098435", "0.82916373", "0.8289263", "0.82834613", "0.8275617", "0.82571...
0.0
-1
6) Find average Given an array with multiple values, write a function that returns the average of the values in the array. (e.g. for [1,3,5,7,20] average is 7.2)
function p6(){ var arr = [1,2,3,5,8,13,21,34,55,89,144] var sum = 0 for(var i = 0; i < arr.length; i++){ sum += arr[i] } console.log(sum/(arr.length)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function average(array){\n function plus(a, b){return a + b;}\n return array.reduce(plus) / array.length;\n}", "function average(array){\n function plus(a,b){return a+b}\n return array.reduce(plus)/array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return ...
[ "0.87091875", "0.86927575", "0.86758924", "0.86673576", "0.86673576", "0.86673576", "0.86673576", "0.86673576", "0.86673576", "0.8662099", "0.86403024", "0.85842294", "0.8576306", "0.8544517", "0.8512853", "0.84769696", "0.84722537", "0.8397271", "0.8371834", "0.8366835", "0....
0.0
-1
7) Array odd Write a function that would return an array of all the odd numbers between 1 to 50. (ex. [1,3,5, .... , 47,49]). Hint: Use 'push' method.
function p7(){ var arr = [] for(var i = 1; i <= 50; i+=2){ arr.push(i) } console.log(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function arrayOdd() {\n var oddArray = [];\n for (var i = 1; i <= 50; i+=2) {\n oddArray.push(i);\n }\n return oddArray;\n}", "function oddArray() {\n var arr = [];\n for (var x = 1; x < 50; x += 2) {\n arr.push(x);\n }\n return arr;\n}", "function oddArray(){\n var arr = [];\n ...
[ "0.8912246", "0.8872447", "0.88683295", "0.88320094", "0.8778048", "0.8737963", "0.8583755", "0.8543643", "0.8535137", "0.82505554", "0.8235098", "0.8173817", "0.816292", "0.8135569", "0.807366", "0.8066324", "0.80208826", "0.79693913", "0.79565895", "0.7951082", "0.7949407",...
0.7002591
100
8) Greater than Y Given value of Y, write a function that takes an array and returns the number of values that are greater than Y. For example if arr = [1, 3, 5, 7] and Y = 3, your function will return 2. (There are two values in the array greater than 3, which are 5, 7).
function p8(){ var arr = [17, 38, 19, 20, 32, 43, 2, 11, 4, 5] var Y = 12 var larger_than = [] for(var i = 0; i < arr.length; i++){ if(arr[i] > Y){ larger_than.push(arr[i]) } } console.log("Numbers larger than " + Y + " within the array are: " + larger_than) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countGreaterThanY(arr, y) {\n var numGreater = 0;\n for (var idx = 0; idx < arr.length; idx++) {\n if (arr[idx] > y) {\n numGreater++;\n }\n }\n return numGreater;\n}", "function greaterThanY(Y, arr){\n var count = 0;\n for(var i = 0; i < arr.length; i++){\n if(arr[i]>Y){\n ...
[ "0.88155645", "0.87742877", "0.8772824", "0.87362367", "0.8684592", "0.86790687", "0.8675227", "0.8670105", "0.862979", "0.8606897", "0.85405385", "0.853396", "0.8526716", "0.8523648", "0.8507895", "0.84632224", "0.8434777", "0.83644706", "0.83351195", "0.8299406", "0.829411"...
0.708276
29
9) Squares Given an array with multiple values, write a function that replaces each value in the array with the value squared by itself. (e.g. [1,5,10,2] will become [1,25,100,4])
function p9(){ var arr = [1,2,4,7,33,55,66,88] for(var i = 0; i < arr.length; i++){ arr[i] = arr[i]*arr[i] } console.log(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SQuaresSquared(arr){\n for(var i = 0; i < arr.length; i++){\n arr[i] = arr[i]*arr[i];\n }\n return arr;\n}", "function squareArrayVals(arr){\n for(var i = 0; i < arr.length; i++){\n arr[i] = (arr[i] * arr[i])\n }\n return arr\n}", "function squares(arr){\n for(var i ...
[ "0.8130761", "0.78821343", "0.7824325", "0.7817531", "0.77919346", "0.77744603", "0.7734327", "0.7673395", "0.7530698", "0.7527638", "0.7424121", "0.7419324", "0.7408079", "0.7399192", "0.7378144", "0.735342", "0.7272865", "0.72574", "0.7237682", "0.7193447", "0.7173531", "...
0.0
-1
10) Negatives Given an array with multiple values, write a function that replaces any negative numbers within the array with the value of 0. When the program is done the array should contain no negative values. (e.g. [1,5,10,2] will become [1,5,10,0])
function p10(){ var arr = [-9,-10,12,3,-32,100,-1998] for(var i = 0; i < arr.length; i++){ if(arr[i] < 0){ arr[i] = 0 } } console.log(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function negatives(array) {\n for (let i = 0; i < array.length; i++) {\n if(array[i] < 0) { \n array[i] = 0;\n }\n }\n return array;\n}", "function replaceNeg(arr){\n for(var i=0; i<arr.length; i++){\n if(arr[i]<0){\n arr[i]=0\n }\n }return arr\n}"...
[ "0.86403114", "0.86280984", "0.8492917", "0.84445477", "0.840872", "0.83871174", "0.83700716", "0.836258", "0.8332362", "0.83158", "0.8283551", "0.82716215", "0.8217308", "0.81506956", "0.8114748", "0.8097823", "0.79903525", "0.79620814", "0.79329264", "0.79055554", "0.783504...
0.76180744
25
11) Max/Min/Avg Given an array with multiple values, write a function that returns a new array that only contains the maximum, minimum, and average values of the original array. (e.g. [1,5,10,2] will return [10,2,3.5])
function p11(){ var arr = [1,3,2,-4,3,5,4,6,-5,7,6,88,77,-99,88,90,-10]; var max = 0; var min = arr[0] var avg = 0; for(var i = 0; i < arr.length; i++){ if(arr[i] > max){ max = arr[i] } if(arr[i] < min){ min = arr[i] } avg += arr[i] } avg = avg/arr.length var newArr = [max, min, avg] console.log("Original Array: [" + arr + "]") console.log("Max/Min/Avg: [" + newArr + "]") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maxMinAvg(arr) {\n var max = arr[0];\n var min = arr[0];\n var sum = 0;\n\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] > max) {\n max = arr[i];\n }\n if (arr[i] < min) {\n min = arr[i];\n }\n sum = sum + arr[i];\n }\n var ...
[ "0.8295701", "0.82508343", "0.8150177", "0.8136577", "0.8135827", "0.8084319", "0.80052274", "0.798307", "0.79231626", "0.7884989", "0.77726084", "0.7715729", "0.7684641", "0.76652175", "0.7654247", "0.7458532", "0.74524087", "0.7428627", "0.74209917", "0.737351", "0.73169416...
0.7792663
10
12) Swap Values Write a function that will swap the first and last values of any given array. The default minimum length of the array is 2. (e.g. [1,5,10,2] will become [2,5,10,1]).
function p12(){ var arr = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] var n1 = arr[0] var n2 = arr[arr.length-1] arr[0] = n2 arr[arr.length-1] = n1 console.log(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function swapVals(arr){\n var first = arr[0];\n arr[0] = arr[arr.length-1];\n arr[arr.length-1] = first;\n return arr;\n}", "function swapValues(array){\n debugger; // debugger command for stepping through code in Chrome\n // set the temp variable to the first value of the given array\n var temp ...
[ "0.8122806", "0.8072072", "0.7945784", "0.7831593", "0.7822957", "0.77631676", "0.7743691", "0.7736898", "0.7690334", "0.7685119", "0.75811106", "0.74375814", "0.7416314", "0.7374409", "0.73619366", "0.73575324", "0.72803885", "0.7273154", "0.72586143", "0.72502023", "0.72199...
0.0
-1
13) Number to String Write a function that takes an array of numbers and replaces any negative values within the array with the string 'Dojo'. For example if array = [1,3,2], your function will return ['Dojo','Dojo',2].
function p13(){ var arr = [-9,-10,12,3,-32,100,-1998] for(var i = 0; i < arr.length; i++){ if(arr[i] < 0){ arr[i] = "Dojo" } } console.log(arr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function num2Str(arr){\n var d = \"Dojo\";\n for(var i = 0; i < arr.length; i++){\n if(arr[i] < 0){\n arr[i] = d;\n }\n }\n return arr;\n}", "function numToString(arr){\n for(var i = 0; i < arr.length; i++){\n if(arr[i] < 0){\n arr[i] = 'Dojo';\n }...
[ "0.7996186", "0.796169", "0.7887625", "0.7872084", "0.7707387", "0.7668621", "0.76547277", "0.75346446", "0.75113815", "0.74068165", "0.7074837", "0.7023538", "0.7022329", "0.69146156", "0.68901455", "0.6883047", "0.6878468", "0.68550646", "0.6763038", "0.66701037", "0.665059...
0.6330898
29
properties available to the custom element for data binding
static get properties() { return {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get properties() {\n return {\n label: { type: String },\n value: { type: String },\n disabled: { type: Boolean, reflect: true },\n elevation: { type: Number },\n active: { type: Boolean, reflect: true },\n comingSoon: { type: Boolean, reflect: true, attribute: \"coming-soon...
[ "0.668546", "0.64624363", "0.6427632", "0.6226598", "0.6086092", "0.60113764", "0.6001949", "0.59134644", "0.590591", "0.5884135", "0.5877634", "0.5873419", "0.5869708", "0.586739", "0.58648336", "0.5831849", "0.58224875", "0.5808076", "0.5805191", "0.58017135", "0.5791363", ...
0.0
-1
Store the tag name to make it easier to obtain directly.
static get tag() { return "hax-text-editor-oer-schema"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTag(tagName) {\n const tag = {\n tag: tagName,\n value: this.__tags[tagName]\n };\n return tag;\n }", "function addTag (name) {\n $('#post_current_tags').val(function () {\n return $(this).val().concat(name, ',')\n })\n $('.current-tags').append(\"<s...
[ "0.6634083", "0.66041034", "0.6557285", "0.6557285", "0.6557285", "0.6557285", "0.65389186", "0.65389186", "0.65389186", "0.65389186", "0.6377864", "0.6283098", "0.626847", "0.62257195", "0.6206882", "0.6186045", "0.6184868", "0.61273026", "0.6070542", "0.6002654", "0.5938993...
0.0
-1
On success, store the result and process the next query.
function handleResult(result) { results.push(result); doInsert(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function query_promise_then(result) {\n my_query.done.query=true;\n submit_if_done();\n }", "async processResults(results, document, queryEngine) {\n const sparql = \"INSERT {\\n\".concat(results.map(r => r.insert).join(''), \"}\");\n await queryEngine.executeUpdate(sparql, document).next(...
[ "0.7003667", "0.6379934", "0.6334382", "0.63128835", "0.631201", "0.6074901", "0.6074901", "0.6068354", "0.60439724", "0.6020442", "0.59556055", "0.592259", "0.5914238", "0.5910801", "0.5895733", "0.5869585", "0.5869585", "0.5807305", "0.57742894", "0.57690305", "0.57608014",...
0.66331327
1
Reject the promise on failure.
function handleError(err) { defer.reject(err); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static reject(error) { return new StatefulPromise(Promise.reject(error)) }", "reject() {\n return Promise.reject(this);\n }", "reject() {\n if (!this._promise) {\n return;\n }\n this._resolve();\n }", "function promiseReject(err) {\n\t\t\treturn _resolve(rejected(err));...
[ "0.7628036", "0.7586068", "0.75513655", "0.74893683", "0.74893683", "0.7287908", "0.7202638", "0.71881443", "0.71757406", "0.71336883", "0.709393", "0.70612514", "0.7008286", "0.6957874", "0.6947702", "0.6947702", "0.691996", "0.68453455", "0.6828517", "0.6828517", "0.6828517...
0.0
-1
Check user's authentication, if not logged in, redirect user to log in page
function authenticationMiddleware () { return function (req, res, next){ console.log('user:', req.session.passport.user); if (req.isAuthenticated()) { return next(); }else{ res.redirect('signin'); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLoggedIn(request, response, next){\n // If they are authenticated, carry on\n if(request.isAuthenticated()){ return next();}\n // If they aren't, redirect them to the home page\n response.redirect('/');\n}", "function isLoggedIn(req, res, next){\n if (req.isAuthenticated())\n return next()...
[ "0.77495754", "0.76212287", "0.7585787", "0.75567377", "0.7555366", "0.75428414", "0.7542166", "0.75343007", "0.7494682", "0.7486688", "0.74865127", "0.74801296", "0.74622875", "0.7457533", "0.7452231", "0.74436563", "0.7442914", "0.74289", "0.74208075", "0.74192244", "0.7407...
0.0
-1
New Game Listener when user clicks New Game button, newGameListener triggered newGameListener triggers handleGameRefresh event handler
function newGameListener() { clickNewGameButton.addEventListener('click', handleNewGameClick); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onNewGame(e) {\n\t\t// Remove event listener\n\t\te.remove();\n\n\t\t// Hide all the cards\n\t\tcards.forEach(card => {\n\t\t\tcard.hideMe();\n\t\t});\n\n\t\t// Remove the New game button\n\t\tuserInterface.hideNewGameBtn();\n\n\t\t//Add Restart Button\n\t\tuserInterface.showRestartBtn();\n\t}", "addNew...
[ "0.76282966", "0.7032363", "0.668305", "0.66767275", "0.6576853", "0.6499657", "0.64264834", "0.6414469", "0.63900584", "0.6384485", "0.6358583", "0.633364", "0.6323034", "0.63127697", "0.63001305", "0.6291104", "0.6271721", "0.6270458", "0.6207338", "0.619879", "0.61495656",...
0.79992265
0
sending counter to local storage
function scoreToLocalStorage(counter) { localStorage.setItem('score', JSON.stringify(counter)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCount(){\n\tlocalStorage.setItem(\"count\", getCount()+1);\n}", "function add_count() {\n var count = parseInt(localStorage[\"count\"]);\n count++;\n localStorage[\"count\"] = count;\n}", "function setCounter(status) {\n let counter = document.getElementById(`${status}-counter`);\n c...
[ "0.7959239", "0.78576595", "0.7571163", "0.73970383", "0.7213411", "0.720338", "0.720338", "0.7148376", "0.7129366", "0.70923907", "0.7063236", "0.6979693", "0.69158053", "0.688649", "0.68651706", "0.68344253", "0.6740908", "0.66805243", "0.667799", "0.66474944", "0.6600458",...
0.73718536
4
function that calls localStorage for counter, redirects user to Scores page when seconds reach 0
function handleEndTime(seconds) { if (seconds === 0) { scoreToLocalStorage(counter); location.href = 'scores.html'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countDown() {\n startingTime--;\n document.getElementById(\"timer\").innerHTML = \"Timer: \" + startingTime;\n if (startingTime <= 0) {\n window.localStorage.setItem('finalScore', startingTime);\n location.assign(\"scores.html\");\n }\n}", "function timer() {\n seconds = seconds - 1;\n \...
[ "0.7922412", "0.779823", "0.719319", "0.71331716", "0.70923203", "0.7045898", "0.7019843", "0.7007919", "0.6997191", "0.6897528", "0.6842901", "0.68145645", "0.6765177", "0.6726712", "0.6721546", "0.6673309", "0.66393614", "0.66359216", "0.66107833", "0.66024625", "0.65955293...
0.6926619
9
retrieves sound preference data from Local Storage
function getSoundFromLocalStorage() { // if localStorage exists if (localStorage.length > 0) { // retrieve, parse, assign to array of objects soundChoice = JSON.parse(localStorage.getItem('soundPref')); } else { } return soundChoice; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function music(){\n if (localStorage.getItem('musicvar') === \"on\"){\n document.getElementById(\"backgroundsound\").pause();\n document.getElementById(\"pauser\").style.display=\"block\";\n document.getElementById(\"player\").style.display=\"none\";\n localStorage.setItem('musicvar'...
[ "0.65890175", "0.64682657", "0.64596266", "0.62830764", "0.6206682", "0.6203028", "0.6188775", "0.6179075", "0.61480856", "0.6123198", "0.6116882", "0.60905904", "0.6012607", "0.60101295", "0.60061425", "0.60045826", "0.594584", "0.5944852", "0.59231675", "0.5918354", "0.5891...
0.82418525
0
eslintdisable linebreakstyle / eslintdisable react/proptypes Bootstrap Local Imports
function format(num) { return num != null ? num.toString() : ''; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend (config, { isDev, isClient }) {\n /*\n // questo linta ogni cosa ad ogni salvataggio\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\...
[ "0.5466979", "0.5399886", "0.53972447", "0.53882116", "0.53879005", "0.53487873", "0.5302345", "0.529765", "0.5269413", "0.52576023", "0.5256077", "0.5256077", "0.5256077", "0.5256077", "0.5254723", "0.52539647", "0.5246944", "0.52374786", "0.52374786", "0.52362573", "0.52335...
0.0
-1
Main action call to the blockchain
async function takeAction(action, dataValue) { let textDecoder = new TextDecoder('utf-8'); let textEncoder = new TextEncoder('utf-8'); const privateKey = localStorage.getItem("cardgame_key"); const rpc = new JsonRpc(url, { fetch }); const signatureProvider = new JsSignatureProvider([privateKey]); const api = new Api({ rpc, signatureProvider, textDecoder, textEncoder }); dataValue = { payload: dataValue} //make our blockchain call after setting our action try { const resultWithConfig = await api.transact({ actions: [{ account: process.env.REACT_APP_EOS_CONTRACT_NAME, name: action, authorization: [{ actor: localStorage.getItem("cardgame_account"), permission: 'active', }], data: dataValue, }] }, { blocksBehind: 3, expireSeconds: 30, }); } catch (err) { throw(err) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function main() {\n await tools.loadWallet(await tools.loadFile(process.env.WALLET_LOCATION));\n console.log(\"Wallet loaded\");\n\n console.log(\"Deploying NFT\");\n const deployedTxId = await deployNFT()\n await checkTxConfirmation(deployedTxId);\n\n console.log(\"Burning Koii\");\n co...
[ "0.66196954", "0.65700436", "0.6427699", "0.63748246", "0.6232355", "0.6226786", "0.61842936", "0.6132682", "0.6109165", "0.61013365", "0.6100003", "0.6087239", "0.608478", "0.6067054", "0.6038895", "0.60273206", "0.6024793", "0.6013771", "0.59981024", "0.5965869", "0.5961196...
0.60639554
14
Imediadtely Invoked Function Expression
function hi(myUser){ console.log(myUser); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e(e){return (0, F[e.operation])(...e.parameters)}", "function n(e){return function(){return e}}", "function a(e){return function(t){return i(t,e)}}", "function a(e){return function(t){return i(t,e)}}", "function callFunctionBody(expr) {\n return (\n '(function f() {\\n'\n + 'Object.definePr...
[ "0.69630665", "0.6760034", "0.6754553", "0.6754553", "0.6700711", "0.66846997", "0.668468", "0.6577617", "0.64519304", "0.6422", "0.6393734", "0.63862824", "0.6367659", "0.6367659", "0.63059425", "0.6303019", "0.6302432", "0.6302432", "0.6292148", "0.6290676", "0.62816036", ...
0.0
-1
your job is to finish writing these functions and variables that we've named // don't change the names or your program won't work as expected.
function initialPrompt() { console.log("Let's play some scrabble! "); let wordToScore = input.question("Enter a word to score:"); return wordToScore; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static private internal function m121() {}", "private internal function m248() {}", "function StupidBug() {}", "function main(){\n\n\n}", "function exercise11() {}", "private public function m246() {}", "function displayMessage() {\n // Task 8: Call each of the functions as properties of the importe...
[ "0.66000795", "0.63279337", "0.61891925", "0.61721534", "0.61641484", "0.61535656", "0.6077396", "0.60698456", "0.6063036", "0.6004438", "0.5992603", "0.59891903", "0.5978778", "0.595761", "0.59125465", "0.59059566", "0.59045166", "0.58983314", "0.5880165", "0.585527", "0.584...
0.0
-1
let simpleScore = " ";
function vowelBonusScore(word) { word = word.toUpperCase(); let points = 0; for(i=0; i<word.length; i++){ if (word.slice(i, i+1)==='A' || word.slice(i, i+1)==='E'|| word.slice(i, i+1)==='I' || word.slice(i, i+1)==='O' || word.slice(i, i+1)==='U'){ points = points + 3; } else { points = points + 1; } } //console.log(points); return points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function score() {\n\treturn `Human: ${playerPoints} Computer: ${computerPoints}`;\n}", "function simpleScore(word) {\n\n let simplestScore = word.length;\n return simplestScore;\n\n}", "function yourScore() {\n return fname + ' scored ' + (mid + final);\n }", "function drawScore(){\n document.getElem...
[ "0.7087568", "0.6997531", "0.696627", "0.6881587", "0.6819938", "0.67589456", "0.6742102", "0.66180307", "0.6586628", "0.65786064", "0.6554795", "0.65014946", "0.6487372", "0.64509", "0.64458126", "0.6404113", "0.63832724", "0.63818353", "0.636853", "0.6363071", "0.6317804", ...
0.0
-1
let vowelBonusScore; let scrabbleScore;
function scrabbleScore(word){ word = word.toLowerCase(); let points = 0; for (let i=0; i<word.length; i++){ points = points + newPointStructure[word.slice(i,i+1)] } return points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrabbleScore() {\n console.log(`Currently using : ${scoringAlgorithms[2].name}`);\n\tconsole.log(`The score for your word, ${userWord}, is ${oldScrabbleScoreTotal(userWord)}!`);\n}", "function getScore(){\n return score\n}", "function simpleScore() {\n return simpleScrabbleScorer(userWord);\n}",...
[ "0.6647555", "0.65762186", "0.6569386", "0.64685243", "0.6465729", "0.643703", "0.6429099", "0.6404797", "0.6308213", "0.62973464", "0.62915576", "0.6188451", "0.61729014", "0.61399436", "0.6137787", "0.60781676", "0.6074793", "0.6052721", "0.6048343", "0.60345006", "0.603374...
0.627093
11
FORM : input, button PLAYER: name GAME: 0: WAIT, 1: PLAY, 2: END
function setup() { database = firebase.database(); canvas = createCanvas(500, 500); game = new Game(); game.getState(); game.start(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function play(){\n endAnimLogo();\n player_1=document.querySelector(\"#name_player_1\").value;\n\n document.querySelector(\"#idPlayerField\").style.display=\"none\";\n\tdocument.querySelector(\"#game\").style.display=\"block\";\n\n /* returnConsole=document.querySelector(\"div.active\").id\n document...
[ "0.6582282", "0.6444199", "0.64441746", "0.6383212", "0.6270252", "0.6174314", "0.6131005", "0.612444", "0.6100325", "0.607094", "0.6068918", "0.60669", "0.6047232", "0.6041285", "0.6019319", "0.60120225", "0.6003888", "0.59661067", "0.5956309", "0.59561616", "0.591975", "0...
0.0
-1
================================================================================== Completion box ==================================================================================
function check_text(focused) { if(!focused) { document.getElementById("cmpltions").style.height=0; document.getElementById("cmpltions").style.opacity=0; document.getElementById("hider1").style.height="25px"; return } var tmp=completions.filter(function(element, index, array) { return (element.toString().toLowerCase().search(document.getElementById("texttest").value.toLowerCase())>-1) }); console.log(tmp); var tmphtml="" var c_count=0; /*limit max amount of completions*/ for(i in tmp) { tmphtml+='<div class="completion" onclick="complete(\''+tmp[i]+'\');">'+tmp[i]+'</div>'; if(++c_count>=15) break; } document.getElementById("cmpltions").innerHTML=tmphtml; document.getElementById("cmpltions").style.height=20*c_count; document.getElementById("hider1").style.height=20*c_count+27+"px"; if(tmp.length==0) { document.getElementById("cmpltions").style.opacity=0; } else { document.getElementById("cmpltions").style.opacity=1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function check_text(focused)\n{\n\tif(!focused)\n\t{\n// \t\tdocument.getElementById(\"cmpltions\").style.height=0;\n// \t\tdocument.getElementById(\"cmpltions\").style.opacity=0;\n// \t\tdocument.getElementById(\"hider1\").style.height=\"25px\";\n\t\treturn\n\t}\n\tvar tmp=completions.filter(function(element, ind...
[ "0.6384563", "0.6103177", "0.6067575", "0.6067575", "0.59841406", "0.59676903", "0.59592575", "0.5954911", "0.5954911", "0.5936218", "0.5904266", "0.58892417", "0.5888883", "0.5888883", "0.57903206", "0.5741161", "0.5741161", "0.572005", "0.5714734", "0.57108605", "0.56636786...
0.6429846
0
================================================================================== Multiple buttons ==================================================================================
function setup_buttons() { var button_containers=document.getElementsByClassName("button_container"); for(var key=0; key<button_containers.length; key++) { var container=button_containers[key]; container.style["line-height"]=container.style.height var h=container.clientHeight, w=container.clientWidth; var chooser=container.getElementsByClassName("chooser")[0]; var buttons=container.getElementsByClassName("button"); chooser.style.width=100.0/buttons.length+"%"; console.log("buttons:"+buttons.length) for(var i=0; i<buttons.length; i++) { buttons[i].style.width=100.0/buttons.length+"%"; if(i==0) { buttons[i].style["border-radius"]="7px 0px 0px 7px"; chooser.style.backgroundColor=buttons[i].dataset.chooser_color; chooser.style["border-radius"]=buttons[i].style["border-radius"]; chooser.style.left=0; } else if(i==buttons.length-1) buttons[i].style["border-radius"]="0px 7px 7px 0px"; else buttons[i].style["border-radius"]="0px"; buttons[i].addEventListener('click', function(e) { get_chooser(e.target).style.backgroundColor=e.target.dataset.chooser_color; get_chooser(e.target).style["border-radius"]=e.target.style["border-radius"]; get_chooser(e.target).style.left=e.target.offsetLeft }) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function commandButtons()\n{\n\t// find the index of the current recordset in MM.rsTypes\n\t//rsIndex = recordsetDialog.searchByType(RECORDSET_TYPE);\n\t\n\tbtnArray = new Array(\n\t\tMM.BTN_OK, \"clickedOK()\", \n MM.BTN_Cancel, \"clickedCancel()\", \n MM.BTN_Test, \"PopUpTestDialog()\"...
[ "0.70928854", "0.67460716", "0.6719908", "0.6683398", "0.6661771", "0.66613513", "0.66190964", "0.66090167", "0.65979743", "0.6593504", "0.65918374", "0.65796083", "0.65647703", "0.6556902", "0.6543043", "0.65369725", "0.6535326", "0.65278953", "0.6520761", "0.6519906", "0.65...
0.0
-1
Lists the configurations. url: the search endpoint.
function listConfigurations(url){ if (!url) { // default search endpoint url = Config.CONFIGURATION_URL; } $.ajax({ url: url, cache: false, }) .done(function(data, textStatus, jqXHR){ // generate pagination on UI paginate(jqXHR); // clear the existing data on results table and add new page var tbody = $('table#configurations tbody'); var table = $('table#configurations').DataTable(); table.clear(); table.rows.add(data).draw(); $('div#spinner').css('display', 'none'); $('div#search-config').css('display', 'block').fadeIn(1500); // set message if no results returned from this url.. $('td.dataTables_empty').html('No configuration files found.'); // enable checkboxes on selections $(selections).each(function(idx, selection){ $('input[id="' + selection.uid + '"]').prop('checked', true); toggleCheckboxes(selection, true); }); // bind a listener to the selection checkboxes $('input[name="config"]').on('change', function(e){ var isSelected = $(e.target).is(':checked'); var uid = e.target.id; var type = e.target.getAttribute('data-type'); var filename = e.target.getAttribute('data-filename'); var published = e.target.getAttribute('data-published') === true ? 'Published' : 'Private'; if (isSelected) { var selection = {} selection['uid'] = uid; selection['config_type'] = type; selection['filename'] = filename; selection['published'] = published; selections.push(selection); toggleCheckboxes(selection, true); if (type === 'PRESET') { $(document).trigger({type: 'preset:selected', source: 'config-browser'}); } } else { $(selections).each(function(idx, selection){ if (selection.uid === e.target.id) { selections.splice(idx, 1); toggleCheckboxes(selection, false); } }); if (type === 'PRESET') { $(document).trigger({type: 'preset:deselected', source: 'config-browser'}); } } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listConfigurations(url){\n if (!url) {\n // default search endpoint\n url = Config.CONFIGURATION_URL;\n }\n $.ajax({\n url: url,\n cache: false,\n })\n .done(function(data, textStatus, jqXHR){\n // generate paginatio...
[ "0.77927667", "0.664107", "0.664107", "0.63441676", "0.605083", "0.6038445", "0.6003469", "0.5724904", "0.57085484", "0.55349547", "0.54497546", "0.5418508", "0.5310202", "0.5296163", "0.524107", "0.51933056", "0.5184178", "0.5163106", "0.5152344", "0.51486766", "0.51361126",...
0.79530126
0
Toggles disabled state on configuration types depending on what's currently selected.
function toggleCheckboxes(selection, disable){ var type = selection.config_type; var uid = selection.uid; $('input[data-type="' + type + '"]') .each(function(i, input){ if (disable) { var inputUid = input.id; if (inputUid != uid) { $(input).prop('disabled', true); $(input).closest('tr').css('opacity', .5); } else { // leave the one currently selected enabled $(input).prop('disabled', false); } } else { $(input).prop('disabled', false); $(input).closest('tr').css('opacity', 1); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setDisabledState(isDisabled) {\n if (this.options) {\n this.options.forEach((option) => option.disabled = isDisabled);\n }\n }", "function switchDefaultSet(){\n if(this.checked){\n settingsDisables.forEach(function(element){\n element.disabled = true;\n ...
[ "0.6340964", "0.6200438", "0.6188212", "0.60327375", "0.6007668", "0.60059935", "0.6003571", "0.6003571", "0.59805083", "0.59062713", "0.5861645", "0.5861645", "0.5861645", "0.5861645", "0.5861645", "0.5861645", "0.5861645", "0.5861645", "0.58345854", "0.58214885", "0.5814175...
0.6089805
3
handle user config selections
function initSelectionHandler(){ $('button#select').on('click', function(e){ var $filelist = $('#filelist'); // clear the list and add the new selections $filelist.find('tr[data-source="config-browser"]').each(function(idx, tr){ var selection = getSelectionFromTR(tr); $filelist.trigger({type: 'config:removed', source: 'config-browser', selection: selection}); }); $(selections).each(function(idx, selection){ $filelist.trigger({type: 'config:added', source: 'config-browser', selection: selection}); }); selections = []; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postSetGUIConfig() {\n\tvar values = null;\n\tif (values != null) {\n\t\t// initialize defaults\n\t\tbulk_value_edit = false;\n\t\tcell_value_edit = false;\n\t\t$('#enableEdit').css('display', 'none');\n\t\tfile_download = false;\n\t\tview_tags = false;\n\t\tview_URL = false;\n\t\t\n\t\tif (values.contain...
[ "0.6096637", "0.58878154", "0.58878154", "0.5819564", "0.5805585", "0.56923854", "0.56842524", "0.56129223", "0.5605773", "0.55865854", "0.5564584", "0.5459827", "0.5441249", "0.5400136", "0.5372644", "0.53691435", "0.53385794", "0.5336441", "0.5329891", "0.53042054", "0.5233...
0.5772082
5
builds a selection object from an entry in the filelist.
function getSelectionFromTR(tr){ var selection = {}; selection['uid'] = $(tr).attr('id'); selection['filename'] = $(tr).attr('data-filename'); selection['config_type'] = $(tr).attr('data-type'); selection['published'] = $(tr).attr('data-published'); return selection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectEntry (filename) {\n const max = entries.length - 1\n let index = entries.findIndex(entry => entry.file === filename)\n index = Math.min(Math.max(index > -1 ? index : max ,0), max)\n const { file, author, link } = entries[index]\n\n updateNavigationUI(index, entries)\n updateAuthorUI(author, l...
[ "0.5972368", "0.5937315", "0.56674963", "0.53517354", "0.530642", "0.530277", "0.52196425", "0.521498", "0.51898575", "0.51544", "0.509878", "0.50817597", "0.50521725", "0.5040008", "0.5005088", "0.50041455", "0.49901798", "0.49779078", "0.4944464", "0.4918643", "0.4910293", ...
0.5277956
6
Listens for state changes. on selected file list.
function handleStateChanges(){ /* * Handle events on dialog show. */ $('#configSelectionModal').on('show.bs.modal', function(e){ selections = []; $('table#filelist tr.config').each(function(idx, tr){ var selection = getSelectionFromTR($(tr)); selections.push(selection); }); runSearch(); }); /* * Listen for remove events on the filelist and update * selections accordingly. */ $('table#configurations').on('filelist:removed', function(e){ $(selections).each(function(idx, selection){ if (selection.uid === e.selection.uid) { selections.splice(idx, 1); } }); runSearch(); }); /* * Listen for configurations being added to the filelist * and update state on this. */ $('table#configurations').on('config:added', function(e){ selections.push(e.selection); toggleCheckboxes(e.selection, true); }); $('table#configurations').on('config:removed', function(e){ toggleCheckboxes(e.selection, false); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onFileSelected(event) {\n this.selectedFiles = event.target.files;\n }", "function onFileSelected(files) {\n for(let file of files) {\n handleSelectedFile(file);\n }\n}", "changeFn(event) {\n var fileList = event.__files_ || (event.target && event.target.files);\n if (!fileLi...
[ "0.7302377", "0.69459295", "0.6930699", "0.6592114", "0.6420887", "0.6399675", "0.633315", "0.6313019", "0.6294175", "0.6292436", "0.6271795", "0.62374073", "0.6214559", "0.62126297", "0.6186353", "0.61482215", "0.61020976", "0.6090817", "0.60401714", "0.60391104", "0.6031929...
0.70282334
1
Creates the pagination links based on the ContentRange and Link headers. jqXHR: the ajax xhr
function paginate(jqXHR){ // get the pagination ul var paginate = $('#pagination ul.pager'); paginate.empty(); var info = $('#info'); info.empty(); // set the content range info var rangeHeader = jqXHR.getResponseHeader('Content-Range'); var total = rangeHeader.split('/')[1]; var range = rangeHeader.split('/')[0].split(' ')[1]; info.append('<span>Displaying ' + range + ' of ' + total + ' results'); // check if we have a link header var a, b; var link = jqXHR.getResponseHeader('Link'); if (link) { var links = link.split(','); a = links[0]; b = links[1]; } else { // no link header so only one page of results returned return; } /* * Configure next/prev links for pagination * and handle pagination events */ if (b) { var url = b.split(';')[0].trim(); url = url.slice(1, url.length -1); var rel = b.split(';')[1].split('=')[1]; rel = rel.slice(1, rel.length -1); paginate.append('<li id="prev" data-url="' + url + '"><a href="#"><span class="glyphicon glyphicon-chevron-left"/> Prev</a></li>&nbsp;'); $('li#prev').on('click', function(){ var u = this.getAttribute('data-url'); u == 'undefined' ? listConfigurations() : listConfigurations(u); }); } if (a) { var url = a.split(';')[0].trim(); url = url.slice(1, url.length -1); var rel = a.split(';')[1].split('=')[1]; rel = rel.slice(1, rel.length -1); if (rel == 'prev') { paginate.append('<li id="prev" data-url="' + url + '"><a href="#"><span class="glyphicon glyphicon-chevron-left"/> Prev</a></li>'); $('li#prev').on('click', function(){ var u = this.getAttribute('data-url'); u == 'undefined' ? listConfigurations() : listConfigurations(u); }); } else { paginate.append('<li id="next" data-url="' + url + '"><a href="#">Next <span class="glyphicon glyphicon-chevron-right"/></a></li>'); $('li#next').on('click', function(){ var u = this.getAttribute('data-url'); u == 'undefined' ? listConfigurations() : listConfigurations(u); }); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function paginate(jqXHR){\n\n // get the pagination ul\n var paginate = $('ul.pager');\n paginate.empty();\n var info = $('#info');\n info.empty();\n\n // set the content range info\n var rangeHeader = jqXHR.getResponseHeader('Content-Range');\n var total = r...
[ "0.7330411", "0.6607836", "0.6513387", "0.5811541", "0.5557061", "0.5507803", "0.54909295", "0.5446983", "0.543234", "0.542587", "0.5387725", "0.5383911", "0.5379717", "0.53756595", "0.53669965", "0.53365123", "0.5314789", "0.5299204", "0.52892596", "0.52864665", "0.5286134",...
0.73538446
0
Initialize the configuration list data table.
function initDataTable(){ $('table#configurations').DataTable({ paging: false, info: false, filter: false, searching: false, ordering: true, rowId: 'uid', "order": [[ 2, "desc" ]], columns: [ {data: 'name'}, {data: 'config_type'}, { data: 'created', render: function(data, type, row){ return moment(data).format('YYYY-MM-DD'); } }, {data: 'owner'}, {data: 'filename'}, { data: 'uid', render: function(data, type, row){ var html = '<div class="checkbox">' + '<label>' + '<input id="' + row.uid + '" type="checkbox" ' + 'data-type="' + row.config_type + '" ' + 'data-filename="' + row.filename + '" ' + 'data-published="' + row.published + '" ' + 'name="config"/>' + '</label>' + '</div>'; return html } } ] }); // clear the empty results message on initial draw.. $('td.dataTables_empty').html(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initTable() {\n // set up the table column names we want to use in the table\n var columns = $.map(CONFIG.attributes, function(value){ return value; });\n \n // set up formatted column names for the table\n var names = Object.keys(CONFIG.attributes);\n // don't include column for url; we're going to...
[ "0.6537567", "0.61117136", "0.5949384", "0.58970004", "0.5894257", "0.5888427", "0.58621114", "0.5851771", "0.58117783", "0.5781461", "0.5777629", "0.571766", "0.570573", "0.5599325", "0.55989295", "0.5560771", "0.55461824", "0.5532833", "0.5528997", "0.55246097", "0.55206215...
0.6306317
1
Initialize the start / end date pickers.
function initDatePickers(){ $('#start-date').datetimepicker({ showTodayButton: true, // show one month of configurations by default defaultDate: moment().subtract(1, 'month').startOf('d'), format: 'YYYY-MM-DD HH:mm' }); $('#end-date').datetimepicker({ showTodayButton: true, // default end-date to now. defaultDate: moment().endOf('d'), format: 'YYYY-MM-DD HH:mm' }); $("#start-date").on("dp.change", function(e){ runSearch(); }); $("#end-date").on("dp.change", function(e){ runSearch(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initInputs() {\n setDateInput(\"startDate\", { dateFormat: \"yy-mm-dd\" });\n setDateInput(\"endDate\", { dateFormat: \"yy-mm-dd\" });\n}", "function setUpDatepickerStartAndEndDateValidation() {\n\n jq(\".startDateEndDate\").each(function (j, domEl) {\n\n const startDatepicker = jq(jq(this).find('...
[ "0.7645802", "0.69845736", "0.68799394", "0.68079084", "0.6767333", "0.67236614", "0.6666404", "0.6634765", "0.6596021", "0.6558281", "0.6553629", "0.6466366", "0.64634514", "0.64395493", "0.6434868", "0.6410827", "0.640996", "0.63991565", "0.6381354", "0.6376126", "0.6367025...
0.79984665
1
Runs a search. Takes query params from serialized form inputs.
function runSearch(){ var url = Config.CONFIGURATION_URL + '?'; url += searchForm.serialize(); listConfigurations(url); // update results table }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "search() {\n this.send('searchWithParams', this.buildSearchQuery());\n }", "function executeSearch(){\n\t/*Save the form data to a JSON file, so that it can be autopopulated the next time the form page is opened.*/\n\tsaveJsonToBrowserStorage(convertCriteriaToJSON());\n\t/*Redirect to the searc...
[ "0.74207944", "0.6716437", "0.66979533", "0.666286", "0.66055363", "0.65641415", "0.6559055", "0.64709526", "0.6429326", "0.6422621", "0.6418924", "0.6418924", "0.641053", "0.63864434", "0.6353802", "0.6337319", "0.63283527", "0.6325842", "0.62999326", "0.62981796", "0.62829"...
0.6352665
16
appends notes to json
function saveNote(note, noteArr){ // if the array is not empty push to the list then write if(noteArr){ noteArr.push(note); fs.writeFileSync(path.join(__dirname, '../data/notes.json'), JSON.stringify({notes: noteArr}, null, 2)); return noteArr; } // else if empty, assign note as array then write noteArr = note; fs.writeFileSync(path.join(__dirname, '../data/notes.json'), JSON.stringify({notes: noteArr}, null, 2)); return noteArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addNote() {\n fs.writeFileSync(\"Develop/db/db.json\", JSON.stringify(notesData))\n}", "function newNotes() {\n fs.writeFile(\"db/db.json\", JSON.stringify(notes), err => {\n if (err) {\n return console.log(err);\n }\n });\n ...
[ "0.74540186", "0.7315348", "0.7185029", "0.7019678", "0.6928482", "0.68346703", "0.67743486", "0.676566", "0.67204356", "0.6720389", "0.6694183", "0.66903615", "0.66879076", "0.66209245", "0.6597926", "0.65664387", "0.65643656", "0.6558496", "0.65463877", "0.65138054", "0.649...
0.6474921
24
deletes note by id from json
function deleteNoteById(id, noteArr){ let updatedNoteArr // if the arr is empty then return an empty arr if(noteArr.length == 0) updatedNoteArr = []; else{ // otherwise, return all elements that dont match that id from passed arr updatedNoteArr = noteArr.filter(note => id != note.id); // update id's post removal corresponding to the elements index updatedNoteArr.forEach((note, index) => { note.id = index; updatedNoteArr[index] = note; }); } // wite fs.writeFileSync(path.join(__dirname, '../data/notes.json'), JSON.stringify({notes: updatedNoteArr}, null, 2)); return updatedNoteArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteNote(id) {\n let index = this.jsonData().findIndex(element => parseInt(element.id) === parseInt(id));\n if (index !== -1) {\n let noteData = this.jsonData();\n noteData.splice(index, 1);\n this.storeData(noteData);\n }\n }", "function deleteNote(id) ...
[ "0.8388772", "0.77906513", "0.7785953", "0.76012933", "0.7568043", "0.75050163", "0.7481722", "0.74281424", "0.7400665", "0.73658234", "0.73554605", "0.73432297", "0.73396564", "0.7338531", "0.72993416", "0.72823566", "0.72796124", "0.7273544", "0.7252594", "0.7246397", "0.72...
0.7328403
14
Validate and log use in.
function onLogin(loginResponse){ // Send headers to your server and validate user by calling Digits’ API var oAuthHeaders = loginResponse.oauth_echo_headers; var verifyData = { authHeader: oAuthHeaders['X-Verify-Credentials-Authorization'], apiUrl: oAuthHeaders['X-Auth-Service-Provider'] }; console.log('logged in!'); console.log(verifyData); $('.digits-widget').hide(); alert('You are now logged in!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate(){\n\n\t\t//TODO: make this work\n\n\n\t}", "validate() {}", "validate() { }", "function validation() {\r\n\t\t\r\n\t}", "validateAndSubmitForm() {\n if (!this.state.login.trim()) {\n this.setState({formError: this.props.translate('loginForm.pleaseEnterEmailOrPhoneNumber...
[ "0.6311861", "0.6029192", "0.59802645", "0.58178663", "0.57609165", "0.5714934", "0.5630518", "0.56290686", "0.5593758", "0.55768245", "0.5547574", "0.5546879", "0.55218863", "0.55217534", "0.55131286", "0.55107623", "0.54975307", "0.54910046", "0.5447205", "0.5441941", "0.54...
0.0
-1
override Emitter to console.log every event (except Core::update)
verbose() { console.log('GameManager : verbose'); var _this = this; this.log = true; var on = this.on; function newOn() { console.log('GameManager : add listener ', arguments[0]); on.apply(_this, arguments); } this.on = newOn; var emit = this.emit; function newEmit() { if (arguments[0] !== "Core::update") { console.log('GameManager : emit event ', arguments[0]); } emit.apply(_this, arguments); } this.emit = newEmit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "emit(...args) {\n const [name, ...params] = args;\n\n if (this.logBlacklist && this.logBlacklist.indexOf(name) === -1) {\n console.info(name, params);\n }\n\n super.emit(...args);\n }", "function Emitter () {}", "function Emitter() {\n }", "emit(...args) {\n // emit the event through ow...
[ "0.7375093", "0.66729456", "0.66560537", "0.6615365", "0.66072524", "0.6516114", "0.648806", "0.64845574", "0.645828", "0.64309347", "0.6413441", "0.6362106", "0.63435113", "0.63055646", "0.6297304", "0.62939435", "0.62938607", "0.6259301", "0.6259249", "0.6254181", "0.624818...
0.6684667
1
Main loop, emit "Core::update" every frame
main() { // let browser handle frames var _this = this; var loop = function(tFrame){ _this.animationFrameId = window.requestAnimationFrame( loop ); _this.emit("Core::update"); } loop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loop () {\n\t\tthis.update();\n\t\tthis.render();\n\n\t\twindow.requestAnimationFrame( () => this.loop() );\n\t}", "function mainLoop() {\n update();\n draw();\n window.requestAnimationFrame(mainLoop);\n}", "update() {\n console.log(\"Abstract loop.\");\n }", "function loop(){\n stats.begin();\...
[ "0.7914413", "0.7874368", "0.7740245", "0.7670927", "0.7650344", "0.75931954", "0.75877315", "0.7586551", "0.75863296", "0.7542704", "0.7538175", "0.7538175", "0.7518237", "0.75043625", "0.74887174", "0.74843705", "0.7443909", "0.74141073", "0.74129623", "0.73850405", "0.7382...
0.8205025
0
end hiding contents from old browsers >
function d2h(decimal) { var j = decimal; var hexchars = "0123456789ABCDEF"; var hv = ""; for (var i = 0; i < 2; i++) { k = j & 15; hv = hexchars.charAt(k) + hv; j = j >> 4; } return (hv); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hideContentsQuit (){\n $('.content').hide();\n $(\"#newcanvas, #openfile\").removeClass('inactive').addClass('active');\n $('#closefile, #saveAs, #savefile, #revert, #printdraft, #printfin').addClass('inactive');\n }", "hide() {}", "function _hideContent() {\n btn_intro_launchButton.s...
[ "0.7177701", "0.71483", "0.69767606", "0.6876446", "0.68096954", "0.68026465", "0.67573416", "0.67353374", "0.67039055", "0.6668134", "0.6618479", "0.6615184", "0.65973973", "0.6594726", "0.65529066", "0.65340066", "0.6532885", "0.65310776", "0.6528906", "0.65147406", "0.6480...
0.0
-1
Generate reports to entered text.
function reportStats() { // Set initial. var wordStarted = false; // Get text from element with id value. reportMy.text = document.getElementById("sample").value; // Through the entire text length, check char. Update stats as appropriately. for ( i = 0; i < reportMy.text.length; i++) { switch ( reportMy.text[i]) { // If PERIOD, QUESTION, EXCLAMATIONPT, update number of sentences. case Punctuation.PERIOD: case Punctuation.QUEST: case Punctuation.EXC: if ( wordStarted === true) { reportMy.numOfSents++; } // break; // If either or COMMA, update number of words, case Punctuation.COMMA: if ( wordStarted === true) { reportMy.numOfWords++; wordStarted = false; } break; // If COMMA, update number of spaces. case Punctuation.SPACE: reportMy.numOfSpaces++; if ( wordStarted === true) { reportMy.numOfWords++; wordStarted = false; } break; // Assumes otherwise we are char in a word. default: { if ( wordStarted === false) { wordStarted = true; } } } } // Once text length has been reached, update average words per sentence. reportMy.aveWordsPerSent = parseInt(reportMy.numOfWords / reportMy.numOfSents); // Return reportMy object. return reportMy; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add2Report(text) {\n\t\treport = report + text + '\\n';\n\t\treturn report;\n\t}", "function createTxt(report) {\n const output = entities.decode(report.markdown());\n csvAccumulator.push([report.kind, output]);\n}", "function formSubmission() {\n $(\".js-text-form\").submit(function(event) {\n ...
[ "0.6413267", "0.5931802", "0.5916326", "0.5870599", "0.57733285", "0.5679199", "0.56426215", "0.563461", "0.55896753", "0.5554627", "0.5548331", "0.5511164", "0.5509642", "0.5492095", "0.54893", "0.5476253", "0.5419184", "0.53936195", "0.5375861", "0.53709", "0.5367341", "0...
0.5344016
26
Create a portfolio report of accomplishments.
function portlist() { var port = document.getElementById("portfolio"); var showt = document.getElementById("showtime"); port.removeChild(showt); var div = appendElementChild("div", port, "accomplish"); var dl = appendElementChild("dl", div); // Build accomplishment listing. if ( accomplishMy !== null) { var i = 0; do { var dt = appendElementChild("dt", dl); dt.innerHTML = accomplishMy[i].dt; var dd = appendElementChild("dd", dl); dd.innerHTML = accomplishMy[i].dd; appendBreakChild(2, dl); i++; } while ( i < accomplishMy.length); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SnpCreateAdobePortfolioProject()\r{\r\t/**\r\t The context in which this snippet can run.\r\t @type String\r\t*/\r\tthis.requiredContext = \"\\tExecute against Bridge.\\nBridge must be running and \\n\" \r\t\t+ \"select images for upload to Portfolio\";\r\t$.level = 1; // Debugging level\r}", "function ...
[ "0.5995793", "0.5920672", "0.5910673", "0.58650875", "0.574", "0.570962", "0.56519663", "0.56435215", "0.5492765", "0.54525954", "0.5337647", "0.533048", "0.53211385", "0.53088665", "0.52887416", "0.5242493", "0.5216842", "0.5187829", "0.5170897", "0.515615", "0.5126888", "...
0.49203712
33
Create a page with the textreader exercise.
function textreader() { // Replace "reserved" report with feature exercise. var port = document.getElementById("portfolio"); var reserved = document.getElementById("reserved"); port.removeChild(reserved); var div = appendElementChild("div", port, "showtime"); var prompt1 = "First, a simple exercise. Type complete sentences " + "in the text area provided then press SUBMIT. I will report " + "statistics related to your submission. Cool? "; appendTextChild(prompt1, div, "h4"); var prompt2 = "Text Reader and Statistics"; var txta = appendElementChild("textarea", div, "sample"); txta.setAttribute("name", "textReader"); txta.setAttribute("rows", "5"); txta.setAttribute("cols", "30"); appendBreakChild(2, div); // Create button to move to next results page. var button1 = appendElementChild("button", div, "button1id"); button1.innerHTML = "Submit"; button1.setAttribute("name", "button1"); button1.setAttribute("onClick", "txtrresults()"); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createPage() {\n init();\n generateCard();\n makeCommentsWork();\n makeCommentIconsWork();\n makeReactionsWork();\n displayCharLimit();\n}", "function makePage(number, text, isDisabled, isPrevious, isNext) {\n return {\n number: number,\n text: text,\n ...
[ "0.636354", "0.6363466", "0.6363466", "0.6363466", "0.62755156", "0.61579883", "0.6059186", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", "0.6008788", ...
0.6067503
6
Create a page of textreader results.
function txtrresults() { // First, run reportStats and generate the ReportMy stats to be used. reportStats(); // Then setup report using ReportMy data. var prompt1 = "I detect you had entered " + reportMy.numOfSents + " sentence(s), consisting of " + reportMy.numOfWords + " words and " + reportMy.numOfSpaces + " spaces. The average words per sentence therefore is " + reportMy.aveWordsPerSent + ". Thanks for playing!"; var noenter = "I detect you have not entered words in the text area. Ok then."; // Create noenter if no words detected in text area. if ( reportMy.numOfWords === 0) { prompt1 = noenter; } // If word are detected, create page report. var showt = document.getElementById("showtime"); var button1 = document.getElementById("button1id"); showt.removeChild(button1); var port = document.getElementById("portfolio"); var div = appendElementChild("div", showt, "txtresults"); appendTextChild(prompt1, div, "h4"); var button2 = appendElementChild("button", div, "button2id"); button2.innerHTML = "Done!"; button2.setAttribute("name", "button2"); button2.setAttribute("onClick", "portlist()"); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function genResults($this, data, callback) {\n\t\tvar res = calcPageResults(data);\n\n\t\t// if results are available, create page elements\n\t\tif (res.total > 0) {\n\t\t\tvar node = $this.find('.poppy_pagination');\n\n\t\t\tif (node[0]) node.remove();\n\n\t\t\t// .. results header\n\t\t\tvar div1 = createResult...
[ "0.6026141", "0.56994754", "0.5635216", "0.56127954", "0.556817", "0.55447096", "0.5498591", "0.549375", "0.54572636", "0.54368854", "0.54368854", "0.54368854", "0.5417612", "0.5332865", "0.5319108", "0.53048456", "0.5294021", "0.52831346", "0.5233221", "0.52245015", "0.52199...
0.0
-1
Replace with whatever exercise you want to display. For now, TextReader().
function showFeature() { textreader(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayExercise() {\n pickRandomExercise();\n displayBox.innerHTML = `${output.reps} <span class=\"multiplier\">×</span> ${output.exercise}`;\n}", "function explainPuzzle(){\n\tlet ed = display.explanationDisplay;\n\ted.innerHTML = underground.selected.explanationDisplay();\n}", "function displayExe...
[ "0.62252015", "0.6130755", "0.58041054", "0.57786036", "0.57417476", "0.569386", "0.5487524", "0.54531574", "0.54326886", "0.5405801", "0.54019594", "0.5375591", "0.5370211", "0.53687036", "0.5248198", "0.5216234", "0.5215954", "0.52051556", "0.51992166", "0.5173646", "0.5164...
0.55105
6
Append text as a child node (w element).
function appendTextChild(text, node, element, idname) { // Check input. if ( text === undefined || text === null || node === undefined || node === null || element === undefined || element === null) { return null; } // Create styled text node. var txt = document.createTextNode(text); var el = _createel(element, idname); el.appendChild(txt); node.appendChild(el); return el; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addText(parent, text) {\n parent.appendChild(document.createTextNode(text));\n }", "function appendElement(parent, child, elementText) {\n var childElement = document.createElement(child);\n childElement.textContent = elementText;\n parent.appendChild(childElement);\n}", "function appendTextToE...
[ "0.75390196", "0.7485944", "0.7428857", "0.7399418", "0.7334137", "0.729842", "0.7040578", "0.69747484", "0.68196267", "0.65345156", "0.65172166", "0.64877063", "0.64845026", "0.64551485", "0.64551485", "0.6448808", "0.64404726", "0.64404726", "0.64386183", "0.64048034", "0.6...
0.7488636
1
Append xtimes of break(s) as child node(s) to node.
function appendBreakChild(xtimes, node) { // Check input. if ( xtimes === undefined || xtimes === null || node === undefined || node === null) { return null; } var i = 0; // Create xtimes number of breaks. do { node.appendChild(document.createElement("br")); i++; } while ( i < xtimes); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function thematicBreak(ctx, node, index, parent) {\n var macro = ctx.thematicBreak || defaultMacro;\n return macro(node);\n}", "function breakNode(root, into) {\n\n\t\tlet line = createLine()\n\n\t\tlet nodes = root.childNodes\n\n\t\tlet lastWordR = null\n\t\tlet lastWordB = null\n\n\t\tfor (let i = 0; i < nod...
[ "0.63128895", "0.6152435", "0.6144858", "0.6077617", "0.5868857", "0.5841096", "0.57394487", "0.55721635", "0.5543989", "0.5375537", "0.5123289", "0.50599265", "0.5049691", "0.5017507", "0.50135267", "0.49951822", "0.4987879", "0.49721068", "0.4960886", "0.49425083", "0.49319...
0.7753818
0
Create child node of element with optional idname. You need idname if you want to remove later.
function appendElementChild(element, node, idname) { if ( element === undefined || element === null || node === undefined || node === null) { return null; } var el = _createel(element, idname); node.appendChild(el); return el; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createElements(elementName, innerText, parentId){\r\n var node = document.createElement(elementName);\r\n var textNode = document.createTextNode(innerText);\r\n node.appendChild(textNode);\r\n document.getElementById(parentId).appendChild(node);\r\n}", "function newChildNode(parent, child, c...
[ "0.7071792", "0.6987633", "0.68198335", "0.66983515", "0.66118664", "0.6523955", "0.6461049", "0.63809264", "0.63809264", "0.630105", "0.6298641", "0.62631595", "0.62606245", "0.62550783", "0.61740524", "0.6156484", "0.6124785", "0.6103726", "0.6076648", "0.6054449", "0.60445...
0.67878693
3
take projectID and create notification
async createByProjectID({ request, params, response }) { const { title, description, source_user_id, is_read, event_id, event_type, } = request.post(); const projectID = params.projectID; const project = await Project.find(projectID); const students = await project.students().fetch(); const staff = await project.staff().fetch(); const studentsJSON = await students.toJSON(); studentsJSON.forEach(async (student) => { var newNotif = new Notification(); newNotif.title = title; newNotif.description = description; newNotif.user_id = student.user_id; newNotif.source_user_id = source_user_id; newNotif.is_read = is_read; newNotif.event_id = event_id; newNotif.event_type = event_type; await newNotif.save(); }); const staffJSON = await staff.toJSON(); staffJSON.forEach(async (staff) => { var newNotif = new Notification(); newNotif.title = title; newNotif.description = description; newNotif.user_id = staff.user_id; newNotif.source_user_id = source_user_id; newNotif.is_read = is_read; newNotif.event_id = event_id; newNotif.event_type = event_type; await newNotif.save(); }); return response.json({ message: "successfully added", }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function notificationCreate(json) {\n if (Notification.isSupported()) {\n elements[json.targetID] = new Notification(json.notificationOptions);\n elements[json.targetID].on('action', (event, index) => { client.write(json.targetID, consts.eventNames.notificationEventActioned, {index: index}) })\n ...
[ "0.62137127", "0.61979073", "0.61933506", "0.6031134", "0.5994061", "0.5983241", "0.5929354", "0.5915151", "0.58932525", "0.58815825", "0.58437777", "0.58437777", "0.58395106", "0.57691544", "0.576904", "0.5760473", "0.5746217", "0.5735199", "0.5729614", "0.5700186", "0.56846...
0.61281365
3