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
drawing and setting the starts attributes
function drawTable(rows) { var i, j; for (row of rows) { var tr = document.createElement('tr'); i = rows.indexOf(row); j = 0; for (item of row) { var td = document.createElement('td'); var span_valor = document.createElement('span'); span_valor.setAttribute('class', 'invisible'); span_valor.textContent = item; td.appendChild(span_valor); td.addEventListener('click', clicou); td.addEventListener('mousedown', longclicou); td.setAttribute('id', `${i},${j}`); j++; tr.appendChild(td); } table.appendChild(tr); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "begin() {\n this.ctx.beginPath();\n this.ctx.moveTo(this.position[0], this.position[1]);\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "configureStartingData() {\n // We don't u...
[ "0.6773693", "0.6693239", "0.6693239", "0.6650837", "0.6639593", "0.66166884", "0.65992504", "0.65295535", "0.6513398", "0.64907867", "0.64627415", "0.6457839", "0.6443526", "0.6440928", "0.64351976", "0.6381266", "0.6329864", "0.6328915", "0.6312639", "0.6294597", "0.6244867...
0.0
-1
making the box the same old status whitout auto clicking it
function reatribute() { event.target.removeEventListener('mouseup', reatribute); setTimeout(() => { event.target.addEventListener('click', clicou) }, 500); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateStateOnClick() {\n const that = this;\n\n that._changeCheckState();\n that.focus();\n }", "function resetClickedBox() {\n\t\tif (clickedBox) {\n\t\t\tclickedBox.removeClass('clicked');\n\t\t\tclickedBox = null;\n\t\t}\n\t}", "clicked() {\r\n if (this.life === 0) {\r\n thi...
[ "0.6895292", "0.67485005", "0.6596161", "0.64501727", "0.63847864", "0.6307598", "0.6294617", "0.6265165", "0.6245124", "0.6189561", "0.61882764", "0.6082168", "0.60537165", "0.59791845", "0.59374577", "0.59264165", "0.59050095", "0.5904123", "0.58664095", "0.5853585", "0.584...
0.0
-1
pushing bombs positions to array of bombs
function creatMine() { while (mines.length != (quantidade_bombs)) { let i = Math.floor(Math.random() * field_size); let j = Math.floor(Math.random() * field_size); //not repeating same spot if (!mines.map(x => JSON.stringify(x)).includes("[" + i + "," + j + "]")) { mines.push([i, j]); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function placeBombs(board, bombCount) {\n for (let i = 0; i < bombCount; i++) {\n var rand = getRandomIntInclusive(0, (gRands.length - 1));\n board[gRands[rand].i][gRands[rand].j].value = BOMB;\n board[gRands[rand].i][gRands[rand].j].isBomb = true;\n gRands.splice(rand, 1);\n }\n}...
[ "0.6396883", "0.6237637", "0.61271197", "0.61118287", "0.61042994", "0.6089339", "0.5955847", "0.5876888", "0.58056986", "0.5786145", "0.576682", "0.574836", "0.5731219", "0.56807494", "0.56795233", "0.5675958", "0.5656267", "0.5644881", "0.561572", "0.5606117", "0.5583883", ...
0.0
-1
changing quantity of bombs at the field
function mudar_quant_bombs() { if (!isStarted) { //checking if field supports that quantity of bombs if (input_quant_bombs.value < (field_size ** 2)) { if (input_quant_bombs.value != '') { quantidade_bombs = input_quant_bombs.value; restart(); } else alert('Escolha um valor.') } else alert('Quantidade de bombas maior que o campo.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function incrementNumBags() {\n\n\tvar current = document.getElementById(\"bagInputField\");\n\tvar value = parseInt(current.value);\n\tvalue += 1;\n\n\ttry {\n\t\tvar geese = parseInt(document.getElementById(\"geeseInputField\").value);\n\t\tvar result = calculateTransportCost(value, geese);\n\t\tupdateElement(re...
[ "0.6484524", "0.6452571", "0.64519185", "0.6220082", "0.6142708", "0.6141687", "0.59738594", "0.5969904", "0.5946509", "0.59402275", "0.5928903", "0.5906383", "0.5873179", "0.58485943", "0.57861584", "0.5783713", "0.57603365", "0.57305396", "0.5722212", "0.5711935", "0.568247...
0.60431916
6
Toggle children on click.
function click(d) { if (d3.event.defaultPrevented) return // ignore drag if (d.children) { d._children = d.children d.children = null } else { d.children = d._children d._children = null } update() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_contai...
[ "0.7109894", "0.6869202", "0.665626", "0.6655057", "0.6650161", "0.6647868", "0.66203606", "0.66193414", "0.66120464", "0.65928566", "0.6550344", "0.64945227", "0.6459832", "0.641936", "0.64049387", "0.6374655", "0.6367121", "0.630328", "0.63023406", "0.62904346", "0.62541735...
0.0
-1
Returns a list of all nodes under the root.
function flatten(rootTree) { let nodes = [], i = 0, depth = 0, level_widths = [1], max_width, max_depth = 1, kx, ky; function recurse(node, parent, depth, x) { if (node.children) { let w = level_widths[depth + 1] || 0 level_widths[depth + 1] = w + node.children.length max_depth = Math.max(max_depth, depth + 1); node.size = node.children.reduce(function(p, v, i) { return p + recurse(v, node, depth + 1, w + i); }); } if (!node.id) { node.id = ++i } node.parent = parent node.depth = depth if (!node.px) { node.y = depth node.x = x } nodes.push(node) return node.size } rootTree.size = recurse(rootTree, null, 0); // now correct/balance the x positions: max_width = 1; for (i = level_widths.length; --i > 0;) { max_width = Math.max(max_width, level_widths[i]); } kx = (width - 20) / max_width; ky = (height - 20) / max_depth; for (i = nodes.length; --i >= 0;) { var node = nodes[i]; if (!node.px) { node.y *= ky; node.y += 10 + ky / 2; node.x *= kx; node.x += 10 + kx / 2; } } return nodes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "list_nodes() {\n let result = this._list_nodes_in_subtree(this.root);\n return result;\n }", "getRootNodes() {\n return this.model.getRoots();\n }", "function getRootNodes(target) {\n var roots = [];\n $(target).children('li').each(function () {\n var node = ...
[ "0.7944793", "0.70967126", "0.7038422", "0.69845325", "0.69387054", "0.68545365", "0.68474865", "0.66487837", "0.6616856", "0.65859073", "0.65618134", "0.65240645", "0.65237993", "0.65049374", "0.6487213", "0.648427", "0.6477388", "0.6477388", "0.6472023", "0.64695984", "0.64...
0.0
-1
When size is submitted by the user, call makeGrid()
function makeGrid() { // prevent submit button from reloading page event.preventDefault(); const grid = document.querySelector("table"); // clear any previously created table grid.innerHTML = ""; // get the users size input const size = getSize(); const width = size[0]; const height = size[1]; for (let y = 0; y < height; y++) { // table row is intitialized inside the for loop so as to create a different <tr> in each loop const tableRow = document.createElement("tr"); grid.appendChild(tableRow); for (let x = 0; x < width; x++) { const tableColumn = document.createElement("td"); tableRow.appendChild(tableColumn); } } grid.addEventListener("click", setCellColor); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gridSize() {\n size = prompt(\"What size do you want the grid?\");\n createGrid(size, size);\n\n}", "function resizeGrid() {\n do {\n size = prompt(\"Enter a number from 1-125\");\n if (size === null || isNaN(size)) {\n return;\n }\n } while (size > 125);\n container.innerHTML = \...
[ "0.7694769", "0.7553282", "0.75071144", "0.7472073", "0.72403735", "0.7214134", "0.71550834", "0.71263516", "0.71014583", "0.7092236", "0.7089094", "0.7048364", "0.7044207", "0.70392203", "0.6989688", "0.698586", "0.695496", "0.6931012", "0.68895555", "0.6859165", "0.6854571"...
0.64906025
32
function to run when user clicks on a cell
function setCellColor(event) { const colorPicker = document.querySelector("input[type='color']"); event.target.style.backgroundColor = colorPicker.value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleHTMLCellClick(e) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget\n let idArray = e.currentTarget.id.split(\"-\");\n let row = Number(idArray[1]);\n let col = Number(idArray[2]);\n\n chess.handleCellSelected(row, col);\n}", "function cellClicked(event){\n ...
[ "0.77602804", "0.76863885", "0.76629746", "0.7433937", "0.7337495", "0.7318651", "0.7271263", "0.7270575", "0.72393847", "0.72393847", "0.72236615", "0.72215426", "0.71854264", "0.71683455", "0.71220696", "0.7071764", "0.70253825", "0.7017108", "0.70153993", "0.7011232", "0.6...
0.0
-1
Constructs a new CustomerPaymentCardRequest. Document representing a customer payment card request.
constructor() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createPaymentRequest() {\n var _this = this;\n var methodData = [{\n supportedMethods: 'basic-card',\n data: {\n supportedNetworks: Array.from(this.allowedCardNetworks, (network) => network.toLowerCase())\n }\n }];\n\n var details = {\n total: {\n l...
[ "0.602485", "0.5595641", "0.53184956", "0.52775127", "0.52107126", "0.51801497", "0.5150606", "0.5078826", "0.5068721", "0.4944214", "0.48754525", "0.48325714", "0.47940364", "0.47901103", "0.4780391", "0.47507906", "0.47404736", "0.47304383", "0.47131157", "0.4674268", "0.46...
0.0
-1
vuerouter v3.0.1 (c) 2017 Evan You
function i(e,t){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return ...
[ "0.60794616", "0.60604215", "0.58815044", "0.58643883", "0.5863571", "0.583801", "0.58183414", "0.57860523", "0.5745682", "0.5725272", "0.5636772", "0.5615987", "0.56147796", "0.5608149", "0.5605216", "0.5597615", "0.5582921", "0.55762595", "0.55645746", "0.555929", "0.555893...
0.0
-1
delete and edit delete Array.splice(index, how many) list = [a,b,c,d] list.splice(1,2) => list = [a,d] delete
function deleteEntry(ENTRY){ ENTRY_LIST.splice(ENTRY.id,1) updateUI() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "splice(position = self.list.length, deleteCount = 0, ...elements) {\n return self.list.splice(position, deleteCount, ...elements)\n }", "function splice(arr, start, deleteCount, element1, elementN) {\n let deleted = [];\n let i;\n let arrLength = arr.length;\n\n // arr = [1, 2, 3];\n // start = 1;\n //...
[ "0.75611836", "0.74313694", "0.7288266", "0.7198349", "0.7082078", "0.7031479", "0.7031479", "0.7004342", "0.6950201", "0.6924521", "0.69026154", "0.6896922", "0.6896922", "0.6896922", "0.68754995", "0.68754995", "0.68754995", "0.6869601", "0.6863267", "0.68492156", "0.683840...
0.0
-1
total distance of whole path
function CalculateTotalDistancePolyline(path) { var distance = google.maps.geometry.spherical.computeLength(path); $('#distance').append('<div>Polyline dist mts:' + distance.toFixed(2) + '</div>'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeLength(path) {\n path = common.convertToPositionArray(path);\n if (path.length < 2) {\n return 0;\n }\n var length = 0;\n var prev = path[0];\n var prevLat = toRadians(prev.lat);\n var prevLng = toRadians(prev.lng);\n path.forEach(function (point) {\n var lat = toRadians(point.lat);\n...
[ "0.7210126", "0.7151468", "0.69926953", "0.69369656", "0.6807505", "0.67762655", "0.67177165", "0.66839963", "0.6634162", "0.6633744", "0.6580088", "0.6577251", "0.65378577", "0.6420952", "0.6411197", "0.63623935", "0.63603246", "0.63479435", "0.631411", "0.62686557", "0.6257...
0.7126329
2
Pass: redux state to props
function mapStateToProps(state, props) { return { token: state.authReducer.token, moji_stack: state.navReducer.moji_stack }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapStateToProps (state) {\n //return object of what you want to pass to component as a prop\n\n}", "function mapStateToProps(state) {\n return {\n data: state,\n };\n}", "function mapStateToProps(state) {\n // Whatever is returned from here it shows up as props\n return {\n asd: '12...
[ "0.73820907", "0.71932817", "0.70546466", "0.7033385", "0.6977673", "0.69719833", "0.6941645", "0.6893427", "0.6882383", "0.68685305", "0.68535876", "0.6843393", "0.6842213", "0.68400353", "0.68379897", "0.6827367", "0.6819815", "0.6819619", "0.68185794", "0.679889", "0.67959...
0.0
-1
Pass: redux actions to props
function mapDispatchToProps(dispatch) { return bindActionCreators(Actions, dispatch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapActionToProps(dispatch) { return bindActionCreators({ ConfirmProductInfoAction, }, dispatch); }", "function mapActionToProps(dispatch) { return bindActionCreators({ GetActivityAction }, dispatch); }", "function mapActionToProps(dispatch) { return bindActionCreators({ GoProductAction }, dispatch); ...
[ "0.71711874", "0.716163", "0.7112648", "0.68945664", "0.67625546", "0.6756405", "0.67439777", "0.6671289", "0.6629192", "0.6615264", "0.6607731", "0.6559039", "0.6556852", "0.6528068", "0.6523479", "0.6521232", "0.65202993", "0.65202993", "0.6517265", "0.6491125", "0.6486365"...
0.62863857
57
ignore above this line
function main() { var n = parseInt(readLine()); arr = readLine().split(' '); arr = arr.map(Number); var posCounter = 0; var negCounter = 0; var zerCounter = 0; for (var i = 0; i < n; i++) { if (arr[i] === 0) { zerCounter++; } else if (arr[i] < 0) { negCounter++; } else { posCounter++; } } console.log((posCounter / n).toFixed(6)); console.log((negCounter / n).toFixed(6)); console.log((zerCounter / n).toFixed(6)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignore() { }", "function IGNORE() {\r\n //Do not delete.\r\n }", "doNotDisplayLineText() {\r\n this._ignoredLine = true;\r\n }", "function ignore() {\n return null\n }", "function remove_ignore_lines_DocGenerator() {\n\t//----Debugging-----------------------------------...
[ "0.7002511", "0.6313994", "0.62586504", "0.61209166", "0.60574675", "0.6047923", "0.59494466", "0.5940073", "0.59276366", "0.59249926", "0.5907571", "0.59008515", "0.58524996", "0.5824406", "0.58213234", "0.58134085", "0.5805963", "0.5723673", "0.5688489", "0.56424433", "0.56...
0.0
-1
Log: var log = new Log(); log(0, "nuntia") log.trace("nuntia") => trace: nuntia 0: trace 1: debug 2: info 3: warning 4: error 5: fatal
function LLog(){ var level_name = { 0: "trace", 1: "debug", 2: "info", 3: "warning", 4: "error", 5: "fatal" }; this.log = function(level, o1, o2, o3, o4, o5){ console.log( level_name[level] + ": ", o1 ? o1 : "", o2 ? o2 : "", o3 ? o3 : "", o4 ? o4 : "", o5 ? o5 : "" ); }; this.log.trace = function(o1, o2, o3, o4, o5){this(0, o1, o2, o3, o4, o5)}; this.log.debug = function(o1, o2, o3, o4, o5){this(1, o1, o2, o3, o4, o5)}; this.log.info = function(o1, o2, o3, o4, o5){this(2, o1, o2, o3, o4, o5)}; this.log.warning = function(o1, o2, o3, o4, o5){this(3, o1, o2, o3, o4, o5)}; this.log.error = function(o1, o2, o3, o4, o5){this(4, o1, o2, o3, o4, o5)}; this.log.fatal = function(o1, o2, o3, o4, o5){this(5, o1, o2, o3, o4, o5)}; return this.log; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Log() {}", "Trace(...args) { this.do_log(\"TRACE\", args, true); }", "function _log() {\n // logger.trace.apply(logger, arguments)\n}", "log() {}", "function logSomething(log) { log.info('something'); }", "function trace(msg){\r\n rootLogger.trace(msg)\r\n}", "function hook_log(){\n var...
[ "0.73539543", "0.7285786", "0.7260934", "0.70252436", "0.699583", "0.6872711", "0.6731688", "0.6728357", "0.6692784", "0.65004903", "0.6494829", "0.6486238", "0.64171493", "0.6306172", "0.63050413", "0.6304797", "0.6280164", "0.62639517", "0.6235636", "0.62187165", "0.6215945...
0.6882355
5
have to be init
function Modal(html, init_open){ var el; this.close = function(){ return el.hide(); }; this.nevv = function(){ el = $j('<div id="modal"></div>').append($j(html)).appendTo($j("body")).hide(); if(init_open){this.open()}; }; this.open = function(){ var h = $j(el).outerHeight(), w = $j(el).outerWidth(), w_sidebar = $j('#aside').outerWidth(), css = { 'margin-left': -(w/2), //-(w_sidebar/2), 'margin-top': -(h/2+50) }; $this.log.trace(w_sidebar); return el.css(css).show(); }; this.nevv(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n\t \t\n\t }", "init() {\n }", "function init() {\r\n\r\n }", "function init() {\n }", "function init() {\n\n }", "function init() {\n\n }", "function init() {\r\n }", "function _init() {\n }", "init() { }", "i...
[ "0.82072645", "0.7964122", "0.7906558", "0.7896364", "0.7870771", "0.7870771", "0.7855315", "0.78176004", "0.778161", "0.778161", "0.778161", "0.778161", "0.778161", "0.7756173", "0.7687618", "0.7687618", "0.76394415", "0.760387", "0.7582838", "0.7582838", "0.75315285", "0....
0.0
-1
Initializes the application settings. The method loads the settings for all environments and then pics the settings for the current environment. The method also handles using the values in the production environment as default values for configuration items in other environments.
_initSettings() { let currentApplicationSettings = {}; let plugins = this._config.plugins.concat([ { name: ObjectContainer.APP_BINDING_STATE, module: this._config } ]); plugins .filter(plugin => typeof plugin.module.initSettings === 'function') .forEach(plugin => { let allPluginSettings = plugin.module.initSettings( ns, this._oc, this._config.settings ); let environmentPluginSetting = $Helper.resolveEnvironmentSetting( allPluginSettings, this._config.settings.$Env ); $Helper.assignRecursivelyWithTracking(plugin.name)( currentApplicationSettings, environmentPluginSetting ); }); this._config.bind = Object.assign( this._config.bind || {}, currentApplicationSettings, this._config.settings ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setApplicationSettings() {\n // custom user settings.\n if (this.config.settings && typeof(this.config.settings) === 'object') {\n Object.keys(this.config.settings)\n .forEach(key => {\n let value = this.config.settings[key];\n this.app....
[ "0.6649135", "0.65116197", "0.6336812", "0.6107835", "0.60296214", "0.60022235", "0.5945021", "0.5836192", "0.5830076", "0.58182466", "0.57766944", "0.5773866", "0.5751086", "0.57258976", "0.5690169", "0.56866306", "0.56727606", "0.5663735", "0.56448025", "0.56324464", "0.562...
0.6135992
3
Binds the constants, service providers and class dependencies to the object container.
_bindDependencies() { this._oc.setBindingState(ObjectContainer.IMA_BINDING_STATE); this._config.initBindIma( ns, this._oc, this._config.bind, ObjectContainer.IMA_BINDING_STATE ); this._config.plugins .filter(plugin => typeof plugin.module.initBind === 'function') .forEach(plugin => { this._oc.setBindingState( ObjectContainer.PLUGIN_BINDING_STATE, plugin.name ); plugin.module.initBind(ns, this._oc, this._config.bind, plugin.name); }); this._oc.setBindingState(ObjectContainer.APP_BINDING_STATE); this._config.initBindApp( ns, this._oc, this._config.bind, ObjectContainer.APP_BINDING_STATE ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\n /**\n * Set of registered bindings.\n *\n * A binding is a definition of how to create an object and an\n * identifier for that object within the container.\n *\n * @private\n * @type {Map.<string, {factory: Function, singleton: boole...
[ "0.6782557", "0.61832213", "0.6102641", "0.59739363", "0.5949272", "0.5879701", "0.58611596", "0.5834875", "0.5807689", "0.57684404", "0.5756915", "0.56696063", "0.56612456", "0.5622605", "0.5583802", "0.55646235", "0.55646235", "0.5551901", "0.55242205", "0.54883766", "0.547...
0.6893125
0
Initializes the basic application services.
_initServices() { this._config.initServicesIma(ns, this._oc, this._config.services); this._config.plugins .filter(plugin => typeof plugin.module.initServices === 'function') .forEach(plugin => { plugin.module.initServices(ns, this._oc, this._config.services); }); this._config.initServicesApp(ns, this._oc, this._config.services); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n TodoService.name = 'todo';\n readTodoList();\n }", "function initServices() {\n $scope.emoticonService = EmoticonsService;\n }", "function init() {\n // get current user from rootScope if present\n vm.user = $rootScope.currentUser...
[ "0.62096035", "0.59624165", "0.58318615", "0.5751004", "0.5742075", "0.57262987", "0.5720235", "0.5676425", "0.5581177", "0.5578394", "0.55765706", "0.5570651", "0.556428", "0.5545863", "0.5534082", "0.5530031", "0.55104184", "0.5499722", "0.5494319", "0.54879725", "0.5461977...
0.5628387
8
Call back for when user selects an option
function onSelect(d) { alert(d.State); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickOptiontoSelect(){\n\n}", "function getSelectedOption(){\n\n}", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "chooseData() {\n // ******* TODO: PART I ****...
[ "0.7469173", "0.7442079", "0.73111624", "0.73111624", "0.71811646", "0.7140011", "0.69488525", "0.6878511", "0.67932147", "0.67837125", "0.6767903", "0.6767903", "0.6751651", "0.6751651", "0.6751651", "0.6751651", "0.6738064", "0.67299914", "0.67264736", "0.67157793", "0.6715...
0.0
-1
Setup and render the autocomplete
function start() { var mc = autocomplete(document.getElementById('search')) .keys(keys) .dataField("State") .placeHolder("Search States - Start typing here") .width(960) .height(500) .onSelected(onSelect) .render(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupAutoComplete() {\n autocomplete = new google.maps.places.Autocomplete(\n (document.getElementById('autocomplete')) /*,\n {types: ['geocode']}*/ );\n }", "AutocompleteAdapter() {}", "function autocomplete() {\nnew Ajax.Autocompleter ('autoCompleteTextField','menufield',\n'lis...
[ "0.7224389", "0.7148656", "0.69499624", "0.68556064", "0.6735465", "0.6640301", "0.6621811", "0.66015255", "0.6592722", "0.65639806", "0.65550125", "0.65322906", "0.65264463", "0.64694536", "0.6460636", "0.64513713", "0.6414479", "0.6387037", "0.63833416", "0.6383247", "0.637...
0.71344686
2
Toggle children on click.
function mouseout(d) { d3.select(this).select("text.hover").remove(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toggleChildren() {\n\t\tthis.setState({\n\t\t\tlinksVisible: !this.state.linksVisible\n\t\t});\n\t}", "function toggle_sidebar_sublist()\n{\n $(\".navbar_right_sidebar .sidebar_main_item.expandable\").click(function(){\n var child_container=$(this).find(\".subele_container\");\n if (child_contai...
[ "0.7109894", "0.6869202", "0.665626", "0.6655057", "0.6650161", "0.6647868", "0.66203606", "0.66193414", "0.66120464", "0.65928566", "0.6550344", "0.64945227", "0.6459832", "0.641936", "0.64049387", "0.6374655", "0.6367121", "0.630328", "0.63023406", "0.62904346", "0.62541735...
0.0
-1
Compare two scenario results to indicate if it's faster or slower. It considers the error margin, and returns 0 if the difference is in the error margin. It returns a percent of progress.
function compareScenarioResults( result: ScenarioResult, previous: ScenarioResult ): number { const error = Math.max(result.error, previous.error); const difference = (previous.time - result.time) * 100 / previous.time; if (Math.abs(difference) <= error) { return 0; } return difference; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function percentDiff(a, b) {\n let divideBy = (a > b) ? a : b;\n return Math.abs(a - b) / divideBy * 100;\n }", "function dividetest(v1, v2, expected) {\n results.total++;\n var r = calculator.division(v1, v2);\n if (r !== expected) {\n results.bad++;\n console.log(\"Expected ...
[ "0.65683204", "0.6494723", "0.6003157", "0.59573406", "0.59573406", "0.595473", "0.5934593", "0.5782212", "0.57640904", "0.5737287", "0.5689905", "0.5669492", "0.5660689", "0.56575835", "0.56283534", "0.56271887", "0.56094444", "0.5591329", "0.55909514", "0.5583373", "0.55717...
0.75824684
0
Get a visual indicator for a difference between two results.
function getDifferenceIcon(difference: number): string { if (difference > 0) { return colors.green('✔'); } else if (difference < 0) { return colors.red('✖'); } return '✔'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diff(a, b) {\n totalDifference += Math.abs(a - b);\n }", "function getTheDifference() {\t\n\tvar difference;\n\tvar leftSet = parseFloat($(\"#LR\").text());\n\tvar rightSet = parseFloat($(\"#RR\").text());\n\tif(isNaN(rightSet)) rightSet = 0;\n\tif(isNaN(leftSet)) leftSet = 0;\n\t// reset the di...
[ "0.6146608", "0.60133755", "0.5944041", "0.5884003", "0.5822823", "0.5772532", "0.5735793", "0.5732453", "0.56814563", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.5656507", "0.56245327", "0.5588091", "0.54990417", "0.5477331", "0.54626036", "0.5457383"...
0.5723793
8
Generate a summary string for some stats.
function getStatsSummary(stats: BenchmarkStats): string { const parts = []; if (stats.improved > 0) { parts.push(colors.green.bold(`${stats.improved} improved`)); } if (stats.regressed > 0) { parts.push(colors.red.bold(`${stats.regressed} regressed`)); } parts.push(`${stats.total} total`); return parts.join(', '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function summarize(summary)\n {\n var seconds = summary.seconds;\n var usage = summary.usage;\n var yields = summary.yields;\n\n log.debug('Summary', [seconds, usage, yields]);\n }", "renderSummary() {\n return ''; // @todo\n }", "function gen...
[ "0.6924805", "0.6710903", "0.66036415", "0.6552633", "0.65403825", "0.6505533", "0.649645", "0.6466235", "0.6238974", "0.61482453", "0.6139148", "0.6127768", "0.6111689", "0.6081211", "0.6080632", "0.6036702", "0.6016276", "0.60069704", "0.59935814", "0.5946005", "0.5912547",...
0.7833077
0
vuerouter v3.0.1 (c) 2017 Evan You
function i(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "function TM(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return ...
[ "0.60790557", "0.6060641", "0.5880747", "0.58640015", "0.5862688", "0.58372855", "0.5818145", "0.57850385", "0.57455677", "0.57246846", "0.5636216", "0.5615896", "0.56157297", "0.5607327", "0.5604924", "0.55964965", "0.5583291", "0.5577483", "0.5564155", "0.5559062", "0.55576...
0.0
-1
! vuei18n v7.8.1 (c) 2018 kazuya kawaguchi Released under the MIT License.
function i(t,e){"undefined"!==typeof console&&(console.warn("[vue-i18n] "+t),e&&console.warn(e.stack))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JV(e,t){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+e),t&&console.warn(t.stack))}", "function en(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&console.warn(e.stack))}", "function i(t,e){\"undefined\"!=typeof console&&(console.warn(\"[vue-i18n] \"+t),e&&consol...
[ "0.7467622", "0.7418666", "0.7364661", "0.7364661", "0.7349065", "0.7299573", "0.72792786", "0.7276468", "0.7240656", "0.7231128", "0.72183836", "0.72183836", "0.72183836", "0.7209951", "0.7208506", "0.7204524", "0.72034055", "0.71914756", "0.71875226", "0.71333563", "0.71288...
0.7388992
5
Need URL to reflect which chatroom you joined
function ChatComponent() { const [message_list, setMessage_list] = useState([]); const [userMessage, setUserMessage] = useState(''); const [username] = useState(Cookies.get('name')); const [isVoiceChat, setVoiceChat] = useState(false); // const [roomID, setRoomID] = useState('TEST_ROOM_ID') let { room } = useParams(); useEffect(() => { socket.emit('joined room', {room: room, username: username}); }, []); // async load chatroom info from db useEffect(() => { async function onLoad(){ } onLoad(); }, []); const submitHandler = () => { if (userMessage !== ''){ console.log('User Typed: ' + userMessage); setMessage_list([...message_list, userMessage]); // Send the message to the server socket.emit('message', {'username': username, 'message': userMessage, 'room': room}); setUserMessage(''); } } const handleKeyDown = (event) => { if (event.key === 'Enter' && event.shiftKey === false) { event.preventDefault(); submitHandler(); } }; const toggleVoice = (event) => { event.preventDefault(); setVoiceChat(!isVoiceChat); console.log(isVoiceChat); } return ( <Container className='main flex-column' fluid> <SocketIO/> <Row noGutters> <Col xs={1} className="left-Col"> <div className="left-panel userlist text-white"> <h2> {room} </h2> <UserListComponent/> {/* <div className='voiceTab'> {isVoiceChat ? <Button onClick={toggleVoice}>Leave Chat</Button> : <Button onClick={toggleVoice}>Join Chat</Button>} </div> */} </div> </Col> <Col className="right-Col"> <div className="right-panel"> <MessageListComponent/> <Form className="message-form" onSubmit={submitHandler}> <Form.Control value={userMessage} onChange={e => setUserMessage(e.target.value)} className="message-box" placeholder="Send Message" onKeyDown={e => handleKeyDown(e)}/> </Form> </div> </Col> </Row> </Container> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRoomURL() {\n return location.protocol + \"//\" + location.host + (location.path || \"\") + \"?room=\" + this.getRoom();\n }", "function getRoomURL() {\n\treturn location.protocol + \"//\" + location.host + (location.pathname || \"\") + \"?room=\" + getRoom();\n}", "function goChatRoomList(id){\n ...
[ "0.7066661", "0.706312", "0.67175996", "0.6548493", "0.64780474", "0.6311561", "0.624417", "0.62141675", "0.6209262", "0.61767095", "0.6121753", "0.6104321", "0.6098796", "0.60917544", "0.6036749", "0.6029682", "0.60183376", "0.6017449", "0.5991532", "0.59879243", "0.5968742"...
0.0
-1
BROADCAST / EMIT / ON FUNCTION
function initEventListener() { //$scope.$on(vm.controllerId + '.action.refresh', function (event, data) { // getPage(_tableState); //}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Emiter() {}", "function justForward(call) {\n engine.on(call, function() {\n sio.sockets.emit.apply(sio.sockets, _.flatten([call, arguments]));\n });\n }", "function Emitter () {}", "function sink() {}", "function sink() {}", "function emit(msg){\n\tconsole.log(msg);\n}", "function...
[ "0.6712139", "0.6387208", "0.61682653", "0.608522", "0.608522", "0.60508585", "0.6013302", "0.57759196", "0.576958", "0.576958", "0.5760716", "0.573627", "0.573627", "0.57170767", "0.571421", "0.5688087", "0.5688087", "0.5658897", "0.5652307", "0.5652307", "0.5652307", "0.5...
0.0
-1
Group columns by table and sort them by name (longest first). After that sort tables in same manner (longest table first)
static groupByTableAndSortByLength(columns) { columns = columns.sort((a, b) => b.name.length - a.name.length); let tables = _.groupBy( columns, 'tableName' ); return Object.keys(tables).sort((a, b) => b.length - a.length).reduce((result, key) => { result.set(key, tables[key]); return result; }, new Map()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function columnate(...columnGroupOpts) {\n const columnGroups = columnGroupOpts.map(([label, list]) => ({\n label,\n width: 0,\n list: list.reverse(),\n columns: [],\n }))\n\n while (!columnGroups.every(group => !group.list.length)) {\n columnGroups.forEach(group => {\n while (group.list.len...
[ "0.6177032", "0.60958934", "0.59636444", "0.59164596", "0.5854542", "0.5831138", "0.58213437", "0.57851994", "0.569424", "0.5690779", "0.56834596", "0.56746453", "0.5655727", "0.56286114", "0.5617816", "0.55980444", "0.55895203", "0.55857456", "0.55586255", "0.55270123", "0.5...
0.73409885
0
Guardar y validar nombre
function nombreValid(nombre){ do { nombre = prompt("Ingrese su nombre"); if(nombre.trim() == ""){ alert("Ingrese datos validos"); }else{return localStorage.setItem("nombre", nombre);} } while (nombre=="" || nombre!==undefined); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validarNombre (nombre) {\n if(nombre.length === 0){\n return 'Este campo no debe estar vacío';\n }\n\n if (!/^[a-z]+$/i.test(nombre)) {\n return 'Este campo puede contener únicamente letras'\n }\n\n if(nombre.length >= 50){\n return 'Este campo debe tener menos de 50 ca...
[ "0.7609393", "0.74344754", "0.7390659", "0.7336258", "0.72030246", "0.7164892", "0.711631", "0.69687206", "0.69157916", "0.6907554", "0.68776804", "0.67767733", "0.67554736", "0.67465276", "0.6664473", "0.6662381", "0.66245776", "0.6576604", "0.65397805", "0.651212", "0.65053...
0.64153135
23
Guardar y validar email
function guardarEmail(email) { email = prompt("Ingrese su email"); let arrEmail = email.split(""); if (arrEmail.includes("@") && arrEmail.includes(".")) { localStorage.setItem("email", email); enviarMail(mailTo); } else { alert("Datos invalidos"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate(value) {\n if (!validator.isEmail(value)) {\n throw new Error(\"Email tidak valid\")\n }\n }", "function validarEmail(email){expr=/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;if(!expr.test(email)) return false;else return true;}", "...
[ "0.7876787", "0.78224754", "0.7777101", "0.7729202", "0.7728618", "0.7593715", "0.7592074", "0.7556102", "0.74932945", "0.7470817", "0.746091", "0.7460481", "0.74505764", "0.7436092", "0.7431703", "0.7389254", "0.7387517", "0.7376607", "0.7374087", "0.73700637", "0.73502135",...
0.0
-1
Preguntar para enviar mail
function enviarMail(mail) { mail = confirm("Desea recibir mails con novedades?"); if (mail == true) { alert( "Estaremos enviandole las ultimas novedades a " + localStorage.getItem("email") ); localStorage.setItem("mail", mail); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendMail(options) {}", "sendEmail() {\n email([EMAIL], null, null, null, null);\n }", "async function EnviarEmail(email, asunto, destinatario, html, texto, archivos) {\n let data = {\n from: \"'GRUPO ELITE' <info@grupoelitefincaraiz.co>\",\n to: email,\n subject: asunto\n };\n html ? (data.html...
[ "0.7406498", "0.735994", "0.72295904", "0.717204", "0.69913733", "0.69899565", "0.69208515", "0.6917294", "0.68351334", "0.6826788", "0.6814951", "0.68142515", "0.6793635", "0.6778371", "0.6769644", "0.67521346", "0.67255914", "0.6719065", "0.6702579", "0.66970706", "0.669394...
0.6984253
6
function to show notes according to user id
function showNotesById(userid) { let notesElem = document.getElementById("notes"); let html = ""; let userObj = { userid: userid, }; var data = Object.keys(userObj) .map(function (key) { return key + "=" + userObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/show-notes-by-id.php", { method: "POST", body: data, headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then((response) => response.json()) .then((data) => { for (let i = 0; i < data.length; i++) { if (data[i].userid == userid) { // let result; let description = data[i].text; console.log(description); let maxLength = 40; let result = description.length > 40 ? description.substring(0, maxLength) + "..." : description; html += `<div class="noteCard card col-md-3" style="margin: 7px 7px";> <div class="card-body rounded"> <div class="texts"> <h6 class="card-title text-white text-wrap">${data[i].title} </h6> <p class="card-text text-white">${result}</p> </div> <button id="${data[i].id}" class="btns delete text-center" onclick="deleteNote(this.id)" ><i class="fa fa-trash-o" aria-hidden="true"></i> </button> <button id="${data[i].id}" class="btns edits text-center" onclick="editNote(this.id)" data-toggle="modal" data-target="#exampleModalCenter"><i class="fa fa-pencil" aria-hidden="true"></i> </button> </div> </div>`; notesElem.innerHTML = html; } } if (data.length == 0) { notesElem.innerHTML = `<div class="col-md-6 alert alert-warning container-fluid mx-auto" role="alert"> Nothing to show. Please use <a href="#" class="alert-link">'Add a Note'</a> button to add notes!' </div>`; } }) .catch((error) => { console.log("error: ", error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getnotes(userid) {\n\n $.get(\"/api/usernotes/\" + userId, function(data) {\n console.log(\"notes\", data);\n notes = data;\n if (!notes || !notes.length) {\n displayEmpty(userid);\n }\n else {\n initializeRows();\n }\n });\n }", "function getNotes(user...
[ "0.75691617", "0.7261484", "0.72408557", "0.7106856", "0.69120866", "0.6826649", "0.67025614", "0.6672057", "0.66223276", "0.66200423", "0.6555716", "0.65519613", "0.65404904", "0.65312004", "0.65212363", "0.6504733", "0.6503787", "0.6500433", "0.64774144", "0.64636827", "0.6...
0.7279055
1
function to delete note according to its id
function deleteNote(index) { let noteObj = { id: index, }; var data = Object.keys(noteObj) .map(function (key) { return key + "=" + noteObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/delete-note-by-id.php", { body: data, method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then(response => response.json()) .then(data => { if (data.message === "success") { showAlert("Note Deleted!", "danger"); showNotesById(userid.value); } }) .catch(error => { console.log('error: ', error); }); }
{ "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.84295213", "0.82327795", "0.8171688", "0.8155078", "0.8147998", "0.81453353", "0.8145228", "0.8120947", "0.8091709", "0.8090674", "0.8016119", "0.80126226", "0.80079734", "0.79310715", "0.7841314", "0.7763246", "0.7740046", "0.7736637", "0.76879907", "0.76869416", "0.76824...
0.72161
42
function to edit note by its id
function editNote(index) { let modalContent = document.getElementById("openModal"); let html = `<div class="form-group"> <h5 class="title text-dark">Edit title</h5> <input type="text" class="form-control" id="editTitle"> </div> <button type="button" class="close cross" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <div class="form-group"> <h5 class="card-title text-dark">Edit your note</h5> <textarea class="form-control" id="editTxt" rows="5" required></textarea> </div> <button class="btn btn-info updateButn" id="${index}" onclick="UpdateButn(this.id)" data-dismiss="modal">Update Note</button>`; modalContent.innerHTML = html; let noteObj = { id: index, }; var data = Object.keys(noteObj) .map(function (key) { return key + "=" + noteObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/edit-note-by-id.php", { body: data, method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then(response => response.json()) .then(data => { for(let i = 0; i < data.length; i++){ if (data.length > 0) { document.getElementById("editTxt").value = (data[i].text); document.getElementById("editTitle").value = (data[i].title); } } }) .catch(error => { console.log('error: ', error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edit_note(note_id, note_name) {\n fetch(`${note_name}/edit/${note_id}`)\n .then(response => response.json())\n .then(notes => {\n Array.prototype.forEach.call(notes.task, note => {\n document.querySelector(`#edit-note-${note.id}`).style.display == 'block'\n ...
[ "0.8051789", "0.75677097", "0.7547705", "0.7388114", "0.7314969", "0.7244864", "0.71683246", "0.70636106", "0.69847095", "0.6952836", "0.69403124", "0.6912773", "0.69070286", "0.6881831", "0.6844277", "0.6842057", "0.6792382", "0.67920524", "0.67866945", "0.67656523", "0.6740...
0.6850143
14
function to update note
function UpdateButn(index){ let editTitle = document.getElementById('editTitle'); let editTxt = document.getElementById("editTxt"); let notesObj = { title: editTitle.value, text: editTxt.value, id: index, }; let data = Object.keys(notesObj) .map((key) => { return key + "=" + notesObj[key]; }) .join("&"); fetch("http://localhost:8081/php-notes-app/update-note.php", { method: "POST", body: data, headers: { "Content-Type": "application/x-www-form-urlencoded" } }) .then((response) => response.json()) .then((data) => { if (data.className == "success") { showAlert(data.msg, data.className); } if (data.className == "danger") { showAlert(data.msg, data.className); } // Dismiss after 2 seconds setTimeout(function () { document.getElementById("alert").remove(); }, 2000); editTxt.value = ""; editTitle.value = ""; showNotesById(userid.value); }) .catch((error) => { console.log(error); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateNote(worker, note) {\n if (note != null) {\n note = datastore.updateNote(note);\n worker.port.emit(\"NoteUpdated\", note);\n }\n}", "function updateGoalNote(worker, note) {\n if (note != null) {\n note = datastore.updateNote(note);\n worker.port.emit(\"GoalNoteUpdated\", note);\n }...
[ "0.75796837", "0.7249449", "0.7069197", "0.7006927", "0.6953592", "0.6915031", "0.6894212", "0.6830427", "0.6803867", "0.68017465", "0.66917735", "0.66513544", "0.6588292", "0.6578864", "0.6577192", "0.65482384", "0.65423733", "0.65191627", "0.6506916", "0.650472", "0.6498546...
0.0
-1
need to be able to select a pokemon from the map and return the ID number to load the info comp
render(){ return ( <div/> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onPokemonSelect(event) {\n let id = event.currentTarget.getAttribute('data-id');\n ClassPokemon.pokemonSelected = ClassPokemon.ListPokemons.find(x=>x._id==parseInt(id));\n ClassPokemon.renderInformationAdditional();\n ClassPokemon.renderList();\n }", "function selectPokemon(id){\n\...
[ "0.72742873", "0.7253365", "0.70022404", "0.6821616", "0.6810767", "0.6702614", "0.6625099", "0.66118515", "0.6602848", "0.6578707", "0.6537803", "0.65052617", "0.6449666", "0.6418976", "0.63821214", "0.6327388", "0.63068396", "0.6293729", "0.62796247", "0.6254027", "0.625224...
0.0
-1
Capitalize function n = name
function capitalize(n) { return n.charAt(0).toUpperCase() + n.substr(1, n.length).toLowerCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function myFunction(param) {\n capitalize('Testing');\n}", "function upperCase(name){\n\n}", "function capital(name){\n n = name.toUpperCase()\n console.log(n)\n}", "function nombreEnMayuscula(n){\n n = n.toUpperCase()\n console.log(n)\n}", "function i(e){return e[0].toUpperCase()+e.substr(1)}...
[ "0.75649446", "0.73954946", "0.73112375", "0.7252557", "0.72145677", "0.720601", "0.71679586", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7144461", "0.7124353", "0.70525235", "0.6973834", "0.6951299", "0.692303", "0.6825257", "0.6794007", "0.67721957"...
0.7267803
3
Funciones que devuelven promesas
function conArroz(plato) { return new Promise((resolve, reject) => { resolve(plato + ' arroz'); // reject(new Error('no queda ajo')); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function esquiver() \n{\n //Cas spéciaux : Mort, ou pas d'ennemi\n if (presenceEnnemi === 666){\n ...
[ "0.6348015", "0.61486346", "0.6129453", "0.5999885", "0.59539616", "0.58548564", "0.58150166", "0.5813115", "0.58114517", "0.5808636", "0.57955307", "0.5787083", "0.57815224", "0.57757324", "0.5768038", "0.57261246", "0.5698734", "0.56798744", "0.56579924", "0.56539166", "0.5...
0.0
-1
Update the known topics.
function updateTopics(topics) { topics.forEach(function(d) { d.r = r(d.count); d.cr = Math.max(minRadius, d.r); d.k = fraction(d.parties[0].count, d.parties[1].count); if (isNaN(d.k)) d.k = .5; if (isNaN(d.x)) d.x = (1 - d.k) * width + Math.random(); d.bias = .5 - Math.max(.1, Math.min(.9, d.k)); }); force.nodes(data.topics = topics).start(); updateNodes(); updateLabels(); updateArrows(); tick({alpha: 0}); // synchronous update }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision\n force.nodes(data.topics = topics).start();\n updateNodes();\n updateLabels();\n }", "function updateTopics(topics) {\n topics.forEach(function(d, i) { d.r = Ma...
[ "0.72805154", "0.72191924", "0.6702866", "0.6646864", "0.6348247", "0.6219668", "0.5864411", "0.5834315", "0.5817131", "0.57902694", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0.57654953", "0....
0.7189533
28
Update the displayed nodes.
function updateNodes() { node = node.data(data.topics, function(d) { return d.name; }); node.exit().remove(); var nodeEnter = node.enter().append("a") .attr("class", "g-node") .attr("xlink:href", function(d) { return "#" + encodeURIComponent(d.name); }) .call(force.drag) .call(linkTopic); var democratEnter = nodeEnter.append("g") .attr("class", "g-democrat"); democratEnter.append("clipPath") .attr("id", function(d) { return "g-clip-democrat-" + d.id; }) .append("rect"); democratEnter.append("circle"); var republicanEnter = nodeEnter.append("g") .attr("class", "g-republican"); republicanEnter.append("clipPath") .attr("id", function(d) { return "g-clip-republican-" + d.id; }) .append("rect"); republicanEnter.append("circle"); nodeEnter.append("line") .attr("class", "g-split"); node.selectAll("rect") .attr("y", function(d) { return -d.r - clipPadding; }) .attr("height", function(d) { return 2 * d.r + 2 * clipPadding; }); node.select(".g-democrat rect") .style("display", function(d) { return d.k > 0 ? null : "none" }) .attr("x", function(d) { return -d.r - clipPadding; }) .attr("width", function(d) { return 2 * d.r * d.k + clipPadding; }); node.select(".g-republican rect") .style("display", function(d) { return d.k < 1 ? null : "none" }) .attr("x", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("width", function(d) { return 2 * d.r; }); node.select(".g-democrat circle") .attr("clip-path", function(d) { return d.k < 1 ? "url(#g-clip-democrat-" + d.id + ")" : null; }); node.select(".g-republican circle") .attr("clip-path", function(d) { return d.k > 0 ? "url(#g-clip-republican-" + d.id + ")" : null; }); node.select(".g-split") .attr("x1", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("y1", function(d) { return -Math.sqrt(d.r * d.r - Math.pow(-d.r + 2 * d.r * d.k, 2)); }) .attr("x2", function(d) { return -d.r + 2 * d.r * d.k; }) .attr("y2", function(d) { return Math.sqrt(d.r * d.r - Math.pow(-d.r + 2 * d.r * d.k, 2)); }); node.selectAll("circle") .attr("r", function(d) { return r(d.count); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateNodes() {\n for (var item = 0; item < matrixLen; item++) {\n addItem(tempArray[item]);\n }\n addButton();\n }", "function updateNodes() {\n node = node.data(data.topics, function(d) {\n return d.name;\n });\n\n node.exit().remove()...
[ "0.7232441", "0.70909846", "0.69900596", "0.6880904", "0.6800278", "0.67776644", "0.6766936", "0.67061895", "0.6682401", "0.65789086", "0.6509172", "0.6435647", "0.6375836", "0.63610035", "0.6337292", "0.63245517", "0.6324409", "0.63194233", "0.6291541", "0.62733907", "0.6259...
0.5800237
94
Update the displayed node labels.
function updateLabels() { label = label.data(data.topics, function(d) { return d.name; }); label.exit().remove(); var labelEnter = label.enter().append("a") .attr("class", "g-label") .attr("href", function(d) { return "#" + encodeURIComponent(d.name); }) .call(force.drag) .call(linkTopic); labelEnter.append("div") .attr("class", "g-name") .text(function(d) { return d.name; }); labelEnter.append("div") .attr("class", "g-value"); label .style("font-size", function(d) { return Math.max(8, d.r / 2) + "px"; }) .style("width", function(d) { return d.r * 2.5 + "px"; }); // Create a temporary span to compute the true text width. label.append("span") .text(function(d) { return d.name; }) .each(function(d) { d.dx = Math.max(d.r * 2.5, this.getBoundingClientRect().width); }) .remove(); label .style("width", function(d) { return d.dx + "px"; }) .select(".g-value") .text(function(d) { return formatShortCount(d.parties[0].count) + " - " + formatShortCount(d.parties[1].count); }); // Compute the height of labels when wrapped. label.each(function(d) { d.dy = this.getBoundingClientRect().height; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateLabels() {\n label = label.data(data.topics, function(d) {\n return d.name;\n });\n\n label.exit().remove();\n\n var labelEnter = label.enter().append(\"a\")\n .attr(\"class\", \"g-label\")\n .attr(\"id\", function(d) {\n re...
[ "0.7136593", "0.69141847", "0.6898004", "0.6802935", "0.67315245", "0.66303724", "0.66242313", "0.66188896", "0.66165584", "0.6605812", "0.6589973", "0.6467728", "0.6438781", "0.6405271", "0.63405585", "0.63405585", "0.6313205", "0.63078684", "0.6287532", "0.62315905", "0.620...
0.7029836
28
Update the active topic.
function updateActiveTopic(topic) { d3.selectAll(".g-head").attr("class", topic ? "g-head g-has-topic" : "g-head g-hasnt-topic"); if (activeTopic = topic) { node.classed("g-selected", function(d) { return d === topic; }); updateMentions(findMentions(topic)); d3.selectAll(".g-head a").text(topic.name); d3.select(".g-democrat .g-head span.g-count").text(formatCount(topic.parties[0].count)); d3.select(".g-republican .g-head span.g-count").text(formatCount(topic.parties[1].count)); } else { node.classed("g-selected", false); updateMentions(sampleMentions()); d3.selectAll(".g-head a").text("various topics"); d3.selectAll(".g-head span.g-count").text("some number of"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateActiveTopic(topic) {\n if (activeTopic = topic) {\n node.classed(\"g-selected\", function(d) { return d === topic; });\n updateMentions(findMentions(topic));\n d3.select(\"#g-topic\").text((topic.count > maxMentions ? \"A sampling of \" : topic.count || \"No\") + \" mentions of \" + topic....
[ "0.7262941", "0.6778754", "0.6123975", "0.6117092", "0.60513514", "0.6050638", "0.6042087", "0.6021171", "0.59397566", "0.5913625", "0.5878051", "0.58735174", "0.5779246", "0.5770122", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.57624775", "0.5762...
0.68540275
27
Bind the arrow path elements with their associated topic.
function updateArrows() { arrow = arrow.data( data.topics.filter(function(d) { return d.arrow; }), function(d) { return this.id ? this.id.substring(8) : d.arrow; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bindTopicToAction(topic, action) {\n\n const client = new PubkeeperClient({\n server: config.PK_SERVER,\n jwt: config.PK_JWT,\n brews: [\n new WebSocketBrew({\n brewerConfig: {\n hostname: config.PKWEBSOCKET_HOST,\n port: config.PKWEBSOCKET_PORT,\n ...
[ "0.53744376", "0.5305825", "0.5139406", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", "0.50890577", ...
0.65143627
28
Return a random sample of mentions per party, one per topic. Mentions are returned in chronological order.
function sampleMentions() { return data.parties.map(function(party, i) { return data.topics .map(function(d) { return d.parties[i].mentions; }) .filter(function(d) { return d.length; }) .map(function(d) { return d[Math.floor(Math.random() * d.length)]; }) .sort(orderMentions); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sampleMentions() {\n return data.topics\n .filter(function(d) { return d.mentions.length; })\n .map(function(d) { return d.mentions[Math.floor(Math.random() * d.mentions.length)]; })\n .sort(orderMentions);\n}", "function findMentions(topic) {\n return data.parties.map(function(party, i...
[ "0.8132888", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045", "0.76530045",...
0.8405532
28
Return displayable mentions per party for the specified topic. If too many, a random sample of matching mentions is returned. Mentions are returned in chronological order.
function findMentions(topic) { return data.parties.map(function(party, i) { var mentions = topic.parties[i].mentions; if (mentions.length > maxMentions) { shuffle(mentions).length = maxMentions; mentions.sort(orderMentions); mentions.truncated = true; } return mentions; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findMentions(topic) {\n var mentions = topic.mentions;\n if (mentions.length > maxMentions) {\n shuffle(mentions).length = maxMentions;\n mentions.sort(orderMentions);\n }\n return mentions;\n}", "function sampleMentions() {\n return data.parties.map(function(party, i) {\n return data.topi...
[ "0.774369", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", "0.71776617", ...
0.8250053
28
Group mentions by speaker, collapse overlapping excerpts.
function groupMentionsBySpeaker(mentions) { return d3.nest() .key(function(d) { return d.section.speaker; }) .rollup(collapseMentions) .entries(mentions); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function collapseMentions(mentions) {\n var sentenceRe = /([!?.)]+)\\s+/g, // sentence splitting requires NLP\n i,\n n = mentions.length,\n d0,\n d1;\n\n // First compute the excerpt contexts.\n for (i = 0; i < n; ++i) {\n d0 = mentions[i];\n d0.start = excerptStart(d0);\n d0.end = ...
[ "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.685176", "0.68517...
0.7465256
28
Given an array of mentions, computes the start and end point of the context excerpt, and then collapses any overlapping excerpts.
function collapseMentions(mentions) { var sentenceRe = /([!?.)]+)\s+/g, // sentence splitting requires NLP i, n = mentions.length, d0, d1; // First compute the excerpt contexts. for (i = 0; i < n; ++i) { d0 = mentions[i]; d0.start = excerptStart(d0); d0.end = excerptEnd(d0); } // Then collapse any overlapping excerpts (from the same speech). for (i = 1, d1 = mentions[0]; i < n; ++i) { d0 = d1; d1 = mentions[i]; if (d1.section.speech.id === d0.section.speech.id && d1.start >= d0.start && d1.start < d0.end) { d1.start = -1; d0.end = d1.end; d1 = d0; } } // Returns the start index of the excerpt for the specified mention. function excerptStart(mention) { var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match; while (match = sentenceRe.exec(mention.section.speech.text)) { if (match.index < mention.i - 20) return match.index + match[0].length; if (i <= mention.section.i) break; sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20); } return mention.section.i; } // Returns the end index of the excerpt for the specified mention. function excerptEnd(mention) { var i = mention.section.j, match; sentenceRe.lastIndex = mention.j + 40; match = sentenceRe.exec(mention.section.speech.text); return match ? Math.min(match.index + match[1].length, i) : i; } return mentions.filter(function(d) { return d.start >= 0; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_applyEllipses(start, end) {\n if (this.ellipses) {\n if (start > 0) {\n // The first page will always be included. If the displayed range\n // starts after the third page, then add ellipsis. But if the range\n // starts on the third page, then add the...
[ "0.5495962", "0.5235811", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "0.5157094", "...
0.68123806
29
Returns the start index of the excerpt for the specified mention.
function excerptStart(mention) { var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match; while (match = sentenceRe.exec(mention.section.speech.text)) { if (match.index < mention.i - 20) return match.index + match[0].length; if (i <= mention.section.i) break; sentenceRe.lastIndex = i = Math.max(mention.section.i, i - 20); } return mention.section.i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function excerptEnd(mention) {\n var i = mention.section.j, match;\n sentenceRe.lastIndex = mention.j + 40;\n match = sentenceRe.exec(mention.section.speech.text);\n return match ? Math.min(match.index + match[1].length, i) : i;\n }", "function excerptEnd(mention) {\n var i = mention.section.j, m...
[ "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674", "0.66161674"...
0.8424665
29
Returns the end index of the excerpt for the specified mention.
function excerptEnd(mention) { var i = mention.section.j, match; sentenceRe.lastIndex = mention.j + 40; match = sentenceRe.exec(mention.section.speech.text); return match ? Math.min(match.index + match[1].length, i) : i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function excerptStart(mention) {\n var i = sentenceRe.lastIndex = Math.max(mention.section.i, mention.i - 80), match;\n while (match = sentenceRe.exec(mention.section.speech.text)) {\n if (match.index < mention.i - 20) return match.index + match[0].length;\n if (i <= mention.section.i) break;\n ...
[ "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364", "0.66082364"...
0.84146756
29
Orders mentions chronologically: by speech and position within speech.
function orderMentions(a, b) { return a.section.speech.id - b.section.speech.id || a.i - b.i; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortTwitsByText( ) {\n this.twits.sort( (a, b) => {\n \n if (this.switchPosition == \"normal\");\n if (a.text > b.text) {\n return 1;\n }\n if (a.text < b.text) {\n return -1;\n }\n if (this.switchPosition == \"rever...
[ "0.60937816", "0.55811733", "0.5532338", "0.54517126", "0.5322693", "0.5262462", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", "0.52490103", ...
0.6685393
29
Assign event handlers to topic links.
function linkTopic(a) { a .on("click", click) .on("mouseover", mouseover) .on("mouseout", mouseout); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function linkTopic(a) {\n a.on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n }", "function linkTopic(a) {\n a .on(\"click\", click);\n //.on(\"mouseover\", mouseover)\n //.on(\"mouseout\", mouseout);\n}", "linksHandler() {\n\t\tr...
[ "0.7027552", "0.6863875", "0.64106756", "0.6332329", "0.62175745", "0.59810287", "0.5946024", "0.58910644", "0.5687338", "0.56710696", "0.56260896", "0.56119186", "0.559328", "0.55852777", "0.55852777", "0.5515453", "0.5492993", "0.54866874", "0.5475323", "0.5457495", "0.5455...
0.69139016
29
Returns the topic matching the specified name, approximately. If no matching topic is found, returns undefined.
function findTopic(name) { for (var i = 0, n = data.topics.length, t; i < n; ++i) { if ((t = data.topics[i]).name === name || new RegExp("^" + (t = data.topics[i]).re.source + "$", "i").test(name)) { return t; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!topic) {\n topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1));\n topic.y = 0;\n updateTopics(data.topics);\n }\n return topic;\n}", "function findOrAddTopic(name) {\n var topic = findTopic(name);\n if (!t...
[ "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "0.7292065", "...
0.7834644
29
Returns the topic matching the specified name, approximately. If no matching topic is found, a new one is created.
function findOrAddTopic(name) { var topic = findTopic(name); if (!topic) { topic = data.topic(name.substring(0, 1).toUpperCase() + name.substring(1)); topic.y = 0; updateTopics(data.topics); } return topic; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findOrAddTopic(name) {\n var topic = findTopic(name);\n return topic;\n}", "function findTopic(name) {\n for (var i = 0, n = data.topics.length, t; i < n; ++i) {\n if ((t = data.topics[i]).name === name || new RegExp(\"^\" + (t = data.topics[i]).re.source + \"$\", \"i\").test(name)) {\n retur...
[ "0.75759107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107", "0.73810107"...
0.77954704
28
Simulate forces and update node and label positions on tick.
function tick(e) { node .each(bias(e.alpha * 105)) .each(collide(.5)) .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); label .style("left", function(d) { return (d.x - d.dx / 2) + "px"; }) .style("top", function(d) { return (d.y - d.dy / 2) + "px"; }); arrow.style("stroke-opacity", function(d) { var dx = d.x - d.cx, dy = d.y - d.cy; return dx * dx + dy * dy < d.r * d.r ? 1: 0; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tickPhysics()\n{\n n_recalculateTorques(rootNode);\n n_applyTorques(rootNode);\n n_updatePositions(rootNode);\n}", "function tick(e) {\n\t // make sure the force gets smaller as the simulation runs\n\t var ky = 10 * e.alpha;\n\t \n\t root.nodes.forEach(function(d, i) {\n\t\t// fix the x va...
[ "0.69361484", "0.66475767", "0.66207063", "0.6548886", "0.65287095", "0.643942", "0.63420755", "0.6320788", "0.6320117", "0.6315147", "0.6245371", "0.6233002", "0.6137982", "0.610261", "0.60940826", "0.6028687", "0.6019603", "0.59852123", "0.59837604", "0.59708226", "0.595979...
0.58123493
55
A leftright bias causing topics to orient by party preference.
function bias(alpha) { return function(d) { d.x += d.bias * alpha; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lined_on( origin, base, bias){\n return origin + (base - origin) * bias;\n }", "function drawBias() {\n\tctx.fillStyle = \"white\";\n\tctx.font = \"14px Monospace\";\n\tctx.fillText(\"BIASES\", 30, 180);\n\t\n\tif (network == null) return;\n\t\n\tlet biases = network.bias.matrix[0];\n\tfor (let i=0;...
[ "0.62531126", "0.5555873", "0.5474362", "0.5433658", "0.5406714", "0.5377929", "0.53565264", "0.5319594", "0.531506", "0.5297229", "0.52530986", "0.51892704", "0.518832", "0.5172908", "0.51517606", "0.51517606", "0.5143453", "0.51297593", "0.5114689", "0.5107598", "0.51045483...
0.0
-1
Resolve collisions between nodes.
function collide(alpha) { var q = d3.geom.quadtree(data.topics); return function(d) { var r = d.cr + maxRadius + collisionPadding, nx1 = d.x - r, nx2 = d.x + r, ny1 = d.y - r, ny2 = d.y + r; q.visit(function(quad, x1, y1, x2, y2) { if (quad.point && (quad.point !== d) && d.other !== quad.point && d !== quad.point.other) { var x = d.x - quad.point.x, y = d.y - quad.point.y, l = Math.sqrt(x * x + y * y), r = d.cr + quad.point.r + collisionPadding; if (l < r) { l = (l - r) / l * alpha; d.x -= x *= l; d.y -= y *= l; quad.point.x += x; quad.point.y += y; } } return x1 > nx2 || x2 < nx1 || y1 > ny2 || y2 < ny1; }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleCollisions() {\n\tfor(var i = 4; i < grupo.children.length-1; i++){\n\t\t//j = i + 1 -> important to avoid unecessary checks\n\t\tfor(var j = i+1; j < grupo.children.length; j++){\n\t\t\tgrupo.children[i].checkCollisions(grupo.children[j]);\n\t\t}\n }\n}", "function resolveCollisions(nodesByBread...
[ "0.63642544", "0.6354681", "0.6265527", "0.6175786", "0.61545223", "0.6125178", "0.60746783", "0.6014029", "0.5948296", "0.5934016", "0.5886665", "0.5883664", "0.5880635", "0.5880635", "0.5880635", "0.5843411", "0.5809456", "0.57995117", "0.57941675", "0.5793322", "0.57710433...
0.0
-1
Given two quantities a and b, returns the fraction to split the circle a + b.
function fraction(a, b) { var k = a / (a + b); if (k > 0 && k < 1) { var t0, t1 = Math.pow(12 * k * Math.PI, 1 / 3); for (var i = 0; i < 10; ++i) { // Solve for theta numerically. t0 = t1; t1 = (Math.sin(t0) - t0 * Math.cos(t0) + 2 * k * Math.PI) / (1 - Math.cos(t0)); } k = (1 - Math.cos(t1 / 2)) / 2; } return k; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function divide(a, b) {\n\t\ta = a + 0.0;\n\t\tb = b + 0.0;\n\t\tif(Math.abs(b) < 0.00001) {\n\t\t\tb = 0.0001;\n\t\t}\t\n\t\treturn a / b;\n\t}", "toFraction(a, b) {\n var r = Fraction(a, b);\n if (algebraicMode && r.den == 1)\n return r.num;\n else\n ...
[ "0.70612884", "0.6900385", "0.66337264", "0.64886814", "0.6479283", "0.64708656", "0.6453039", "0.64450073", "0.63730025", "0.62924194", "0.6288027", "0.6276519", "0.6257361", "0.6207109", "0.6181705", "0.6172507", "0.61696637", "0.6164338", "0.6155207", "0.61433804", "0.6141...
0.73185223
28
Update the active topic on hashchange, perhaps creating a new topic.
function hashchange() { var name = decodeURIComponent(location.hash.substring(1)).trim(); updateActiveTopic(name && name != "!" ? findOrAddTopic(name) : null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(name && name != \"!\" ? findOrAddTopic(name) : null);\n }", "function hashchange() {\n var name = decodeURIComponent(location.hash.substring(1)).trim();\n updateActiveTopic(findTopic...
[ "0.7695971", "0.73827994", "0.69993854", "0.68418825", "0.67827946", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", "0.663386", ...
0.7666164
29
Trigger a hashchange on submit.
function submit() { var name = this.search.value.trim(); location.hash = name ? encodeURIComponent(name) : "!"; this.search.value = ""; d3.event.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashChanged() {\n var url = \"#\" + (document.location.hash.slice(1) || \"\");\n history.push(url);\n trigger(\"GET\", url);\n }", "function hashChanged(e){\n\t\trespondToState();\n\t}", "function onSubmitted(){\n\t\t\t\t\t\t\t\t\t\t\tlocation.hash = \"/tool/list\";\n\t\t\t\t\t\t\t\t\t\t}", ...
[ "0.71174204", "0.7089558", "0.68358386", "0.6628981", "0.6533835", "0.6524384", "0.64782697", "0.64602304", "0.6450485", "0.64113677", "0.63756573", "0.63756573", "0.63756573", "0.63756573", "0.63756573", "0.6299319", "0.6299319", "0.6299319", "0.62894017", "0.62665874", "0.6...
0.60647637
60
Clear the active topic when clicking on the chart background.
function clear() { location.replace("#!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearSelected() {\n var query = \"#corpus-topics li.selected\";\n if (tenMode) {\n query = \"#corpus-ten-topics li.selected\"\n }\n d3.selectAll(query).each(function(){\n removeTopicFromSelected(this.dataset.topic);\n });\n}", "clearActive() {\n this.handleMenuItemChange(\"active\");\n ...
[ "0.68818283", "0.64014804", "0.6398615", "0.6365971", "0.6179527", "0.6082558", "0.5980829", "0.59794503", "0.59765404", "0.597275", "0.59491104", "0.59434015", "0.5904077", "0.5872475", "0.58408123", "0.58096766", "0.58014303", "0.57997775", "0.57924306", "0.5758625", "0.575...
0.0
-1
Rather than flood the browser history, use location.replace.
function click(d) { location.replace("#" + encodeURIComponent(d === activeTopic ? "!" : d.name)); // PFS: 12/05/2015 parent.resizeIframeByHeight(parent.document.getElementsByName('iframe_a')[0],document.getElementById('interactiveABC').scrollHeight); d3.event.preventDefault(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function replaceURL(url){window.location.replace=url}", "function o(e){window.history.replaceState(null,\"\",r.state.url),window.location.replace(e)}", "function locationReplace(url) {\n window.history.replaceState(null, \"\", \"#\")\n window.location.replace(url)\n}", "function locationReplace(url) {\n w...
[ "0.82390016", "0.81649625", "0.81170756", "0.81170756", "0.81170756", "0.81170756", "0.7828173", "0.7807103", "0.7807103", "0.7807103", "0.78008497", "0.7715696", "0.73246163", "0.7323378", "0.72504103", "0.7245687", "0.7239423", "0.71795017", "0.7047154", "0.7037156", "0.702...
0.0
-1
When hovering the label, highlight the associated node and vice versa. When no topic is active, also crosshighlight with any mentions in excerpts.
function mouseover(d) { node.classed("g-hover", function(p) { return p === d; }); if (!activeTopic) d3.selectAll(".g-mention p").classed("g-hover", function(p) { return p.topic === d; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseover(d) {\n node.classed(\"g-hover\", function(p) {\n return p === d;\n });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) {\n return p.topic === d;\n });\n }", "function highlightLabel(highlight) {\n d...
[ "0.67012674", "0.64878684", "0.63921267", "0.6354405", "0.62633663", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265", "0.62607265",...
0.6869039
28
When hovering the label, highlight the associated node and vice versa. When no topic is active, also crosshighlight with any mentions in excerpts.
function mouseout(d) { node.classed("g-hover", false); if (!activeTopic) d3.selectAll(".g-mention p").classed("g-hover", false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic) d3.selectAll(\".g-mention p\").classed(\"g-hover\", function(p) { return p.topic === d; });\n}", "function mouseover(d) {\n node.classed(\"g-hover\", function(p) { return p === d; });\n if (!activeTopic)...
[ "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "0.6867467", "...
0.62592727
61
myNames.filter(name => name[0] === 'R'); console.log(filteredNames); // => ['Rich', 'Ray'] < DO NOT EDIT BETWEEN THESE LINES TASK: DEFINE YOUR FILTER FUNCTION BELOW:
function filter(arr, fn) { let newArray = []; arr.forEach(function(word) { if (fn(word) === true) { newArray.push(word); } }); // for (let i = 0; i < arr.length; i++) { // if (fn(arr[i]) === true) { // newArray.push(arr[i]); // } // } return newArray; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function namesA (arr) {\n var newArr = arr.filter(function(element){\n return element[0] === \"A\";\n });\n}", "function filterByName(searchForName, personList) {\n searchForName = searchForName.toLowerCase();\n return personList.filter((person) => {\n console.log(person)\n // Only needs...
[ "0.7429913", "0.71968865", "0.7112225", "0.7028007", "0.6914757", "0.6825245", "0.6774952", "0.66575575", "0.65211946", "0.6514764", "0.6483694", "0.6471839", "0.6434838", "0.64284486", "0.6391881", "0.63863933", "0.6370566", "0.63263726", "0.6302567", "0.62834924", "0.624564...
0.60248697
36
TODO: parse away the Finnishpart of the message? TODO: set some fallbackimage? jscs:disable maximumLineLength,requireCamelCaseOrUpperCaseIdentifiers
render() { const item = this.props.item; const fallbackImage = 'https://storage.googleapis.com/futurice-event-app/assets/wappu-team-says.jpg'; if (!item) { return <Loader />; } return ( <View style={styles.container}> <View style={styles.card}> <View style={styles.imgWrap}> <Image source={{ uri: item.picture || fallbackImage}} style={styles.img} > <View style={styles.imgColorLayer} /> </Image> </View> <View style={styles.textContainer}> <Text style={styles.text__title}>WAPPU TEAM SAYS: </Text> <ParsedText style={styles.text} parse={ [ {type: 'url', style: styles.url, onPress: this.handleUrlPress} ] } > {item.message} </ParsedText> </View> <Text style={styles.timestampText}> {time.getTimeAgo(item.created_time)} </Text> </View> </View> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "TheMessage(msg) {\n return;\n }", "function parseOldMessage(message) {\n console.log(\"**************************** \" + message);\n var legalContent = message.replace(incomingFilter, '');\nvar front = legalContent.substr(0, legalContent.indexOf(':'));\nvar content = legalContent.substr(legalCont...
[ "0.6174593", "0.59013885", "0.5868048", "0.5834933", "0.5805863", "0.56934065", "0.5690003", "0.5679782", "0.56313413", "0.56300515", "0.5576313", "0.55373293", "0.5485271", "0.5461559", "0.5460439", "0.5451381", "0.5451381", "0.54372203", "0.54282784", "0.54224247", "0.54189...
0.0
-1
a little function to help the stubbed out routes
function getThing (thing) { return function (req, res) { res.render(thing); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "doRoute() {\n let routename = 'HTTP:' + this.request.method + ':' + this.url.pathname;\n this.run(routename, this.restnio.routes, \n Parser.parseFullHttpParams, this.request, this.url);\n }", "route() {\n this.router\n .route('/:id/accounts')\n .get(validateToken, verifyI...
[ "0.66899425", "0.66037214", "0.65785885", "0.6513291", "0.6469461", "0.64280224", "0.64121205", "0.63814133", "0.63707966", "0.6364794", "0.6332877", "0.62410223", "0.623515", "0.6202859", "0.6200318", "0.620011", "0.6199692", "0.61903125", "0.6168049", "0.6104129", "0.609975...
0.0
-1
update is same as create for now.
async function updatePushIdea(pushIdeaObject) { return createPushIdea(pushIdeaObject); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(){}", "update(){}", "update(){}", "update(now) {\n throw new Error('You have to implement the \"update\" method!');\n }", "update(id) {\n\n }", "async function UpdateNew() {}", "async createOrUpdate () {\n\t\tif (this.existingModel) {\n\t\t\tawait this.update();\n\t\t}\n\t\telse {\n\t\t\t...
[ "0.79754823", "0.79754823", "0.79754823", "0.68861467", "0.68571585", "0.6806252", "0.65711987", "0.6549048", "0.6492383", "0.6458585", "0.6443829", "0.63978976", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "0.63844573", "...
0.0
-1
The fight function starts below this comment
function fight() { if (players[0].health < 1 && players[1].health < 1) { return false; } //Gives a minimum damage rating (10) to the maximum rating in the fighter variable (20) var minDamage1 = players[0].damage * .5; var minDamage2 = players[1].damage * .5; //Outputs a random number between 10 and 20 for Damage var f1 = Math.floor(Math.random() * (players[0].damage - minDamage1) + minDamage1); var f2 = Math.floor(Math.random() * (players[1].damage - minDamage2) + minDamage2); //updates health for the players with the new result players[0].health -= f1; players[1].health -= f2; // Calls the winnerCheck function var finalResult = winnerCheck(); console.log(finalResult); // This prints the outcome thus far to the console if (finalResult === "no winner yet") { round++; document.getElementById("kabal").innerHTML = players[0].name + ": " + players[0].health; document.getElementById("kratos").innerHTML = players[1].name + ": " + players[1].health; document.getElementById("round_number").innerHTML = "Round " + round + ": COMPLETE!"; } else { document.getElementById("kabal").innerHTML = "&nbsp;"; document.getElementById("kratos").innerHTML = "&nbsp;"; document.getElementById("round_number").innerHTML = finalResult; console.log(button); button.innerHTML = "Finished!!!"; button.setAttribute('onclick', null); } } //This is where the fight function ends
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fight (){\n\t//object variable to refence the current defenders stats\n\tvar defend = characters[defender];\n\n\t//object variable to refence the players characters stats\n\tvar player = characters[player_char];\n\n\t//change player's hp by the current defenders counter attack stat\n\tplayer[\"hp\"] -= de...
[ "0.7551381", "0.7526175", "0.7301798", "0.7214418", "0.7212308", "0.7207419", "0.71878284", "0.71682334", "0.7104167", "0.70825624", "0.70531666", "0.70528215", "0.7044688", "0.70057124", "0.69881123", "0.69550425", "0.69237685", "0.69204074", "0.6885222", "0.6883091", "0.682...
0.0
-1
This is where the winnerCheck function begins
function winnerCheck(){ console.log("in winnerCheck function"); var result = "no winner yet"; if (players[0].health < 1 && players[1].health < 1) { result="Draw"; } else if (players[0].health < 1) { result = players[1].name + " Wins!!!"; } else if (players[1].health < 1) { result = players[0].name + " Wins!!!"; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "check_winner() {\n //check all horizontal\n let player_won = false;\n let winner;\n let where_string;\n if (this.check_winner_row(0)) {\n player_won = true;\n winner = this.board_spaces[0].get_top();\n where_string = 'on row 1';\n } else if...
[ "0.79708654", "0.78941214", "0.7678011", "0.7586455", "0.7520717", "0.75167274", "0.750261", "0.7467108", "0.74580115", "0.74576217", "0.74502397", "0.7443073", "0.74408716", "0.74230456", "0.73953235", "0.7384824", "0.736292", "0.7356105", "0.73534864", "0.73356366", "0.7329...
0.72580844
32
This code is an example of sending a http request receive a response with in another http session. First post request come in to route point router.post('/token', ...); Then before send a reply back to client another request is generating using superagent l ibrary to once reply is coming in (with the .end method) the the reply to the "original" first request is send to the client using the promiseRes response object.
function getToken(promiseRes) { request .post('http://localhost:3000/promise/token') .send({name: "tsemach", game: "is the man"}) // sends a JSON post body .set('Accept', 'application/json') .end((err, res) => { // Calling the end function will send the request console.log("getToken: res = " + res.body.toString()); promiseRes.send({promise: 'done'}); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async send(request, response) {}", "async receive(request, response) {}", "static postReponse() {\n const reqMessage = JSON.parse(this.req.chunks[0]);\n\n this.res.writeHead(200);\n this.res.end();\n Bot.Functions.load(reqMessage.group_id);\n function send() {\n //...
[ "0.6614628", "0.5940748", "0.5912073", "0.58650607", "0.584834", "0.5840205", "0.5833111", "0.5788345", "0.57876074", "0.5754245", "0.5708558", "0.56855744", "0.56716514", "0.56446415", "0.56356794", "0.5624048", "0.56194246", "0.5615879", "0.5595748", "0.5586574", "0.5553871...
0.62423104
1
Example 1 Defining skeleton of Car object
function Car(name, color, price, company){ this.name = name this.color = color this.price = price this.company =company }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get skeleton() {}", "function Car(year, make, model) {\n this.sound = \"VRRRRRM\"\n this.type = \"Car\"\n Vehicle.call(this, year, make, model)\n \n}", "function CarMaker(){}", "set skeleton(value) {}", "function CarMaker() {}", "function Car(brand, model) {\n this.brand = brand\n this.model ...
[ "0.68618804", "0.65702736", "0.65423256", "0.64889216", "0.64661145", "0.6356149", "0.6349651", "0.63335603", "0.63235384", "0.6301395", "0.6289095", "0.62632996", "0.6249437", "0.6185378", "0.6173466", "0.61513186", "0.61513186", "0.61513186", "0.6147331", "0.6103859", "0.61...
0.56562567
77
Example 2 1st way Defining a class named Arr and our own property like predefined length property on array objects
function Arr(arr=[]){ this.arr = arr this.type = typeof arr this.total_items_count = function (){ count = 0 for (var i = 0; i < this.arr.length; i++){ count += 1 } return count } this.len = this.total_items_count() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get arraySize() {}", "length(arr) {\n return arr.length;\n }", "function arrayLengthTest2() {\n var arr;\n\n arr = [ 1, 2 ];\n Array.prototype[2] = 'entry-in-proto';\n\n print(arr.length, arr[0], arr[1], arr[2], arr[3]);\n\n print(JSON.stringify(arr));\n}", "function main() {\n\n Ar...
[ "0.6944659", "0.68672657", "0.68197477", "0.67784697", "0.6701642", "0.66438645", "0.656437", "0.6552879", "0.6457395", "0.63919795", "0.6386485", "0.63513136", "0.62543947", "0.62125033", "0.61841005", "0.6117681", "0.6090436", "0.6042284", "0.59940344", "0.5989124", "0.5987...
0.7584731
0
Example 3 2nd way Defining a class named Arr and our own property like predefined length property on array objects
function MyArray(arr=[]){ this.arr = arr this.type = typeof arr this.len = total_items this.sum = function(){ s = 0 this.arr.forEach(function(item){ s += item }) return s } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Arr(arr=[]){\n\tthis.arr = arr\n\tthis.type = typeof arr\n\t\n\tthis.total_items_count = function (){\n\t\tcount = 0\n\t\tfor (var i = 0; i < this.arr.length; i++){\n\t\t\tcount += 1\n\t\t}\n\t\treturn count\n\t}\n\tthis.len = this.total_items_count()\n}", "get arraySize() {}", "function arrayLengthTe...
[ "0.7603584", "0.6944865", "0.6882298", "0.68588364", "0.6742108", "0.67283565", "0.66138184", "0.6561255", "0.6544978", "0.6439339", "0.6388988", "0.6336112", "0.6275034", "0.621946", "0.6170189", "0.6126601", "0.611459", "0.60096574", "0.60022223", "0.60018194", "0.5994176",...
0.63655025
11
fillEditSummaries for VisualEditor, borrowed from "based on Grunny's jQuery version of Sikon's original version"
function fillEditSummariesVisualEditor() { mw.hook( 've.activationComplete' ).add(function () { $.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) { var $summaryOptionsList, $summaryLabel = $( '.ve-ui-summaryPanel' ), $summaryInput = $( '.ve-ui-summaryPanel-summaryInputField > input' ), lines = data.split( '\n' ), $wrapper = $( '<div>').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' ); $summaryOptionsList = $( '<select />' ).attr( 'id', 'stdEditSummaries' ).change( function() { var editSummary = $( this ).val(); if ( editSummary !== '' ) { $summaryInput.val( editSummary ); } } ); for ( var i = 0; i < lines.length; i++ ) { var editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : ''; $summaryOptionsList.append( $( '<option>' ).val( editSummaryText ).text( lines[i] ) ); } $summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) ); } ); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fillEditSummaries() {\n\n\tif ( !$( '#wpSummaryLabel' ).length ) {\n\t\treturn;\n\t}\n\n\t$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {\n\t\tvar\t$summaryOptionsList,\n\t\t\t$summaryLabel = $( '#wpSummaryLabel' ),\n\t\...
[ "0.75905913", "0.75905913", "0.7580197", "0.7521105", "0.73072886", "0.6594714", "0.57314813", "0.5653535", "0.55813056", "0.55471015", "0.5448848", "0.5430851", "0.54249316", "0.54189384", "0.5395011", "0.5377594", "0.53286415", "0.5327642", "0.52212805", "0.5168593", "0.516...
0.7550771
3
POST User in DB
function addNewUser(user){ fetch("https://students-3d096.firebaseio.com/.json", { method:"POST", headers: { "Content-type": "application/json" }, body: JSON.stringify(user) }) .then(res => res.json()) .then(data => { users.push({...user, id: data.name}); showUsersInfo(users); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postUser(req, res) {\n User.create({\n name: req.body.name,\n email: req.body.email,\n password: req.body.password\n },\n function (err, user) {\n if (err) return res.status(500).send(\"There was a problem adding the information to the database.\");\n ...
[ "0.7232981", "0.7171108", "0.7105241", "0.70450854", "0.70371866", "0.70073676", "0.6979549", "0.6943724", "0.69225806", "0.6921657", "0.6904248", "0.68871254", "0.68773717", "0.68731326", "0.6790053", "0.6766104", "0.6761648", "0.6735347", "0.6717131", "0.67121994", "0.67015...
0.0
-1
Edit User in DB
function editUserInfo(user){ fetch(`https://students-3d096.firebaseio.com/${user.id}.json`, { method:"PUT", headers: { "Content-type": "application/json" }, body: JSON.stringify(user) }) .then(res => res.json()) .then(data => { debugger users = users.map(user => { if(user.id == data.id) user = data; return user; }) showUsersInfo(users); isAdd = true; currentId = null; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function edit(req, res) {\n\tvar user_id = req.params.id;\n\tvar update = req.body;\n\n\t// do not update password in this method\n\tdelete update.password;\n\n\tif (user_id != req.user.sub) return res.status(500).send({ message: 'No tienes permiso para actualizar este usuario' });\n\n\tUser.findByIdAndUpdate(user...
[ "0.77155644", "0.77038884", "0.76689386", "0.7665904", "0.76140034", "0.7504789", "0.74198294", "0.7414744", "0.74078023", "0.7403332", "0.7389808", "0.727536", "0.7269812", "0.7240016", "0.72125584", "0.7127718", "0.71140206", "0.71104944", "0.70934826", "0.70738894", "0.703...
0.0
-1
Delete User from DB
function deleteUser(event){ let id = event.currentTarget.id; fetch(`https://students-3d096.firebaseio.com/${id}.json`, { method: 'DELETE' }) .then(res => res.json()) .then(data => { users = users.filter(user => user.id != id); showUsersInfo(users); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteUser() {\n userService\n .deleteUser(model.userId)\n .then(function() {\n $location.url(\"\");\n });\n }", "function deleteUser(req, res, next) {\n const sql = sqlString.format(`DELETE FROM users WHERE id = ?`, [\n ...
[ "0.79460835", "0.7927555", "0.7870987", "0.7849442", "0.78420573", "0.7826598", "0.78052", "0.7801093", "0.7746416", "0.774003", "0.77113277", "0.76761335", "0.76386476", "0.7607396", "0.7600734", "0.7570766", "0.75533706", "0.75363594", "0.75140965", "0.7505278", "0.7503326"...
0.0
-1
Using url parameter and json context as reference renders the numFact object or just text. Props: None Context: json numFact updateCurrNumberString Router > (APIResponse)
function APIResponse() { const { parameter } = useParams(); const {numFact, updateCurrNumberString, json} = useContext(NumberContext); useEffect(() => { updateCurrNumberString(parameter, true) }, []) // eslint-disable-line react-hooks/exhaustive-deps return ( <div className="API">{json ? JSON.stringify(numFact) : numFact.text}</div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFactAjax1(){\r\n let number = numberInput.value;\r\n if(number != ''){\r\n let xhr = new XMLHttpRequest();\r\n xhr.open('GET', 'http://numbersapi.com/'+number);\r\n\r\n xhr.onload = function(){\r\n if(this.status == 200){\r\n fact1.style.display = 'block';\r\n fact...
[ "0.56095946", "0.5566847", "0.55238754", "0.5516346", "0.55064994", "0.5320464", "0.52478284", "0.517854", "0.515293", "0.5085682", "0.5064342", "0.503334", "0.50287414", "0.49940336", "0.49579793", "0.49137762", "0.4907234", "0.49043846", "0.48985672", "0.48817647", "0.48793...
0.73164093
0
NIVEL: mp mapa esquema
function mapaProcesos_mapa_esquema(jsonObj,cont) { //Tenemos el JSON completo y el nivel en el que estamos var datos_mp_fullcontent = jsonObj; var i = cont; //Tenemos el segundo array del JSON completo [mp_estructura] -> [subnivel] var datos_mp_content = datos_mp_fullcontent[i].subnivel; for (var j = 0; j < datos_mp_content.length; j++) { var result_nombre = ""; var result_nivel = ""; result_nombre = datos_mp_content[j].nombre; result_nivel = datos_mp_content[j].nivel; result_nivel_sindecimal = result_nivel.split("_",3); //Recorrido del primer nivel del esquema del MP if (result_nivel_sindecimal[0] == "1"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part1_25porc\"><p></p></div>"+ "<div class=\"bc_mp_estruct_part1_50porc\">"+ "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "02"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "03"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part1_50porc_intern_33porc\">"+ result_nombre +"</div>"+"</div>"+ "<div class=\"bc_mp_estruct_part1_25porc\"><p></p></div>"; } } } } //Recorrido del segundo nivel del esquema del MP if (result_nivel_sindecimal[0] == "2"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc\">"+ result_nombre +"</div>"; } else{ if ((result_nivel_sindecimal[1]=="02")||(result_nivel_sindecimal[1]=="05")){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part2_05porc\">"+ ">" +"</div>"+ "<div class=\"bc_mp_estruct_part2_16porc\">"+ "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc_agrupados_bottom\">"+ result_nombre +"</div>"; } else { if ((result_nivel_sindecimal[1]=="03")||(result_nivel_sindecimal[1]=="06")){ texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc_agrupados_top\">"+ result_nombre +"</div>"+ "</div>"; } } if ((result_nivel_sindecimal[1] == "04")||(result_nivel_sindecimal[1] == "07")){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part2_05porc\">"+ ">" +"</div>"+ "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris2 bc_mp_estruct_part2_16porc\">"+ result_nombre +"</div>"; } } } //Recorrido del tercer nivel del esquema del MP if (result_nivel_sindecimal[0] == "3"){ if (result_nivel_sindecimal[1] < "20"){ if (result_nivel_sindecimal[1] == "01"){ texto_a_imprimir += "<div class=\"bc_mp_estruct_part3_50porc\">"; } texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_estruct_part3_50porc_intern_33porc\">"+ result_nombre +"</div>"; } else { if (result_nivel_sindecimal[1] == "21"){ texto_a_imprimir += "</div><div class=\"bc_mp_estruct_part3_50porc\">"; } texto_a_imprimir += "<div class=\"bc_mp_caja_borde bc_mp_caja_bgcolor_gris1 bc_mp_estruct_part3_50porc_intern_33porc\">"+ result_nombre +"</div>"; if (result_nivel_sindecimal[1] == "29"){ texto_a_imprimir += "</div>"; } } } } texto_a_imprimir += "</div>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function index_limpiarMapa() {\n\tobjetoLineas.setPath([]);\n\tobjetoLineas.setMap(map);\n\tarrayPuntos = new Array();\n\t\n\tif (arrayMarcas.length > 0) {\n\t\tfor (var x = 0; x < arrayMarcas.length; x++) {\n\t\t\tarrayMarcas[x].setMap(null);\n\t\t}\n\t}\n\t\t\n\tarrayMarcas = new Array();\n\t\n\tfor (var x = 0; ...
[ "0.6945057", "0.66730183", "0.6643837", "0.6609678", "0.6479947", "0.6479947", "0.6472625", "0.6414302", "0.6380582", "0.6375624", "0.6375172", "0.63698715", "0.63526547", "0.6339147", "0.63311493", "0.62608886", "0.62045765", "0.6185284", "0.6173085", "0.61390936", "0.613273...
0.61994356
17
funcion para el nuevo contenedor
function contenedorNuevaLista(){ var nuevaFila= document.createElement("div"); trelloObject.contenedor.appendChild(nuevaFila); nuevaFila.setAttribute("class", "nuevaFila"); nuevaFila.appendChild(trelloObject.spanAnadirLista); nuevaFila.appendChild(trelloObject.formHtml); trelloObject.spanAnadirLista.style.display = "inline-block"; trelloObject.botonHtml.disabled = true; trelloObject.inputHtml.addEventListener("keyup", function(){ var longitud = trelloObject.inputHtml.value.length; if (longitud <= 0){ trelloObject.botonHtml.disabled = true; }else if (longitud >= 1){ trelloObject.botonHtml.disabled = false; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciar() {\n \n }", "function create() {\n\n}", "function functionClic(){\n var newTuit = document.createElement(\"section\");\n var textTuit = document.createTextNode(document.getElementById(\"text-area-id\").value);\n var tuitList = document.getElementById(\"subcontainer-id\");\n...
[ "0.58534193", "0.58091646", "0.5660517", "0.5654602", "0.5652373", "0.5622404", "0.55763847", "0.55430865", "0.5528871", "0.552085", "0.55148834", "0.55125993", "0.55120677", "0.5486772", "0.54753566", "0.5459764", "0.5445767", "0.54372936", "0.5428892", "0.5421343", "0.54088...
0.5159175
85
method on class, every class needs a render method
render() { //manipulating state example return ( <div className="search-bar"> <input value={this.state.term} onChange={event => this.onInputChange(event.target.value)} /> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render(){\n //Every render method always return HTML\n return <h1>Welcome to Myclass</h1>;\n }", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\t}", "static rendered () {}", "static rendered () {}", "render() {\n // Subclasses should override\n }", "function render()...
[ "0.7767173", "0.7764078", "0.7739819", "0.77194345", "0.77194345", "0.76358885", "0.7520294", "0.7472425", "0.7446513", "0.7446513", "0.7402744", "0.73226756", "0.73226756", "0.73226756", "0.7318832", "0.72957635", "0.7272895", "0.7265707", "0.7265707", "0.726139", "0.726139"...
0.0
-1
Delete the images from the server's directories when a review is deleted
function deleteImages(restaurant, images) { const directory = `./public/images/restaurants/${restaurant}/`; for (const image of images) { const imagePath = directory + image; console.log(`Deleting ${imagePath}`); fs.unlinkSync(imagePath); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function cleanupImages() {\n let experiments = await Experiment.findAll({\n include: [{\n model: Image,\n as: 'images'\n }]\n })\n\n let filenames = []\n for (let experiment of experiments) {\n for (let image of experiment.images) {\n let url = image.dataValues.url\n filename...
[ "0.71073073", "0.67200756", "0.6669429", "0.6617434", "0.65599936", "0.6161805", "0.61463886", "0.6128327", "0.6106347", "0.60901755", "0.6084935", "0.606593", "0.60342157", "0.6006003", "0.5992644", "0.5975462", "0.5975361", "0.5958504", "0.5956197", "0.5937805", "0.59198797...
0.69779325
1
These function ensures the color scheme is kept while the display is updated
function enforceTheme(currentTheme) { switch(currentTheme) { case 0: changeToWhite(); break; case 1: changeToBlack(); break; case 2: changeToGray(); break; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeColorScheme() {\n\n}", "function refreshHardColors(){\n\t colors = createHardColors(squares.length , range);\n\t\treset();\n}", "function refreshEasyColors(){\n\t\tcolors = createColors(squares.length);\n\t\treset();\n\n}", "checkColorChange () {\n // Reset string on color change.\n t...
[ "0.7432713", "0.7284326", "0.7051959", "0.70502335", "0.6856662", "0.6855608", "0.6664189", "0.6534531", "0.6512329", "0.6476402", "0.6458809", "0.6434669", "0.6433338", "0.6391654", "0.6373688", "0.63562334", "0.63554585", "0.63537407", "0.63522184", "0.63360846", "0.6321068...
0.0
-1
$e("filters").innerHTML = $e("filters").innerHTML + stringTeste;
function new_toogle_button(classButton, textButton){ return "<span class=\"padding\" style=\"cursor:pointer;\" onclick=\""+classButton+"()\" >&nbsp;&nbsp;&nbsp;&nbsp;"+textButton+"&nbsp;<img src=\"/pics/sort_btn_gray_on.gif\" class=\""+classButton+"\"/></span>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setHtmlDetails(text){\n\n document.getElementById(\"where\").innerHTML = text;\n}", "function imprimirItemFilter(filtrado){\n estructuraFilter += '<div id=\"itemID-' + filtrado.id + '\" class=\"chopping-item\">'+ estructuraPrincipalItem(filtrado) +'</div>';\n document.getElementById(\"shoppin...
[ "0.6153464", "0.5838181", "0.5835688", "0.57965887", "0.57517594", "0.5701365", "0.5698193", "0.56826323", "0.5669122", "0.56671613", "0.5642336", "0.5618641", "0.56156814", "0.56136197", "0.5606953", "0.5599482", "0.5596889", "0.55816674", "0.55475926", "0.5539169", "0.55275...
0.0
-1
Removes all keyvalue entries from the list cache.
function listCacheClear() { this.__data__ = []; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t this.size = 0;\n\t\t}", "function listCacheClear() ...
[ "0.7357779", "0.7357779", "0.7357779", "0.7357779", "0.7317932", "0.72645503", "0.72645503", "0.7262977", "0.72569066", "0.72569066", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7236393", "0.7234546",...
0.0
-1
Removes all keyvalue entries from the stack.
function stackClear() { this.__data__ = new ListCache(); this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear () {\n this._dict = {}\n this._stack = [this._dict]\n }", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear() {\n\t this.__...
[ "0.63577557", "0.63297385", "0.63297385", "0.63297385", "0.62740946", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6227898", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544", "0.6217544"...
0.0
-1
Removes all keyvalue entries from the hash.
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", ...
[ "0.67331547", "0.66229314", "0.65130246", "0.6456053", "0.62131137", "0.6201214", "0.6139392", "0.61100906", "0.6029288", "0.5966744", "0.59360605", "0.59072584", "0.59072584", "0.59072584", "0.59040016", "0.5900616", "0.5900616", "0.5900616", "0.58648694", "0.58648694", "0.5...
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash(), 'map': new (Map || ListCache)(), 'string': new Hash() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemo...
[ "0.75903755", "0.70695037", "0.6735827", "0.6653031", "0.653072", "0.62686956", "0.62589216", "0.62589216", "0.62589216", "0.6171725", "0.6171725", "0.6171725", "0.61668706", "0.61542076", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0.61483264", "0....
0.0
-1
:: _current: HTMLElement; _container: HTMLElement; _promoted: boolean; _currentData: ?Object;
constructor() { this._promoteTarget = canvas => ({ target } /*: {target: Element}*/) => { if (target !== canvas || this._promoted) return; this._container.style.willChange = 'transform'; }; this._demoteTarget = canvas => ({ target, relatedTarget } /*: {target: Element, relatedTarget: Element}*/ ) => { if (target !== canvas || !this._promoted) return; if (relatedTarget && relatedTarget === this._container) return; this._container.style.willChange = ''; }; this._replaceTooltipContent = data => { this._current = buildTooltipContent(dataToMarkup(data)); this._container.replaceChild(this._current, this._container.firstElementChild); }; this._hide = () => { this._container.classList.add('hidden'); this._visible = false; }; this._display = ({ x, y }) => { this._container.style.transform = `translate(${x}px, ${y + acceptedMargin}px)`; this._container.classList.remove('hidden'); }; this._handleMouseOver = (e /*: MouseEvent */) => { const data = e.target[ns]; if (this._currentData === data || !(this._currentData || data)) return; this._currentData = data; this._replaceTooltipContent(data); this._display(findBestTooltipPosition(getEntityBBox(e.target), this._container.getBoundingClientRect())); }; this._handleMouseOut = (e /*: MouseEvent */) => { const data = e.target[ns]; if (!data) return; if (e.relatedTarget === this._container) return; const relatedData = e.relatedTarget[ns]; if (relatedData === this._currentData) return; // enter part of same entity this._currentData = relatedData || null; if (relatedData) { // switch tooltip content this._replaceTooltipContent(relatedData); this._display(findBestTooltipPosition(getEntityBBox(e.relatedTarget), this._container.getBoundingClientRect())); } else { // hide tooltip this._hide(); } }; // If no DOM, no need to do anything if (!window) return; // container const cont = document.createElement('div'); cont.classList.add(className); cont.classList.add('hidden'); cont.style.position = 'fixed'; cont.style.left = '0'; cont.style.top = '0'; // cont.style.border = '1px solid rgba(0, 0, 255, 0.2)'; // current node in container const curr = buildTooltipContent('<p>placeholder</p>'); cont.appendChild(curr); // attach to instance this._current = curr; this._container = cont; // append to DOM if (!document.body) throw new Error('No body in document'); document.body.appendChild(cont); this._promoted = false; // CSS if (!document.head) throw new Error('No head in document'); document.head.appendChild(getStyleSheet({ className, acceptedMargin })); // add event listener to the tooltip itself cont.addEventListener('mouseleave', e => { const relatedData = e.relatedTarget[ns]; if (relatedData === this._currentData) return; // enter part of same entity this._currentData = relatedData || null; if (relatedData) { // switch tooltip content this._replaceTooltipContent(relatedData); this._display(findBestTooltipPosition(getEntityBBox(e.relatedTarget), this._container.getBoundingClientRect())); } else { // hide tooltip this._hide(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getCurrent(){\n return current || null;\n }", "function getData(internalInstance) {\n var children = null;\n var props = null;\n var state = null;\n var context = null;\n var updater = null;\n var name = null;\n var type = null;\n var key = null;\n var ref =...
[ "0.57094836", "0.5676966", "0.5638974", "0.5630201", "0.5630201", "0.56054413", "0.5539855", "0.5539855", "0.5539855", "0.5539855", "0.55056894", "0.5502903", "0.5502903", "0.54681593", "0.5410389", "0.54063934", "0.54063934", "0.54063934", "0.5399292", "0.5391289", "0.538535...
0.0
-1
promote to own graphic accelerated layer demote from own graphic accelerated layer
attachToCanvas(canvas /*: Element */) { const promote = this._promoteTarget(canvas); const demote = this._demoteTarget(canvas); canvas.addEventListener('mouseenter', promote); canvas.addEventListener('mouseleave', demote); canvas.addEventListener('mouseover', this._handleMouseOver); canvas.addEventListener('mousemove', this._handleMouseOver); // not a typo canvas.addEventListener('mouseout', this._handleMouseOut); return () => { canvas.removeEventListener('mouseenter', promote); canvas.removeEventListener('mouseleave', demote); canvas.removeEventListener('mouseover', this._handleMouseOver); canvas.removeEventListener('mousemove', this._handleMouseOver); canvas.removeEventListener('mouseout', this._handleMouseOut); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawGlass(gl){\n gl.uniform1f(program.u_Alpha,0.5);\n pushMatrix(g_modelMatrix);\n if(self.position[2]>0){\n g_modelMatrix.translate(0,10,-50.5);\n g_modelMatrix.scale(79.5,10,0.5);\n drawObject(gl,wind);\n g_modelMatrix.setTranslate(0,10,50.5);\n ...
[ "0.56915873", "0.5631035", "0.5538832", "0.55328166", "0.5480913", "0.54391956", "0.5438617", "0.54379714", "0.54356533", "0.5406228", "0.53963655", "0.5378993", "0.53664494", "0.53474635", "0.53381556", "0.5335646", "0.53295964", "0.53056073", "0.52950424", "0.52863014", "0....
0.0
-1
Difference of Volumes of Cuboids
function findDifference(a, b) { let summA = 1; let summB = 1; for(let i = 0; i<a.length; i++){ summA *= a[i]; } for(let x = 0; x<b.length; x++){ summB *= b[x]; } let result; if(summA>summB){ result=summA-summB } else {result = summB - summA} return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getVolumeUtilisation() {\n let $itemVolume = 0;\n\n /** @var Item $item */\n this.items.forEach(item => $itemVolume += item.getVolume());\n\n // return round($itemVolume / this.box.getInnerVolume() * 100, 1);\n // FIXME: this doesn't maintain the same percision\n return Math.round($itemVolume / t...
[ "0.65762186", "0.6564014", "0.6545999", "0.6545999", "0.64842874", "0.6464477", "0.6416172", "0.632722", "0.6241198", "0.6231947", "0.6228934", "0.60903275", "0.6075686", "0.60682225", "0.60641515", "0.60449046", "0.60318965", "0.6008852", "0.60088485", "0.5995542", "0.595037...
0.0
-1
address of local host server
function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "address() {\n const address = this.server.address();\n const endpoint = typeof address !== \"string\"\n ? (address.address === \"::\" ? \"localhost\" : address.address) + \":\" + address.port\n : address;\n return `${this.protocol}://${endpoint}`;\n ...
[ "0.72635865", "0.67688453", "0.6763419", "0.6653417", "0.6649971", "0.65997267", "0.65518427", "0.65138215", "0.63851935", "0.6383864", "0.6326003", "0.62896174", "0.6258737", "0.6248042", "0.6225239", "0.62222266", "0.6202849", "0.6200772", "0.6199253", "0.61453617", "0.6143...
0.0
-1
Ok, here's the funny business: function calls to mongoDB return a promise that it will eventually execute to use threading commands like await, we can only call it in async functions, which chai appears not to be to overcome this, create a nested asynchronous function that contains what you want to do make sure to name it, and cal it in the test field. this will allow Node.js to wait for mongodb to complete the operation and not return IOUs
async function test2 () { await Book.insertMany(testBookArray); chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getAll') .end((err, res) => { res.should.have.status(200) //console.log(res.body) res.body.should.be.a('array') res.body.length.should.be.eql(testBookArray.length) done() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sampleInteraction() {\n MongoClient.connect('mongodb://localhost:27017/duelgame', function(err, db) { // connects to our mongodb server in the test database\n // returns either an error, or our database\n \n ...
[ "0.64125216", "0.64030236", "0.6220759", "0.62156266", "0.60768574", "0.60655147", "0.60027266", "0.5981089", "0.59789884", "0.5934274", "0.5925914", "0.5883216", "0.5845942", "0.5831169", "0.5809738", "0.58071107", "0.57740146", "0.57627285", "0.57486624", "0.5742658", "0.57...
0.6249753
2
We'll need to be a known id here
async function test2 () { const book = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:[], genre: "test" }) await Book.create(book); let query = Book.findOne({}); query.exec((err, bookT) => { var targetId = typeof String; targetId = bookT._id; //console.log(targetId) chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getById?books=' + targetId) .end((err, res) => { //console.log(res.body) //console.log(res.status) res.should.have.status(200) res.body.should.be.a('array') res.body.length.should.be.eql(1); done() }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getID() {}", "get id() { return this._id; }", "get id() { return this._id; }", "get id() { return this._id; }", "function grabEBI(id){ return tf_Id(id); }", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "get id() {\n console.log('in id getter');\n return t...
[ "0.7228203", "0.7055045", "0.7055045", "0.7055045", "0.70158476", "0.67402774", "0.6674787", "0.66491497", "0.6603128", "0.6584849", "0.6584318", "0.6568885", "0.6567123", "0.6551128", "0.65040606", "0.65040606", "0.65040606", "0.649149", "0.649149", "0.6491461", "0.6484845",...
0.0
-1
We'll need to be a known id here
async function test2 () { const book = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:["author1"], genre: "test" }) const book2 = new Book({ title:"test", writingPrompt:"test", image:"test", numberOfChapters:"1", duration:"1", authorArray:["author2"], genre: "test" }) await Book.create(book); chai.request(server) // May have to change name because we haven't named it yet .get('/api/book/getByAuthor?authors=' + "author1") .end((err, res) => { //console.log(res.body) //console.log(res.status) res.should.have.status(200) res.body.should.be.a('array') res.body.length.should.be.eql(1); done() }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getID() {}", "get id() { return this._id; }", "get id() { return this._id; }", "get id() { return this._id; }", "function grabEBI(id){ return tf_Id(id); }", "function getId(ele){\t// store the id value\r\n id_value = ele.id; \r\n}", "get id() {\n console.log('in id getter');\n return t...
[ "0.7226296", "0.7053432", "0.7053432", "0.7053432", "0.7014188", "0.6738433", "0.6673014", "0.6647683", "0.66009533", "0.6583849", "0.658233", "0.6567", "0.6566779", "0.654894", "0.65020514", "0.65020514", "0.65020514", "0.6489577", "0.6489577", "0.64891887", "0.6483609", "...
0.0
-1
This section is for retweet function for the bot. This bot will aggregate tweet related to the topic for you.
function retweet() { var params = { q: 'christmas', count: 2, result_type: 'recent', lang: 'en' } var tweet = { status: 'Retweeting most recent tweets about ' + params.q } print('retweet', 'params and tweet instantiated'); function gotData(err, data, response) { if (err) { print('retweet', 'retweet ERROR!'); } else { print('retweet', 'retweet SUCCESS!'); } var tweets = data.statuses; for (var i = 0; i < tweets.length; i++) { console.log('NEWS '+ i + ' || ' + tweets[i].text); var result = { status: tweets[i].text } print('retweet', 'retweeting the searched tweet'); print('retweet', tweets[i].text); T.post('statuses/update', result, isTweetSuccess); } } print('retweet', 'posting tweet...'); T.post('statuses/update', tweet, isTweetSuccess); print('retweet', 'searching tweet...'); T.get('search/tweets', params, gotData); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTweet(topic) {\n var params = {\n q: topic, //'banana since:2011-11-11',\n count: numberOfResults,\n }\n T.get('search/tweets', params, gotData);\n function gotData(err, data, response) {\n var tweets = data.statuses // list of statuses\n all_tweets = ''\n ...
[ "0.69330895", "0.67947906", "0.67850083", "0.6692424", "0.6620952", "0.6603982", "0.65578175", "0.6497246", "0.6495469", "0.6428629", "0.6380684", "0.6373265", "0.63523585", "0.6338389", "0.6334066", "0.62974054", "0.621312", "0.6198642", "0.61970824", "0.61902773", "0.617206...
0.69899786
0
This section is for creating followtriggered event for the bot
function followed(eventMsg) { var name = eventMsg.source.name; var screenName = eventMsg.source.screen_Name; tweetIt('.@' + screenName + 'Thanks for follow!'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function followed(eventMsg){ //thank follower via reply tweet\r\n\tconsole.log(\"New Follower! \\n replying...\");\r\n\t// var name= eventMsg.source.name;\r\n\tvar screenName= eventMsg.source.screen_name;\r\n\ttweetIt('@' + screenName + ' thanks for the follow!');\r\n}", "function followed(event) {\n let name...
[ "0.7149049", "0.6820767", "0.66962147", "0.6689238", "0.65391695", "0.63978416", "0.60622746", "0.59170413", "0.5913688", "0.589153", "0.5736847", "0.57039803", "0.57011735", "0.5643553", "0.5622015", "0.5607041", "0.5603649", "0.5550212", "0.5530502", "0.5510366", "0.5473056...
0.6693411
3