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
============================================= CREAR DATOS JSON PARA ALMACENAR EN BD =============================================
function crearDatosJsonRedes() { var redesSociales = []; for (var i = 0; i < checkBox.length; i++) { if ($(checkBox[i]).attr("validarRed") != "") { redesSociales.push({ "red": $(checkBox[i]).attr("red"), "estilo": $(checkBox[i]).attr("estilo"), "url": $(checkBox[i]).attr("ruta"), "activo": 1 }) } else { redesSociales.push({ "red": $(checkBox[i]).attr("red"), "estilo": $(checkBox[i]).attr("estilo"), "url": $(checkBox[i]).attr("ruta"), "activo": 0 }) } $("#valorRedesSociales").val(JSON.stringify(redesSociales)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async guardaDatos (parametros, tabla) {\n try {\n tabla = tabla + '.json'\n const res = await fetch((API_URL + tabla), {\n method: 'POST',\n headers: {\n 'content-Type': 'application/json'\n },\n body: JSON.stringify(parametros)\n })\n const datoDb = awai...
[ "0.6219279", "0.5947846", "0.5935533", "0.5926206", "0.5916079", "0.58547413", "0.58482444", "0.57651126", "0.57195425", "0.56967086", "0.5686683", "0.56655306", "0.5665188", "0.5653528", "0.56208277", "0.55999523", "0.55831707", "0.55817205", "0.5566008", "0.55625117", "0.55...
0.5452992
38
TODOL A los servicios le entra una basket o un basketId?
static async retrieve(basketId) { const basket = await Collection.retrieveOne(basketId); if(!basket) throw new Error(`No basket with that id: ${basketId}`) // TODO: Correct error handling? const { id, products } = basket; return new Basket(id, products).serialize(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBasketItem(id) {\n for(let i = 0; i < this.basket.length; ++i) {\n if(this.basket[i].id == id) {\n return JSON.parse(JSON.stringify(this.basket[i]));\n }\n }\n }", "async putBasket() {\n let el;\n // find all required options\n for(var i = 1; i < 10; i++) {\n ...
[ "0.6699259", "0.6561031", "0.631173", "0.6278321", "0.62455696", "0.62305", "0.62078565", "0.60392565", "0.6026651", "0.6020721", "0.60073346", "0.59223497", "0.59165186", "0.5868954", "0.58330876", "0.58249515", "0.58170754", "0.58034885", "0.57589746", "0.5738049", "0.57205...
0.6606335
1
Returns an object with all images which filename ends on _sm, _md or _lg. sm, md and lg are the properties of the object.
header_images(category) { if (category.images) { let images = {}; let re = /^.*_(sm|md|lg)$/; Object.keys(category.images).forEach((imageName) => { let matches = imageName.match(re); if (matches) { images[matches[1]] = category.images[imageName]; } }); return images; } return {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_images(imagesets) {\n var images = {};\n\n $.each(imagesets, function(){\n if (!is_mobile && this.large_image && this.medium_image){\n images.large = DDG.toHTTP(this.large_image.url);\n images.medium = DDG.toHTTP(this.medium_image.url);\n ...
[ "0.6174418", "0.60363287", "0.5914982", "0.5890643", "0.5808574", "0.58075094", "0.5787686", "0.57071865", "0.56340563", "0.5633603", "0.5609836", "0.5604371", "0.560147", "0.55933607", "0.5569278", "0.55657476", "0.55470496", "0.55434513", "0.55394495", "0.5534264", "0.55090...
0.68367857
0
Connects the MQTT socket and binds listeners for receiving messages.
connect(tokens, deviceId) { return tslib_1.__awaiter(this, void 0, void 0, function* () { this.tokens = tokens; this.deviceId = deviceId; yield this.connection.connect(); this.connection.on('packet', packet => this.parsePacket(packet)); yield this.sendConnectMessage(); this.connection.on('close', () => this.reconnect()); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupMQTT() {\n this.mqttClient = mqtt.connect({\n host: this.mqtt_broker_host,\n port: this.mqtt_broker_port,\n username: this.mqtt_broker_username,\n password: this.mqtt_broker_password,\n will: {\n topic: `${this.mqtt_broker_topic_prefix}/lwt`,\n payload: 'connected',\n...
[ "0.6831288", "0.6666019", "0.6605525", "0.65672743", "0.65423447", "0.64982104", "0.6440404", "0.64119107", "0.63775915", "0.63724524", "0.6368308", "0.63665664", "0.6354938", "0.63427943", "0.63145936", "0.6266478", "0.62650275", "0.62287104", "0.6226732", "0.61949897", "0.6...
0.0
-1
Sends a CONNECT mqtt message
sendConnectMessage() { return tslib_1.__awaiter(this, void 0, void 0, function* () { setInterval(this.sendPing, 60 * 1000); debugLog('sending connect message'); if (!this.connection._connected) throw new Error('MQTT could not connect'); const connectMessage = yield Connect_1.encodeConnectMessage(this.tokens, this.deviceId); yield this.connection.writeMessage(connectMessage); yield this.waitForAck('Connect'); yield this.sendPublish('/foreground_state', '{"foreground":true,"keepalive_timeout":60}'); yield this.sendSubscribe(Subscribe_1.encodeSubscribeMessage(this.lastMsgId)); yield this.waitForAck('Subscribe'); yield this.sendSubscribe(Unsubscribe_1.encodeUnsubscribe(this.lastMsgId)); yield this.waitForAck('Unsubscribe'); debugLog('Connected.'); this.emit('connected'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onConnect() {\n // Once a connection has been made, make a subscription and send a message.\n console.log(\"onConnect\");\n client.subscribe(\"/World\");\n client.subscribe(\"/refreshTable\");\n\n client.subscribe(\"/playerJoined\");\n client.subscribe(\"/startGame\");\n client.subscr...
[ "0.7779564", "0.7750173", "0.7713554", "0.7682378", "0.76550925", "0.7647075", "0.7611812", "0.76096016", "0.7578732", "0.7563428", "0.7558892", "0.7553344", "0.75384563", "0.7509813", "0.74886006", "0.74749947", "0.74679136", "0.7446639", "0.7430358", "0.739015", "0.7348758"...
0.7433811
18
Sends a facebook messenger message to someone.
sendMessage(threadId, message, options) { return new Promise((resolve, reject) => tslib_1.__awaiter(this, void 0, void 0, function* () { const milliseconds = Math.floor(new Date().getTime() / 1000); const rand = RandomIntGenerator_1.default.generate(); const msgid = Math.abs((rand & 0x3fffff) | (milliseconds << 22)); const msg = { body: message, msgid, sender_fbid: this.tokens.uid, to: (threadId.startsWith('100') || threadId.length < 16) ? threadId : `tfbid_${threadId}` }; if (options && options.mentions && options.mentions.length) { msg.generic_metadata = { prng: JSON.stringify(options.mentions.map(mention => ({ o: mention.offset, l: mention.length, i: mention.id, t: 'p' }))) }; } this.once('sentMessage:' + msgid.toString(), resolve); yield this.sendPublish('/send_message2', JSON.stringify(msg)); })); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sendtoUser(sender, text) {\n text = {text:text}\n //the message we want to send\n request({\n url: 'https://graph.facebook.com/v2.6/me/messages',\n qs: {access_token:token},\n method: 'POST',\n json: {\n recipient: {id:sender},\n message: text,\n ...
[ "0.77447695", "0.74884766", "0.74457335", "0.7242645", "0.72012424", "0.7172668", "0.7143836", "0.713395", "0.7130578", "0.71274", "0.7120066", "0.71166563", "0.7109526", "0.7108121", "0.7104774", "0.7104774", "0.70899236", "0.708301", "0.70621246", "0.70621246", "0.70621246"...
0.0
-1
when the viewmodel is constructed, attempt to load the todos.
constructor(){ this.service = new BookService(); this.load() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "initTodos() {\n console.log('init todos, key: ', this.storage.checkKey())\n if (this.storage.checkKey()) {\n this.loadTodos();\n } else {\n this.updateTodos(defaultTodos);\n }\n }", "function loadData(){\n dataFactory.getTodos()\n .then(\n ...
[ "0.6905856", "0.65263116", "0.65084654", "0.6484587", "0.64544785", "0.6341188", "0.63264745", "0.62328506", "0.6223558", "0.6175994", "0.61742777", "0.6164466", "0.61634666", "0.6144248", "0.6132777", "0.608808", "0.6079997", "0.6063836", "0.6051969", "0.60356116", "0.603146...
0.0
-1
load saved todos, if possible.
@action load(){ this.book = this.service.getBook(this.id); this.totalPages = this.book.getTotalPages(); this.pageNumber = 1; this.chapters = this.book.chapters; this.currentChapter = this.chapters[0]; this.currentPage = this.currentChapter.getPageByNumber(1); this.isHardWordFocused = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadToDos() {\n const loadedToDos = localStorage.getItem(TODO_LS);\n if (loadedToDos !== null) {\n const parsedToDos = JSON.parse(loadedToDos);\n parsedToDos.forEach(function (toDo) {\n paintToDo(toDo.text);\n });\n }\n }", "function loadTodos() {\n const content = fs....
[ "0.7760943", "0.75090104", "0.7503948", "0.74711263", "0.7407154", "0.729464", "0.71902454", "0.7000663", "0.696545", "0.68425643", "0.6749178", "0.67470896", "0.6735118", "0.67012817", "0.6628452", "0.6627915", "0.6609672", "0.6609672", "0.6539851", "0.65309197", "0.6530281"...
0.0
-1
This function and the next function are 'magic' you're not expected to understand all the details of how they work. What you ARE expected to understand is that createEventHandlersForBlocks wil set up event handlers for all the blocks. Specifically, it will set things up so that if you click on the block with id="1_0", the function clickOnBlock will be called with the paramters 1, 0 (i.e., clicking on that block will call clickOnBlock(1,0)
function makeClickHandler( row, col ) { return function() { clickOnBlock( row, col ); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupEvents() {\n let $blocks = document.querySelectorAll(`.block`);\n //Yuk....Apolgies, I neevr usually do the whole var that = this thing, I dont like it, but for this purpose it works. \n let that = this;\n let listener = function (ev) {\n var blockObj = {\n ...
[ "0.7269135", "0.6617359", "0.6447009", "0.6152069", "0.61254907", "0.6099798", "0.6034575", "0.60324776", "0.5949076", "0.591487", "0.587403", "0.58621025", "0.58604443", "0.578575", "0.57769233", "0.57769233", "0.57537895", "0.5737441", "0.5719855", "0.5678496", "0.56374276"...
0.5815531
13
removing a node from the end of the list
pop() { if (!this.head) { return undefined; }; let current = this.head; let newTail = current; while(current.next) { newTail = current; current = current.next; } this.tail = newTail; this.tail.next = null; this.length--; if (this.length === 0) { this.head === null; this.tail === null; } return current; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove(index){\n// check the param\n\nconst leader = this.traverseToIndex(index-1);\nconst unwamtedNode = leader.next;\nleader.next = unwamtedNode.next;\nthis.length--;\n\n\n}", "remove(index){\n const leader = this.traverseToIndex(index-1)\n const unwantedNode = leader.next;\n leader.next =...
[ "0.7365624", "0.72508204", "0.72147155", "0.7167771", "0.7165654", "0.71166235", "0.7109976", "0.7095753", "0.7093334", "0.7075608", "0.707129", "0.7059683", "0.7054433", "0.7053088", "0.7022647", "0.7019279", "0.7010919", "0.7004406", "0.700277", "0.6967499", "0.69513863", ...
0.0
-1
remove a node from the beginning
shift() { if (!this.head) { return undefined; } let result = this.head; this.head = this.head.next; this.length--; if (this.length === 0) { this.head === null; this.tail === null; } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteAtBeginning() {\n if (this.head === null) {\n return;\n }\n if (this.head.next === null) {\n this.head === null;\n return;\n }\n this.head = this.head.next;\n this.head.prev = null;\n }", "remove() {\n const fragment = this.fragment;\n const end = this.lastChild;\n ...
[ "0.74624974", "0.718784", "0.71734875", "0.70879847", "0.7081936", "0.7047564", "0.7038068", "0.7011313", "0.7007403", "0.7001595", "0.69275784", "0.6911983", "0.6841659", "0.67710036", "0.6770509", "0.6770509", "0.6758537", "0.67549884", "0.67481226", "0.6735971", "0.6734418...
0.0
-1
adding a new node to the beginning of the linked list
unshift(val) { let newNode = new Node(val); if (!this.head) { this.head = newNode; this.tail = newNode; } else { newNode.next = this.head; this.head = newNode; } this.length++; //return the whole linked list return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "prepend(value) {\n // if list is empty\n if (!this.head) {\n this.head = new Node(value);\n }\n let oldHead = this.head;\n this.head = new Node(value);\n this.head.next = oldHead;\n }", "addNodeAtStart(data) {\n let node = new Node(data);\n node.next = this.head;\n this.head = no...
[ "0.8077401", "0.8000737", "0.7908137", "0.78981364", "0.7885283", "0.7819372", "0.7818221", "0.78047484", "0.77720267", "0.77212554", "0.7717005", "0.7713115", "0.7697841", "0.76837367", "0.76283956", "0.7592856", "0.75857466", "0.7578689", "0.75690323", "0.75286883", "0.7528...
0.7449478
25
changing the value of a node based on it's position in the linked list
set(index, val) { let foundNode = this.get(index); if (foundNode) { foundNode.val = val; return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setNode(pos, val){\r\n let curr = this.head;\r\n\r\n for(let i = 0; i < this.length; i++){\r\n if(i === pos){\r\n curr.val = val;\r\n }else{\r\n curr = curr.next;\r\n }\r\n }\r\n return undefined;\r\n }", "setAt(idx, va...
[ "0.7818408", "0.7045179", "0.69814533", "0.68728477", "0.6847868", "0.68055713", "0.66951907", "0.66735446", "0.6673045", "0.6653687", "0.6630273", "0.6572224", "0.6565421", "0.65534574", "0.65202487", "0.6506045", "0.647038", "0.6469807", "0.6465941", "0.64605665", "0.641189...
0.62793994
28
Component to render a single contact
function ViewContact({contactId, contacts, deleteContact, history}) { const contact = _.find(contacts, {id: contactId}); if (!contact) return <h1>Contact not found</h1> const handleDeleteClick = () => { if (window.confirm('Are you sure you want to delete this contact?')) { deleteContact(contactId); history.push('/contacts') } } return ( <div className="row center"> <div className="col-md-6 offset-md-3 contact"> <h2>{contact.name}</h2> <ProfilePic imgUrl={contact.imgUrl} imgType="contact-view-img"></ProfilePic> <p>{contact.email}</p> <p>{contact.number}</p> <Link to={'/contacts'} className="button btn btn-primary">Back</Link> <Link to={`/contacts/${contactId}/edit`} className="button btn btn-primary">Edit</Link> <button type="button" className="btn btn-primary delete-contact-btn" onClick={handleDeleteClick}>Delete</button> </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toRenderContactView() {\n ContactView.render({\n model: contact,\n bindings: bindings\n });\n }", "function renderContact(id) {\n const contactId = id || getSelectedContactId()\n\n if (contactId) {\n const contact = client.contacts.get(contactId)\n updateCo...
[ "0.7466769", "0.7000598", "0.6903568", "0.67031896", "0.6660944", "0.6660203", "0.6467818", "0.6467818", "0.6467818", "0.6467818", "0.6410104", "0.6400469", "0.6400469", "0.6361328", "0.6291562", "0.6283855", "0.6243555", "0.6153653", "0.614725", "0.6140177", "0.61315775", ...
0.6600555
6
css depended what is timer now
function cssSessOrBreak() { $("#minS, #plusS, #defS").prop("disabled", false); $("#minBr, #plusBr, #defBr").prop("disabled", false); if(isNowSession) { if ($(".pause").is(":visible")) { $("#minS, #plusS, #defS").prop("disabled", true); } else { $("#minS, #plusS, #defS").prop("disabled", false); } $("#lbS").css("background-color", "#f77"); $("#lbS").css("color", "black"); $("#lbBr").css("background-color", "#822"); $("#lbBr").css("color", "#ffe6e6"); } else { if ($(".pause").is(":visible")) { $("#minBr, #plusBr, #defBr").prop("disabled", true); } else { $("#minBr, #plusBr, #defBr").prop("disabled", false); } $("#lbBr").css("background-color", "#f77"); $("#lbBr").css("color", "black"); $("#lbS").css("background-color", "#822"); $("#lbS").css("color", "#ffe6e6"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timerWrapper () {}", "function domTimer() {\n $(`.timer`).text(`Timer: ${totalMinutes}:${totalSeconds}`);\n }", "function changeColor(){\n timerEl.style.color = \"white\";\n \n}", "addTransitionTimeToCSS(){\n\t\tdocument.getElementById(this._elementID).style.transition = 'filter '+this._...
[ "0.6714957", "0.64865726", "0.64088404", "0.63386256", "0.6309609", "0.62808365", "0.62808293", "0.62574595", "0.6240548", "0.6209881", "0.6156688", "0.61429214", "0.6135163", "0.6096363", "0.60833806", "0.6056601", "0.6055444", "0.6051955", "0.6048573", "0.6038995", "0.60311...
0.0
-1
add '0' before digit < 10
function addZero(x) { if(x < 10 && x[0] !== '0') return '0' + x; else return x }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepend0 (i) {\n\t\treturn i < 10 ? \"0\" + i : i;\n\t}", "function zeroIt(a) { return( a < 10 ? \"0\"+a : a ); }", "function appendLeadingZeroes(n){\n if(n <= 9){\n return \"0\" + n;\n }\n return n\n}", "function appendZeroes(number) {\n if (number <= 9) {\n return \"0\" + n...
[ "0.7983764", "0.7916165", "0.7900795", "0.7894693", "0.78930867", "0.7860802", "0.783224", "0.7827983", "0.77996707", "0.77977747", "0.7782923", "0.7765246", "0.77610916", "0.77568185", "0.77568185", "0.7752157", "0.77514136", "0.77500457", "0.77439314", "0.77439314", "0.7743...
0.76022434
43
change time on screen by press buttons
function setScreenTime(minut) { $('#lcd').val(addZero(minut) + ':00') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timesPress() {\n\ttimesModel = true;\n\tisHumanTimes = true;\n\tstart.style.display =\"none\";\n\tbutton3.style.display = 'block';\n\tif (!humanModel){\n\t\ttimesModel = false;\n\t\taimove();\t\n\t}\n\t\n}", "function updateTime() {\n\t\tvar dateTime = tizen.time.getCurrentDateTime(), secondToday = date...
[ "0.7465292", "0.71643054", "0.711966", "0.6982717", "0.6920965", "0.68952084", "0.68854994", "0.68588346", "0.6815995", "0.6806981", "0.6800711", "0.67566466", "0.67536485", "0.67333126", "0.6710169", "0.67086565", "0.66664994", "0.6662761", "0.66592246", "0.66224104", "0.660...
0.66384685
19
decrement time in screen
function ticTime() { var minutes = $('#lcd').val().split(':')[0]; var secundes = $('#lcd').val().split(':')[1]; if(secundes == '00') { minutes -= 1; secundes = 60; } secundes -= 1; $('#lcd').val(addZero(minutes) + ':' + addZero(secundes)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decrement() {\n\n let minutes = Math.trunc(time / 60);\n let seconds = time - minutes * 60;\n\n let seconds_display = seconds\n\n if (seconds === 0 && minutes === 0) {\n clearInterval(interval);\n }\n\n if (seconds < 10) {\n ...
[ "0.7990547", "0.7698502", "0.7612631", "0.76045614", "0.7574308", "0.7562547", "0.7522983", "0.74774754", "0.745171", "0.7380399", "0.7339272", "0.73304564", "0.73130876", "0.7247561", "0.7246728", "0.7237888", "0.72222817", "0.7191562", "0.71681154", "0.7152085", "0.7150182"...
0.0
-1
OBJECTS ======================================================================================= FUNCTIONS (Definition) =======================================================================================
function processFooter ( item ) { var divFooter = $( "<div>" ); var sp1 = $( "<span>" ); var sp2 = $( "<span>" ); divFooter.addClass ( "card-footer bg-transparent border-success" ); sp1.addClass ( "card-text text-success" ); sp1.text ( "Rating: " ); divFooter.append ( sp1 ); sp2.text ( item.rating ); divFooter.append ( sp2 ); return divFooter; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Objects() {\n this.id = 0\n this.list = []\n this.objectTypes = {\n ship: ObjectShip,\n point: ObjectPoint,\n meteor: ObjectMeteor\n }\n\n this.create = (options) => {\n var objectType = this.objectTypes[options.type]\n var object = new objectType(options)\n\n this....
[ "0.6903456", "0.60550416", "0.59622824", "0.59579", "0.58983564", "0.584079", "0.5797238", "0.5797238", "0.5795709", "0.5792659", "0.57876974", "0.5777929", "0.57766587", "0.5765129", "0.5765129", "0.5752565", "0.5745876", "0.5719953", "0.5716444", "0.5705653", "0.56953704", ...
0.0
-1
GET THE INITIAL STATE
getInitialState() { return({lat: '', long: '', astOne: '', astTwo: '', astThree: '', astFour: '', astFive: '', astSix: ''}) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getInitialState() {\n\t\treturn this.stage.getInitialStageState();\n\t}", "function GetInitialValue()\n{\n\treturn m_initialValue;\n}", "function getCurrentState() {\n\t\treturn {};\n\t}", "function initState() {\n var state = {\n bufferClearTimeout: 0,\n currentFirstChar: '',\n sorte...
[ "0.6989927", "0.69047886", "0.68982387", "0.68213576", "0.6751486", "0.6743987", "0.67284465", "0.6714189", "0.6705586", "0.6695994", "0.6614942", "0.6563019", "0.6511027", "0.64482874", "0.63849384", "0.63838035", "0.63751376", "0.63582855", "0.63284147", "0.63284147", "0.63...
0.0
-1
WHERE IS THE SPACE STATION RIGHT NOW?
componentDidMount() { // WHO ARE THE CURRENT ASTRONAUTS IN SPACE? var whothat = this; $.ajax({ url: 'http://api.open-notify.org/astros.json', success: function(whodata) { // console.log(whodata) var sergey = whodata.people[0].name; var andrey = whodata.people[1].name; var shane = whodata.people[2].name; var oleg = whodata.people[3].name; var thomas = whodata.people[4].name; var peggy = whodata.people[5].name; whothat.setState({astOne: sergey, astTwo: andrey, astThree: shane, astFour: oleg, astFive: thomas, astSix: peggy}) } }) var that = this; $.ajax({ url: 'http://api.open-notify.org/iss-now.json', success: function(stationdata) { // SET THE LATITUDE AND LONGITUDE OF THE SPACE STATION INTO VARIABLES var latitude = stationdata.iss_position.latitude; var longitude = stationdata.iss_position.longitude; // LOG IT JUST TO DOUBLE CHECK console.log(latitude, longitude) // SET THE STATE APPROPRIATELY that.setState({lat: latitude, long: longitude}) } }) var mymap = L.map('mapid').setView([this.state.lat, this.state.long], 13); // new Map(options: Object) L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/dark-v9/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoicGFydGhqaGF2ZXJpIiwiYSI6ImNpeGNxNWN6azAwYXMyeWxmb2kzZHFuaHUifQ.IEhU6FLL_DdjRAQ1VD_PSA', { attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>', maxZoom: 30, accessToken: 'pk.eyJ1IjoicGFydGhqaGF2ZXJpIiwiYSI6ImNpeGNxNWN6azAwYXMyeWxmb2kzZHFuaHUifQ.IEhU6FLL_DdjRAQ1VD_PSA' }).addTo(mymap); // map.addControl(new mapboxgl.GeolocateControl({ // positionOptions: { // enableHighAccuracy: true // } // })); // var nav = new mapboxgl.NavigationControl(); // map.addControl(nav, 'top-left'); // var map = new mapboxgl.Map({ // container: 'map', // container id // style: 'mapbox://styles/mapbox/dark-v9', //hosted style id // center: [this.state.lat, this.state.long], // starting position // zoom: 3 // starting zoom // }); var track = (function moveISS () { $.getJSON('http://api.open-notify.org/iss-now.json?', function(data) { var lat = data['iss_position']['latitude']; var lon = data['iss_position']['longitude']; // See leaflet docs for setting up icons and map layers // The update to the map is done here: iss.setLatLng([lat, lon]); isscirc.setLatLng([lat, lon]); map.panTo([lat, lon], animate=true); }); setTimeout(moveISS, 5000); }) console.log(track) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasSpaces(cadena) {\n\n return ((-1)!= cadena.indexOf(\" \"));\n\n }", "function h$isSpace(a) {\n if(a<5760) return a===32||(a>=9&&a<=13)||a===160;\n return (a>=8192&&a<=8202)||a===5760||a===8239||a===8287||a===12288;\n}", "function h$isSpace(a) {\n if(a<5760) return a===32||(a>=9&...
[ "0.6118225", "0.6112417", "0.6112417", "0.6112417", "0.5850372", "0.56418675", "0.563154", "0.5558937", "0.5525147", "0.5486709", "0.54745626", "0.54719496", "0.5412379", "0.5376895", "0.5355745", "0.5352674", "0.5352674", "0.5342971", "0.5339888", "0.533314", "0.5304109", ...
0.0
-1
create column jsx for given number of columns
createColumns(num, titles) { let jsx = []; for(var i = 0; i < num; i++) { jsx.push(<CustomTableCell>{titles[i]}</CustomTableCell>); } return jsx; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getColumns() {\n const {props} = this;\n let children = [];\n for (let i = 0; i < (props.numberOfColumns || props.children.length); i++) {\n children.push(<GridCell key={this.uniqueId + i} columnSize={100 / (props.numberOfColumns || props.children.length)} style={props.gridCellStyle...
[ "0.69872123", "0.694469", "0.6934084", "0.6820354", "0.68010795", "0.67140657", "0.6689559", "0.6561034", "0.64826614", "0.6471943", "0.64442134", "0.6400762", "0.6400762", "0.6370676", "0.6334845", "0.63194174", "0.62838113", "0.62827706", "0.6266618", "0.62422913", "0.62380...
0.7792293
0
create the content of cells in a single row
createRowContent(rowData) { let jsx = []; for(var i = 0; i < rowData.length; i++) { jsx.push( <CustomTableCell {...((i == 0) ? {component: "th"} : {})} {...((i == 0) ? {scope:"row"} : {})}> {rowData[i]} </CustomTableCell> ); } return jsx; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createRow(cellCount) {\n let row = '<div class=\"row\">';\n let str = '<div class=\"cell\">&nbsp;</div>';\n for (let i = 0; i < cellCount; i++) {\n row += str;\n }\n row += '</div>';\n return row;\n}", "rowsHtml() {\n const cells = [];\n\n for (let column of this.items) {\n ...
[ "0.69202495", "0.67032623", "0.6636378", "0.6609079", "0.66039306", "0.65946215", "0.6560129", "0.6488384", "0.64502233", "0.64242846", "0.6380704", "0.6353659", "0.6294588", "0.6292114", "0.6279173", "0.6275804", "0.62749267", "0.62729037", "0.6266505", "0.6259708", "0.62334...
0.6699697
2
middleware for block developer
function developerCheck(req, res, next) { if (req.session.user.role === "developer") { return res.sendStatus(403); } else { next(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function middleware(request, response, next) {}", "function blanket_middleware(request, response, next){\n\n var blanket_promises = [];\n if(!request.locals){ request.locals = {}; }\n\n blanket_promises.push(\n new Promise(function(resolve, reject){\n detect_browser(request, function(b...
[ "0.6580477", "0.6112599", "0.6104049", "0.6069019", "0.60660183", "0.6036479", "0.5954052", "0.59343165", "0.5931393", "0.59199274", "0.5892266", "0.58824885", "0.5879888", "0.5851211", "0.5806556", "0.5794649", "0.5787089", "0.5783505", "0.5745811", "0.5737629", "0.5722711",...
0.6584285
0
Get all foods from LS to using them at all parts of project
static getFoods() { let items; // Check if storage has foods if (localStorage.getItem('foods') === null) { items = []; } else { items = JSON.parse(localStorage.getItem('foods')); } return items; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetchRecipes() {\n tool.forEach(data.menu.sections, function(section) {\n section.recipes = tool.map(section.recipes, function(id) {\n return fetchRecipe(id);\n });\n });\n }", "function findServicedAll() {\n findServiced(spe...
[ "0.62219715", "0.60823834", "0.60823834", "0.60187423", "0.5984212", "0.5925264", "0.59209716", "0.58166164", "0.58113337", "0.5806295", "0.5772182", "0.5761735", "0.57561105", "0.57508165", "0.57445663", "0.5739945", "0.573974", "0.57113093", "0.57025266", "0.5693987", "0.56...
0.6135616
1
Store Foods in LS
static storeFood(item) { const items = Storage.getFoods(); items.push(item); localStorage.setItem('foods', JSON.stringify(items)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveFoods() {\n localStorage.setItem(\"breakfast\", JSON.stringify(breakfast));\n localStorage.setItem(\"lunch\", JSON.stringify(lunch));\n localStorage.setItem(\"dinner\", JSON.stringify(dinner));\n}", "function addFoods() {\n foodS++;\n database.ref('/').update({\n Food:foodS\n ...
[ "0.70592725", "0.67359877", "0.6708371", "0.6686895", "0.6641716", "0.65618926", "0.6515676", "0.64884514", "0.6466194", "0.6416223", "0.63540906", "0.6302079", "0.62967134", "0.62846756", "0.6283796", "0.6278754", "0.6276447", "0.6276447", "0.62636787", "0.6259708", "0.62560...
0.77988666
0
Update food in LS
static updateFood(updatedFood) { const items = Storage.getFoods(); items.forEach((item, index) => { if (updatedFood.id === item.id) { items.splice(index, 1, updatedFood); } }); localStorage.setItem('foods', JSON.stringify(items)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateFood(){\r\n foodS++\r\n database.ref('/').update({\r\n food: foodS\r\n})\r\n }", "function addFoods() {\n foodS++;\n database.ref('/').update({\n Food:foodS\n })\n }", "function addFood(){\r\n foodS++;\r\n foodObj.updateFoodStock(foodS);\r\n}", "function addFoods() {\r\...
[ "0.73940337", "0.68630606", "0.68550926", "0.6852727", "0.6838368", "0.68306047", "0.67498004", "0.67407596", "0.672", "0.67020476", "0.6677039", "0.6677039", "0.66471857", "0.6631724", "0.6624387", "0.6613764", "0.6609129", "0.6608072", "0.6608072", "0.6598593", "0.65959406"...
0.74373126
0
Delete food from LS by ID
static deleteFood(id) { const items = Storage.getFoods(); items.forEach((item, index) => { if (id === item.id) { items.splice(index, 1); } }); localStorage.setItem('foods', JSON.stringify(items)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove(id) {\n\t\t\tvar index = this.items.findIndex(item => item.food_id == id);\n\t\t\tthis.items.splice(index, 1);\n\t\t\tthis.saveToLocalStorage();\n\t\t}", "function deleteItem (id) {\n deleteFavourite(Utils.getUser().email, id)\n .then(() => {\n setMyFaves((myFaves) => {\n let tempF...
[ "0.7773645", "0.73536277", "0.7220634", "0.71993566", "0.711586", "0.7114208", "0.70913523", "0.7091243", "0.70899665", "0.70806843", "0.70605284", "0.6955841", "0.69299614", "0.6903212", "0.68865496", "0.6867404", "0.68588907", "0.6856991", "0.682139", "0.68127906", "0.67805...
0.8026217
0
CLear all food items in LS
static clearAll() { localStorage.removeItem('foods'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function allItems(req, res){ \n FoodItem.find({}, function (err, menu) { \n if (err) throw err;\n return res.send(menu);\n });\n}", "function pullLocalFoods() {\n var foodList = localStorage.getItem(\"foods\");\n if (localStorage.getItem(\"foods\") === null) {\n r...
[ "0.5998803", "0.59679013", "0.5831773", "0.5811499", "0.576977", "0.57244307", "0.56631887", "0.5628454", "0.5627587", "0.5562379", "0.55247563", "0.5521781", "0.5517604", "0.55131644", "0.5507799", "0.5506782", "0.54578835", "0.5431435", "0.54208344", "0.5420297", "0.5410788...
0.0
-1
PROP TYPES I assume we'll have a config object... eventually
static get propTypes() { return { config: React.PropTypes.object, test: React.PropTypes.string, }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get properties() {\n return {\n prop1: {type: String}\n };\n }", "get prop() {\n return this.config.prop;\n }", "get propertyType() {}", "set propertyType(value) {}", "function getProperties (type) {\n\n}", "static get properties() {\n name: {\n Type: String\n }\n ...
[ "0.6438275", "0.6366593", "0.6240932", "0.6136065", "0.61157185", "0.6043641", "0.6043641", "0.60136604", "0.59916735", "0.5967759", "0.59062576", "0.5884408", "0.5858924", "0.58535033", "0.58447", "0.58447", "0.57573247", "0.5706732", "0.5689609", "0.5669197", "0.5642034", ...
0.54156345
49
DEFAULT PROPS This component maintains class names for the elements that it appends
static get defaultProps() { return { }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showClasses(classElements) {\n const props = this.props\n classElements.forEach(item => {\n props.classListElement.appendChild(item)\n })\n }", "_setClassNames() {\n const classNames = ['osjs-window', ...this.attributes.classNames];\n if (this.id) {\n classNames.push(`Window_${this.id}`...
[ "0.6887121", "0.6694763", "0.65260273", "0.64785886", "0.6329554", "0.6318827", "0.6296263", "0.6281571", "0.6240165", "0.62257934", "0.6160974", "0.61084604", "0.6051173", "0.6050921", "0.6027582", "0.60152745", "0.6004284", "0.5933581", "0.59232754", "0.58931416", "0.588863...
0.0
-1
UPDATE LEGEND ends RENDER
render() { return ( <g className="chart-legend-group"/> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update() {\n if (!this.suspendUpdate) {\n this.draw();\n this.legend.setSeriesViewRect(this.viewRect);\n this.legend.update();\n }\n }", "function updateAttribute(ch) {\n map.infoWindow.hide();\n\n createRenderer(ch);\n ...
[ "0.6857685", "0.624876", "0.6110354", "0.6089171", "0.6088313", "0.6078008", "0.5998713", "0.59893477", "0.5882296", "0.5875879", "0.5864382", "0.5859268", "0.5833825", "0.5820886", "0.5796891", "0.5784348", "0.5768761", "0.57586193", "0.57486254", "0.5726654", "0.5704008", ...
0.0
-1
Converts a 68 digit hex string to rgbw colors
static hexToRgb(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16), w: (result[4] != null) ? parseInt(result[4], 16) : 0 } : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hexToRgb(e){var a=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;e=e.replace(a,function(e,a,t,i){return a+a+t+t+i+i});var t=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}", "function hexToRgb(e){var a=/^#?([a-f\\d])([a-f\\d])([a...
[ "0.7791742", "0.7791742", "0.7791742", "0.7791742", "0.7791742", "0.7791742", "0.7670489", "0.7516009", "0.75031763", "0.7491299", "0.7477105", "0.7449682", "0.74164784", "0.74012274", "0.73987126", "0.7393183", "0.73889494", "0.7383982", "0.7378328", "0.73760176", "0.7374233...
0.6904743
97
Gets a random int between [min, max). The minimum is inclusive and the maximum is exclusive
static getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randInt(min, max) { return Math.random() * (max - min) + min; }", "function randInt(min, max) { return Math.random() * (max - min) + min; }", "static randomInt(min, max) {\n const minVal = Math.ceil(min);\n const maxVal = Math.floor(max);\n return Math.floor(Math.random() * (maxVal - minVal))...
[ "0.89862984", "0.89862984", "0.89857876", "0.89814657", "0.89514107", "0.89514107", "0.89493227", "0.8946666", "0.89292794", "0.8924936", "0.8918902", "0.89165866", "0.8905488", "0.8904083", "0.8900531", "0.89003545", "0.88985777", "0.8895065", "0.88930315", "0.88922846", "0....
0.88302267
79
set the colors on a new call
setCurrentColors(hexColor) { var colorMap = LEDController.hexToRgb(hexColor); this.current.r = colorMap.r; this.current.g = colorMap.g; this.current.b = colorMap.b; this.current.w = colorMap.w; this.current.fader.r = colorMap.r; this.current.fader.g = colorMap.g; this.current.fader.b = colorMap.b; this.current.fader.w = colorMap.w; this.current.fader.rRatio = colorMap.r / 255; this.current.fader.gRatio = colorMap.g / 255; this.current.fader.bRatio = colorMap.b / 255; this.current.fader.wRatio = colorMap.w / 255; return this.current; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set color(value) {}", "function setColoring(func) {\n getColor = func;\n}", "function changeOne() {\n colors = ['#B29190', '#FFFFD3', '#FF8E8B', '#77A8CC', '#5E8EB2', '#FFD792'];\n init();\n}", "newColors(){\n for (let i = 0; i < this.colorCount; i++) {\n this.addColorToObject()\n ...
[ "0.6775671", "0.6735923", "0.6715483", "0.6614277", "0.6563995", "0.6541555", "0.6506034", "0.648255", "0.6464815", "0.6349141", "0.6343299", "0.6340587", "0.6297614", "0.6297349", "0.6290308", "0.6275192", "0.6264166", "0.62540156", "0.62410474", "0.6234752", "0.6210676", ...
0.0
-1
properties linked to bubbles' attributes
static get properties() { return { msg: { type: String, value: "random" }, owner: { type: String, value: "theirs" } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static get observedAttributes () {\r\n return ['size', 'type', 'plain', 'round', 'circle', 'disabled', 'theme']\r\n }", "static get observedAttributes() {\n return ['rounded', 'size', 'shadow', 'color', 'animated', 'circle'];\n }", "static get observedAttributes() {\n return [\"color\", 'size', ...
[ "0.67322636", "0.6689944", "0.65883", "0.6561325", "0.65589136", "0.64048725", "0.63205516", "0.6286935", "0.62581015", "0.61661106", "0.61038196", "0.6062898", "0.6056974", "0.6033155", "0.60155064", "0.60140336", "0.59773046", "0.5963163", "0.5939287", "0.5920329", "0.59079...
0.562124
45
add new tab related get fixed categoty list
function getCategoryList() { var categoryList = []; categoryList.push({ "key": -1, "value": "请选择" }); categoryList.push({ "key": 2, "value": "完成稿" }); categoryList.push({ "key": 3, "value": "修改" }); categoryList.push({ "key": 4, "value": "修改完成稿" }); categoryList.push({ "key": 5, "value": "疑问" }); categoryList.push({ "key": 6, "value": "疑问回复" }); return categoryList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTabToPage() {\n\tfor (let index = 0; index < categories.length; index++) {\n\t\tpopulatePrototype(mainNavTabs, categories[index], protoItemLinkTab);\t\n\t}\n}", "function addTab(where, id, name) {\n $(where+\" ul\").append('<li><a href=\"#compte-'+id+'\">'+name+'</a></li>');\n $(where)....
[ "0.73578876", "0.6667799", "0.6653982", "0.6567861", "0.6509907", "0.6435853", "0.6411782", "0.6361721", "0.63299924", "0.62811637", "0.6245141", "0.6224265", "0.62232524", "0.61882085", "0.6173463", "0.61720467", "0.6157223", "0.6138979", "0.6124583", "0.61025625", "0.609630...
0.0
-1
get new tab by category
function addNewTab(p1) { let _this = this; let prameters = "&projectId=" + p1.projectid + "&categoryId=" + p1.categoryid + "&description=" + p1.description + "&parentId=" + p1.parentid + "&expiredate=" + p1.expiredate; let handlerurl = funcList["addNewTab"]["interface"] + prameters; $.ajax({ // type: "get", async: true, url: handlerurl, dataType: 'jsonp', crossDomain: true, success: function (data) { _this.newtab.returnmessage = data.Message; if (data.Code === 0) { //console.log("success"); _this.newtab.categoryselected = -1; _this.newtab.desc = ""; //refresh file tab data funcList["getFileTabs"]["func"].call(_this, p1); document.getElementById("fileTabTitle").click(); } else { console.log("addNewTab", "failed"); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function openCat(evt, catName) {\n var i, tabcontent, tablinks;\n tabcontent = document.getElementsByClassName(\"tabcontent\");\n for (i = 0; i < tabcontent.length; i++) {\n tabcontent[i].style.display = \"none\";\n }\n tablinks = document.getElementsByClassName(\"tablinks\");\n for (i = 0...
[ "0.6402528", "0.63706017", "0.6303138", "0.62465954", "0.61883926", "0.6112584", "0.60066456", "0.5899029", "0.58753496", "0.5863427", "0.5862271", "0.5856801", "0.5819914", "0.5819214", "0.57959306", "0.57734025", "0.5769921", "0.57597536", "0.5724606", "0.57233816", "0.5714...
0.5369929
46
Meshdata for a grid; useful for displaying tiles
function TextureGrid(matrix, textureUnitsPerLine) { this.matrix = matrix; this.textureUnitsPerLine = textureUnitsPerLine || 8; var attributeMap = MeshData.defaultMap([MeshData.POSITION, MeshData.NORMAL, MeshData.TEXCOORD0]); var nCells = countCells(matrix); MeshData.call(this, attributeMap, nCells * 4, nCells * 6); this.rebuild(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeGridMesh(numCols, numRows) {\n\n // helper scales to map to normalized device coordinates from columns for simplicity\n const colScale = d3.scaleLinear().domain([0, numCols - 1]).range([-1, 1]);\n const rowScale = d3.scaleLinear().domain([0, numRows - 1]).range([1, -1]);\n\n // at this point, we a...
[ "0.67220193", "0.6584175", "0.6385133", "0.63296044", "0.62898725", "0.6276998", "0.62511027", "0.6190992", "0.616324", "0.61393106", "0.6123526", "0.611164", "0.60900587", "0.60562027", "0.6054941", "0.6047313", "0.60408103", "0.6000799", "0.59960437", "0.59587175", "0.59568...
0.0
-1
Check for Filled Input of the Form
function checkFilledInput(self) { if (self.closest(".product-form__info-item").classList.contains("form__field_invalid")) { self.closest(".product-form__info-item").classList.remove("form__field_invalid"); } if (self.parentElement.querySelector(".info-name__error-message").style.opacity = 1) { self.parentElement.querySelector(".info-name__error-message").style.opacity = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkNotNullInput()\n\t{\n\t\tvar check = true;\n\t\t$('.form_contact input.wpcf7-text').each(function(index, el) {\n\t\t\tif($(this).val() == \"\")\n\t\t\t{\n\t\t\t\tcheck = false;\n\t\t\t\t// console.log(\"Input text\" + index + ' : ' + check);\n\t\t\t}\n\t\t});\n\n\t\tif($('.form_contact textarea.wpcf7...
[ "0.73064667", "0.7272873", "0.7168451", "0.7090253", "0.6959042", "0.6935475", "0.6934978", "0.69094497", "0.6907925", "0.6872896", "0.68641716", "0.68352413", "0.681846", "0.6813024", "0.681122", "0.68093854", "0.6805379", "0.6803981", "0.67992693", "0.6770995", "0.6758022",...
0.684311
11
Listen to form to be submitted Prevent form from submitting Read the value of the input field from the form send ticker back for prediction draw graph plus prediction data
function graphPredictions2(data) { console.log(data); var dates = data.map(data => new Date(data.Date)); var close = data.map(data => data['Adj Close']) var predicts = data.map(data => data.Prediction) var trace1 = { type: "scatter", name: 'Close Price', x: dates, y: close, line: {color: 'blue'} } var trace2 = { type: "scatter", name: 'Predictions', x: dates, y: predicts, line: {color: 'orange'} } var data = [trace1, trace2]; var layout = { yaxis: { title:'Price (USD)' }, title: 'Stock Predictions from the Previous 5 Days' } Plotly.newPlot('plot2', data, layout); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleSubmit() {\n console.log(\"Plot Button responds.\")\n // Prevent the page from refreshing\n Plotly.d3.event.preventDefault();\n \n // // Select the input value from the form\n // var stock1 = Plotly.d3.select(\"#stock1\").node().value;\n // var stock2 = Plotly.d3.select(\"#stock2\...
[ "0.72937334", "0.7128653", "0.68535703", "0.67284584", "0.6706436", "0.6665721", "0.6416312", "0.63628715", "0.6362228", "0.6343406", "0.63298804", "0.6300135", "0.62931216", "0.62833184", "0.6246529", "0.624111", "0.62304157", "0.6226068", "0.6221459", "0.62077534", "0.61898...
0.0
-1
Create Notification Settings .
constructor(client) { // eslint-disable-line no-useless-constructor super(client); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@action addNotification(settings){\n this.notificationManager.addNotification(settings);\n }", "function createNotificationOptions(options) {\n var notificationOptions = {\n backgroundColor: \"505050\",\n blinkColor: \"ffa500\",\n canBlink: false,\n canPlayS...
[ "0.6902834", "0.6580594", "0.6294784", "0.6207837", "0.6119822", "0.61091834", "0.60416496", "0.5976035", "0.59461474", "0.5907934", "0.5870031", "0.5869986", "0.5849333", "0.5827429", "0.58102393", "0.58073586", "0.57790655", "0.57637286", "0.5751266", "0.574592", "0.5744716...
0.0
-1
below function very similar to approach to reversing an array in place with the task of swapping values. fisheryatesshuffle: swap randomly chosen value with current value work through array from end to start
function shuffle(array) { var i = array.length, // i assigned value of array.length j, // var temp & j declared but uninitalized values a.k.a undefined values temp; while (i--) { j = Math.floor(Math.random() * (i+1)); temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shuffleInplace (arr) {\n var j, tmp;\n for (var i = arr.length - 1; i > 0; i--) {\n j = baseRandInt(i + 1);\n tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n }", "fu...
[ "0.77403754", "0.7520094", "0.7465917", "0.7455119", "0.7382979", "0.73513174", "0.73378575", "0.7255467", "0.7241789", "0.722186", "0.722186", "0.722186", "0.720863", "0.7204924", "0.71925896", "0.71768767", "0.7168084", "0.7166632", "0.71585894", "0.71386826", "0.7134521", ...
0.6921377
94
different shuffle better for larger deck assuming cards is array of objects;
function shuffle2(cards) { return cards .map(x => ({ card: x, rand: Math.random() })) .sort((a, b) => a.rand - b.rand) .map(x => x.card); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffleCards() {\n\n \t\tfor(var i = 0; i < this.cards.length; i++) {\n \t\t\tvar randomIndex = Math.floor(Math.random() * this.cards.length);\n \t\tvar temp = this.cards[i];\n \t\t\n \t\tthis.cards[i] = this.cards[randomIndex];\n \t\tthis.cards[randomIndex] = temp;\n \t\t}\n\t }", "shuffle()\n\t...
[ "0.81165093", "0.80923826", "0.8054063", "0.79466534", "0.7932077", "0.7918773", "0.7903095", "0.7881411", "0.78620416", "0.7839473", "0.7838721", "0.783507", "0.7834417", "0.78298587", "0.7827413", "0.7826837", "0.78191376", "0.78102803", "0.77911735", "0.77880245", "0.77707...
0.74995583
51
add(10, 20) add('test1', 'test2') add(10, '20')
function multiplication(p1, p2) { return p1 * p2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add(a, b) {\n\n}", "function add(a, b) {}", "function add(a, b) {return a+b;}", "function add(a,b){return a+b;}", "function add(...numbers) {}", "function add(a, b) { return a + b; }", "function add(a, b) { return a + b; }", "function add(a, b) { return a + b; }", "function add(a, b) { ret...
[ "0.7418437", "0.7397264", "0.7361406", "0.7327898", "0.73198813", "0.72909206", "0.72909206", "0.72909206", "0.72909206", "0.7170232", "0.7129245", "0.7127686", "0.71195734", "0.71106505", "0.7106387", "0.7106387", "0.71041113", "0.7092977", "0.70929617", "0.70733553", "0.706...
0.0
-1
====================================== Command parsing ====================================== checkBlacklistChannel() returns true when it's blacklisted and false if it's not
function checkBlacklistChannel(userID, serverID, channelID, args) { args = args.split(" "); if(blackList.hasOwnProperty("server" + serverID) && args[0] != getCommandPrefix(serverID) + "enable" && args[0] != getCommandPrefix(serverID) + "disable" && args[0] != getCommandPrefix(serverID) + "enablechannel" && args[0] != getCommandPrefix(serverID) + "disablechannel" && userID != config.ids.masterUser) { for(var j in blackList["server" + serverID].nocommandsinchannel) { if(blackList["server" + serverID].nocommandsinchannel[j] == channelID) return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkBlacklistCommand(serverID, args) {\n\targs = args.split(\" \");\n\n\tif(blackList.hasOwnProperty(\"server\" + serverID)) {\n\t\tfor(var i in blackList[\"server\" + serverID].disabledcommands) {\n\t\t\tif(getCommandPrefix(serverID) + blackList[\"server\" + serverID].disabledcommands[i] == args[0])\n\t...
[ "0.7154665", "0.63722354", "0.6189945", "0.5771309", "0.5771309", "0.56840146", "0.5657059", "0.5580645", "0.5580645", "0.54738915", "0.5429967", "0.5384151", "0.53557146", "0.5352665", "0.53440714", "0.52767324", "0.5262718", "0.51749855", "0.51749855", "0.5174391", "0.51656...
0.7576692
0
checkBlacklistCommand() returns true when it's blacklisted and false if it's not
function checkBlacklistCommand(serverID, args) { args = args.split(" "); if(blackList.hasOwnProperty("server" + serverID)) { for(var i in blackList["server" + serverID].disabledcommands) { if(getCommandPrefix(serverID) + blackList["server" + serverID].disabledcommands[i] == args[0]) return true; } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate_blacklist_whitelist() {\n var form = get_form_data('#blacklist_whitelist_form');\n var command = $('#is_blacklisted').prop('checked')?\"blacklist\":\"whitelist\";\n if (check_field_empty(form.nick, 'nick'))\n return false;\n\n var dataObj = {\n \"content\" : [{\n ...
[ "0.6809572", "0.6757459", "0.66634303", "0.66601163", "0.6578552", "0.6578552", "0.64609784", "0.60463053", "0.5864909", "0.5864909", "0.5823656", "0.581792", "0.58097655", "0.5731745", "0.5728547", "0.5694037", "0.5656048", "0.5607361", "0.5586767", "0.5584919", "0.5584919",...
0.7770276
0
Run the actual command
function runCommand(args, context) { if (args.length < 1) return; if (commands[args[0]]) { if (commands[args[0]].permission && !userHasPermission(context.userID, context.channelID, context.serverID, commands[args[0]].permission) && commands[args[0]].permission != "default" || (commands[args[0]].permission == "owner" && context.userID != config.ids.masterUser)) { if(context.userID != config.ids.masterUser) { var msg = ":no_entry: | You don't have permission to use this command."; discord.sendMessage({ to: context.channelID, message: msg }); console.log(localDateString() + " | [COMMAND] " + context.username + " (" + context.userID + " @ " + discord.servers[context.serverID].name + ") no permission for " + context.userID, args); return; } } console.log(localDateString() + " | [COMMAND] " + context.username + " (" + context.userID + " @ " + discord.servers[context.serverID].name + ") ran ", args); try { var result = commands[args[0]].func(args, context, function(msg) { discord.sendMessage({ to: context.channelID, message: msg }); }); if (result) { discord.sendMessage({ to: context.channelID, message: result }); } } catch (ex) { console.log(localDateString() + " | " + colors.red("[ERROR]") + " Error running command: ", ex); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "runCmd() {\n switch(this.command) {\n case \"concert-this\":\n this.concertThis();\n break;\n case \"spotify-this-song\":\n this.spotifyThisSong();\n break;\n case \"movie-this\":\n this.movieThis();\n break;\n case \"do-what-it-says\":\n this...
[ "0.68827057", "0.675081", "0.6599892", "0.65144956", "0.6480254", "0.6418076", "0.64105046", "0.6406679", "0.6398976", "0.6384317", "0.6338506", "0.63075465", "0.63075465", "0.63075465", "0.63075465", "0.63075465", "0.63000643", "0.6296401", "0.627503", "0.62369186", "0.62360...
0.5759314
89
Check the permissions when a user enters a command
function userHasPermission(userID, channelID, serverID, permissionToSplit) { var userPerms = []; if (userID) { if(!permission.hasOwnProperty("server" + serverID)) permission["server" + serverID] = []; if(!permission["server" + serverID].hasOwnProperty("user" + userID)) permission["server" + serverID]["user" + userID] = []; userPerms = userPerms.concat(permission["server" + serverID]["user" + userID] ? permission["server" + serverID]["user" + userID] : []); } if (channelID) userPerms = userPerms.concat(permission["server" + serverID]["channel" + channelID] ? permission["server" + serverID]["channel" + channelID] : []); if (serverID) userPerms = userPerms.concat(permission["server" + serverID]["server" + serverID] ? permission["server" + serverID]["server" + serverID] : []); if (permission["server" + serverID]["default"]) userPerms = userPerms.concat(permission["server" + serverID]["default"]); var permParts = permissionToSplit.split("."); for (var i = 0; i < userPerms.length; i++) { var negate = false; var userPerm = userPerms[i]; if (userPerm.length > 0 && userPerm[0] == "-") { negate = true; userPerm = userPerm.substr(1); } var userPermParts = userPerm.split("."); if (userPermParts.length > permParts.length) continue; var matched = true; for (var j = 0; j < permParts.length; j++) { if (userPermParts[j] == "*") return !negate; else if (userPermParts[j] != permParts[j]) { matched = false; break; } } if (matched) return !negate; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CheckPermissions(msg, command) {\n // Owner\n if (this.IsOwner(msg)) return \"owner\";\n //if (this.botconfig.owneruid && this.botconfig.owneruid === msg.author.id)\n //return \"owner\";\n\n // Channel permissions\n if (msg.channel.type !== \"dm\") {\n // Owner ...
[ "0.6609182", "0.64859504", "0.6473444", "0.6381944", "0.6338052", "0.62169534", "0.6182228", "0.61597437", "0.6011751", "0.59847176", "0.5966993", "0.59469247", "0.5932746", "0.58336866", "0.5833597", "0.5715712", "0.56840175", "0.56681377", "0.5639229", "0.5615226", "0.56112...
0.517921
82
========================================== Load functions ==========================================
function loadMySQL() { pool = mysql.createPool({ connectionLimit : 10, host : config.MySQL.host, port : config.MySQL.port, user : config.MySQL.user, password : config.MySQL.password, database : config.MySQL.database, supportBigNumbers : true, bigNumberStrings : true, multipleStatements : true }); pool.getConnection(function(err, connection) { if(err) throw localDateString() + " | [ERROR] Cannot connect to the MySQL database: " + err; else console.log(localDateString() + " | " + colors.green("[CONNECT]") + " Succesfully connected to the MySQL database: " + config.MySQL.database + ". "); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "load() {}", "load() {}", "load() {\r\n\r\n }", "load() {\n\n }", "lateLoad() {\n\n }", "function load(){\r\n\r\n}", "function load()\n{\n setupParts();\n\tbgn();\n}", "function LocalLoader() { }", "function loadFunction(){\n\tvalidateLogin();\n\tgetImg();\n\tgetTags();\n\tgetUploader()\n\tg...
[ "0.7467556", "0.7467556", "0.7431728", "0.74031764", "0.7112898", "0.71122736", "0.7011801", "0.70015806", "0.69842815", "0.69243145", "0.68929505", "0.67965585", "0.67653775", "0.67163116", "0.66871685", "0.6624588", "0.66161114", "0.66125697", "0.6574077", "0.65117663", "0....
0.0
-1
Initialize the config variable
function loadConfig() { config = JSON.parse(fs.readFileSync("configfiles/config.json")); console.log(localDateString() + " | " + colors.green("[LOAD]") + " Config file has been loaded!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initialize() {\n\t\tconfig = Object.assign({}, config, $scope.config);\n\t}", "initialize(config) {}", "function initializeConfig() {\n _config = {\n appConfig: APP_CONFIG_DATA,\n routes: [],\n currentRoute: {\n route: '/',\n data: undefined\n }\n };\n }", "i...
[ "0.7726884", "0.7582425", "0.74767953", "0.7202587", "0.7150699", "0.7150699", "0.70660335", "0.699362", "0.6964828", "0.69341004", "0.69317937", "0.69317937", "0.6928864", "0.6921718", "0.6910549", "0.6870197", "0.6844521", "0.682242", "0.67813236", "0.6745393", "0.667242", ...
0.0
-1
Initialize the welcomeServers variable
function loadWelcomeChannels() { pool.getConnection(function(err, connection) { connection.query("SELECT * FROM wmtoggle", function(err, results) { for(var i in results) { if(welcomeServers.hasOwnProperty("server" + results[i].serverID)) welcomeServers["server" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage}; else { welcomeServers["server" + results[i].serverID] = {}; welcomeServers["server" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage}; } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " Loaded all the Welcome Channels!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function teamspeakServerInit()\n\t{\n\t\tnavigationInit(\"teamspeakServer\", \"web_teamspeak_server\");\n\t}", "startup() {\n var world = this;\n bot.guilds.cache.forEach((guild) => world.addServer(guild));\n world.setPresence();\n world.startRebootTimer();\n }", "async startServ...
[ "0.6842844", "0.6650254", "0.63563913", "0.63155746", "0.6226222", "0.6121718", "0.6068351", "0.60325056", "0.60197455", "0.5991709", "0.5987057", "0.59664583", "0.5930597", "0.5895276", "0.5878182", "0.580914", "0.57936245", "0.5781758", "0.5769091", "0.57518965", "0.5747676...
0.62876976
4
Initialize the commandPrefix variable
function loadCommandPrefix() { pool.getConnection(function(err, connection) { connection.query("SELECT * FROM commandprefix", function(err, results) { for(var i in results) { commandPrefix["server" + results[i].serverID] = results[i].commandPrefix; } console.log(localDateString() + " | " + colors.green("[LOAD]") + " Command Prefixes have been loaded!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(prefix) {\n this.prefix_ = prefix;\n }", "set prefix(prefix) {\n this._prefix = prefix;\n }", "function prefixer(prefix){\n\tthis.prefix=prefix;\n}", "initialize() {\n const commandFiles = requireDir(nonPrefixCommandsPath, { recurse: true });\n for (const directory in commandFiles) ...
[ "0.6760905", "0.6576429", "0.64607036", "0.62347806", "0.6145098", "0.610826", "0.6048376", "0.5968959", "0.5966746", "0.5934762", "0.5934762", "0.5929225", "0.58752215", "0.5859964", "0.58315384", "0.5765595", "0.56892645", "0.5641765", "0.56373256", "0.563174", "0.5588087",...
0.6976431
0
Initialize the permission variable
function loadPermissions() { pool.getConnection(function(err, connection) { connection.query('SELECT * FROM permission', function(err, results, fields) { for(var i in results) { if(!permission.hasOwnProperty("server" + results[i].serverID)) { permission["server" + results[i].serverID] = {}; permission["server" + results[i].serverID]["user" + results[i].userID] = [results[i].permissionName]; } else { if(!permission["server" + results[i].serverID].hasOwnProperty("user" + results[i].userID)) { permission["server" + results[i].serverID]["user" + results[i].userID] = [results[i].permissionName]; } else { permission["server" + results[i].serverID]["user" + results[i].userID].push(results[i].permissionName); } } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " Permissions have been loaded!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \n \n TokenPermission.initialize(this);\n }", "constructor(permissions) {\n super();\n this._permissions = permissions;\n }", "function profilPermissionInit()\n\t{\n\t\tnavigationInit(\"profilPermission\", \"web_profil_rights\");\n\t}", "_checkPermission() {\n check...
[ "0.70813227", "0.6891101", "0.68017155", "0.66230905", "0.6476747", "0.64706266", "0.64572674", "0.6130823", "0.60972846", "0.6065682", "0.6051342", "0.60383683", "0.595682", "0.5912159", "0.5903493", "0.5865492", "0.5855776", "0.5783482", "0.57659185", "0.57634646", "0.57081...
0.5378881
41
Initialize the blackList variable
function loadBlacklist() { pool.getConnection(function(err, connection) { connection.query("SELECT * FROM blacklist", function(err, results) { for(var i in results) { if(!blackList.hasOwnProperty("server" + results[i].serverID)) { blackList["server" + results[i].serverID] = {"nocommandsinchannel": [], "disabledcommands": []}; if(results[i].noCmdInChannel != "0") blackList["server" + results[i].serverID].nocommandsinchannel.push(results[i].noCmdInChannel); if(results[i].disabledCommand != "N/A") blackList["server" + results[i].serverID].disabledcommands.push(results[i].disabledCommand); } else { if(results[i].noCmdInChannel != "0") blackList["server" + results[i].serverID].nocommandsinchannel.push(results[i].noCmdInChannel); if(results[i].disabledCommand != "N/A") blackList["server" + results[i].serverID].disabledcommands.push(results[i].disabledCommand); } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " The blacklist has been loaded!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set blacklist(vals){\n this._blacklist = vals;\n }", "initBlockedList(blocked) {\n this.blockedList = blocked;\n }", "get blacklist(){\n return this._blacklist;\n }", "function initBlacksmith(){\n\tupdateBlacksmith();\n}", "constructor(whitelist_, blacklist_, trackingDuration_...
[ "0.67245173", "0.641852", "0.6215045", "0.59844536", "0.589395", "0.57634586", "0.574898", "0.56684566", "0.55903274", "0.5589961", "0.5526497", "0.5501797", "0.5448532", "0.5426714", "0.5416911", "0.5393493", "0.53564864", "0.53303087", "0.5324552", "0.5309708", "0.5292029",...
0.5925025
4
Initialize the highlights variable
function loadHighlights() { pool.getConnection(function(err, connection) { connection.query("SELECT * FROM highlightlist; SELECT * FROM highlights;", function(err, results) { for(var i in results[0]) { if(!highlights.hasOwnProperty('server' + results[0][i].serverID)) { highlights["server" + results[0][i].serverID] = {'channels': [], 'keywords': []}; highlights["server" + results[0][i].serverID].channels.push(results[0][i].channelID); } else { highlights["server" + results[0][i].serverID].channels.push(results[0][i].channelID); } } for(var i in results[1]) { if(!highlights.hasOwnProperty('server' + results[1][i].serverID)) { highlights["server" + results[1][i].serverID] = {'channels': [], 'keywords': []}; highlights["server" + results[1][i].serverID].keywords.push(results[1][i].keyword); } else { highlights["server" + results[1][i].serverID].keywords.push(results[1][i].keyword); } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " The highlights has been loaded!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initHighlighting() {\n if (initHighlighting.called)\n return;\n initHighlighting.called = true;\n\n var blocks = document.querySelectorAll('pre code');\n ArrayProto.forEach.call(blocks, highlightBlock);\n }", "function initHighlighting() {\n\t if (initHighlig...
[ "0.7696432", "0.7683102", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76723343", "0.76524425", "0.76521224", "0.7650175", "0.7650175", ...
0.6135413
99
Load a single plugin (commands)
function loadPlugin(name, configObject) { var path = "./plugins/" + name + ".js"; delete require.cache[require.resolve(path)]; var plugin = require(path); for (var i in configObject) { plugin.config[i] = configObject[i]; } if (plugin.commands) { for (var cmd in plugin.commands) { if (commands[cmd]) throw localDateString() + " | [ERROR] Command " + cmd + " is already defined!"; if (!plugin.commands[cmd].func) throw localDateString() + " | [ERROR] No command function for " + cmd + "!"; if (!plugin.commands[cmd].permission) console.warn(localDateString() + " | " + colors.yellow("[WARNING]") + " The command \"" + cmd + "\" doesn't have any permissions."); if (!plugin.commands[cmd].description) console.warn(localDateString() + " | " + colors.yellow("[WARNING]") + " The command \"" + cmd + "\" doesn't have any description."); if (!plugin.commands[cmd].usage) console.warn(localDateString() + " | " + colors.yellow("[WARNING]") + " The command \"" + cmd + "\" doesn't have any usage."); if (!plugin.commands[cmd].examples) console.warn(localDateString() + " | " + colors.yellow("[WARNING]") + " The command \"" + cmd + "\" doesn't have any examples."); commands[cmd] = plugin.commands[cmd]; commands[cmd].plugin = path; commands[cmd].command = cmd; } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " Loaded the plugin " + name + "!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadPlugin(plugin) {\n // Die Plugins werden abhängig von ihrer Api Version unterschiedlich geladen.\n switch (plugin.help.apiVersion) {\n case 1:\n // API v1: Es müssen keine gesonderten Argumente übergeben werden. Wird meistens von Overwrites verwe...
[ "0.6980662", "0.64401215", "0.6237988", "0.61917365", "0.61872524", "0.60394716", "0.5967307", "0.59412295", "0.5901391", "0.5833196", "0.5819516", "0.5813469", "0.57892627", "0.578838", "0.5680893", "0.5680893", "0.5671987", "0.56583416", "0.55756724", "0.553863", "0.5533694...
0.7099986
0
Load all dynamic commands (both normal commands and inline)
function loadDynamicCommands() { pool.getConnection(function(err, connection) { connection.query("SELECT * FROM commands", function(err, results) { for(var i in results) { if(results[i].typeCommand == "command") { if(dynamicCommands.commands.hasOwnProperty("server" + results[i].serverID)) { dynamicCommands.commands["server" + results[i].serverID][results[i].commandName] = {commandname: "", message: ""}; dynamicCommands.commands["server" + results[i].serverID][results[i].commandName].commandname = results[i].commandName; dynamicCommands.commands["server" + results[i].serverID][results[i].commandName].message = results[i].commandMessage; } else { dynamicCommands.commands["server" + results[i].serverID] = {}; dynamicCommands.commands["server" + results[i].serverID][results[i].commandName] = {commandname: "", message: ""}; dynamicCommands.commands["server" + results[i].serverID][results[i].commandName].commandname = results[i].commandName; dynamicCommands.commands["server" + results[i].serverID][results[i].commandName].message = results[i].commandMessage; } } else if(results[i].typeCommand == "inline") { if(dynamicCommands.inline.hasOwnProperty("server" + results[i].serverID)) { dynamicCommands.inline["server" + results[i].serverID][results[i].commandName] = {inlinecommand: "", message: ""}; dynamicCommands.inline["server" + results[i].serverID][results[i].commandName].inlinecommand = results[i].commandName; dynamicCommands.inline["server" + results[i].serverID][results[i].commandName].message = results[i].commandMessage; } else { dynamicCommands.inline["server" + results[i].serverID] = {}; dynamicCommands.inline["server" + results[i].serverID][results[i].commandName] = {inlinecommand: "", message: ""}; dynamicCommands.inline["server" + results[i].serverID][results[i].commandName].inlinecommand = results[i].commandName; dynamicCommands.inline["server" + results[i].serverID][results[i].commandName].message = results[i].commandMessage; } } } console.log(localDateString() + " | " + colors.green("[LOAD]") + " Dynamic commands have been loaded!"); connection.release(); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadCommands() {\n bot.commandFile = (fs.readdirSync(`./commands`).filter(file => file.endsWith('.js')))\n bot.commands = new Discord.Collection()\n\n q = ''\n bot.commandFile.forEach(file => {\n try {\n const command = require(`./commands/${file}`)\n bot.commands....
[ "0.70253783", "0.689566", "0.66975653", "0.66169256", "0.6512732", "0.6468659", "0.64662427", "0.638124", "0.6281163", "0.6236273", "0.61228675", "0.610962", "0.60910386", "0.6059039", "0.60365444", "0.6033971", "0.59987646", "0.59652156", "0.59299886", "0.5925875", "0.592194...
0.7447799
0
This function will subtract a certain amount of Coin and send User BCH instead. username: who asks to withdraw BCH. toAddress: The address that the user input to receive BCH for this request. It is legacy format. coinAmount: Coin to subtract from the user's account For example: withdrawBCH('8','mhREfUGuqNTpQSuPVG234kt6T9hzVYkD8Y',5000000);
function withdrawBCH(username, toAddress, coinAmount,callback) { DBSERVICE.getUserByUsername(username, function (err1, data1) { if (err1) { return callback(err1); } else { var newCoinValue = data1[0].coin - coinAmount; var user = data1[0]; user.coin = newCoinValue; if (newCoinValue < 0) { return callback("The user " + username + " does not have enough coins to withdraw!"); } DBSERVICE.updateCoinByUsername(newCoinValue, username, function (err2, data2) { if (err2) { return callback(err2); } else { DBSERVICE.addBCHWithdrawLog(this.user.id, toAddress, coinAmount, withdrawLogStatus.CREATED, function (err3, data3) { if (err3) return callback(err3); else { sendTxToNode(data3, function (err4, data4) { if (err4) return callback(err4); else { DBSERVICE.updateBCHWithdrawLogById(this.withdrawLog.id, { tx_hash: data4, tx_status: withdrawLogStatus.SUBMITTED }, function (err5, data5) { if (err5) return callback(err5); else { return callback(null,data4); } }); } }.bind({withdrawLog: data3})); } }); } }.bind({user: data1[0]})); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function money() {\n let commands = {\n atm: 'wallet',\n purse: 'wallet',\n wallet(target, room, user) {\n if (!this.canBroadcast()) return;\n Economy.get((target || user.userid), function(amount) {\n let currency = Wulu.Economy.currency_name;\n if (amount !== 1) currency += 's';\...
[ "0.61683816", "0.5980566", "0.593804", "0.589728", "0.5891553", "0.58647895", "0.5771372", "0.5739187", "0.5698769", "0.56953025", "0.56599474", "0.5629394", "0.5622628", "0.56201553", "0.5604254", "0.56004566", "0.5590092", "0.55583376", "0.55579287", "0.5551349", "0.5527935...
0.7750283
0
TODO should be an obect...
function new_fry() { fry = d.game.add.sprite(100, 100, 'fry'); fry.animations.add('down_left_move', [0, 1, 2, 3]); fry.animations.add('down_right_move', [4, 5, 6, 7]); fry.animations.add('up_left_move', [12, 13, 14, 15]); fry.animations.add('up_right_move', [8, 9, 10, 11]); fry.animations.add('down_left_stop', [2]); fry.animations.add('down_right_stop', [6]); fry.animations.add('up_left_stop', [14]); fry.animations.add('up_right_stop', [10]); fry.direction = {up_down: 'down', left_right: 'left', action: 'stop'}; return fry; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient private protected internal function m182() {}", "protected internal function m252() {}", "transient private internal function m185() {}", "transient protected internal function m189() {}", "transient final protected i...
[ "0.6881736", "0.67365235", "0.64367425", "0.64334476", "0.6281391", "0.62618375", "0.59803885", "0.59659624", "0.5959518", "0.5945336", "0.5923701", "0.5847171", "0.5838421", "0.57444596", "0.57349026", "0.5706911", "0.56834036", "0.5659674", "0.5657383", "0.56127244", "0.553...
0.0
-1
var x = numberAdder(a, b); var y = numberMultiplier(c, d); return( x+ y); }
function numberAdder(num1, num2) { var aa = num1; var bb = num2; var cc = aa + bb; return cc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function multiplyAndAdd(a,b){\n\tvar m = a*b;\n\tvar sum = a+b;\n\treturn m+sum;\n}", "function addNumbers(a, b) {\r\n var c = a+b;\r\n return c;\r\n}", "function doubleAddition(c,d) {\n var total = addition(c,d)*2;\n return total;\n}", "function adder(x,y) {\n return x + y\n}", "static addNum...
[ "0.7668432", "0.73203933", "0.7191255", "0.71809477", "0.71774125", "0.71301615", "0.71199906", "0.70968276", "0.7093334", "0.70372075", "0.70340997", "0.70340997", "0.702981", "0.7024556", "0.70213306", "0.70213306", "0.6972796", "0.6972161", "0.688974", "0.68867326", "0.688...
0.7013792
16
generate a new ID for an element in the tree...
function getId() { idRoot++; return idRoot; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getElementNewID(el) {\n var elID = el.id;\n if (!elID) {\n alert(\"Every elemet should have a unique id to use function getElementNewID()\");\n return false;\n }\n var splitID = elID.split('_');\n var index = 1;\n var newIndex = 1...
[ "0.7374055", "0.7222288", "0.7126876", "0.7122639", "0.70924544", "0.6835382", "0.66331244", "0.66181564", "0.6601895", "0.6546532", "0.6540094", "0.65283006", "0.64995444", "0.6475439", "0.6455879", "0.64452505", "0.6439829", "0.64369303", "0.64334506", "0.6409198", "0.63972...
0.67940605
6
console.log('') console.log(resource.resourceType + " " + resource.id) let refs = []
function processBranch(refs,parentPath,branch) { Object.keys(branch).forEach(function (key) { let element = branch[key] let typ = typeof(element) switch (typ) { case "object" : if (Array.isArray(element)){ if (debug) {console.log(parentPath, key,'array',element.length)} element.forEach(function (child) { let path = parentPath + "." + key //console.log('child',path,child,) //if the content of the array element is a string, then forEach will iterate over each character if (typeof(child) == 'string') { if (debug) {console.log('---leaf:',path,child)} if (hashResources[child]) { //the assumption is that this is a canonical reference... let item={source:resource, path:path,url:child,target : hashResources[child]} refs.push(item) } } else { processBranch(refs,path,child) } }) } else { if (debug) {console.log(parentPath, key,'object')} let path = parentPath + "." + key processBranch(refs,path,element) } break case "string" : //want the value... let path = parentPath + '.' + key if (hashResources[element]) { //the assumption is that this is a canonical reference... let item={source:resource, path:path,url:element,target : hashResources[element]} refs.push(item) } let display = element.substr(0,80) if (debug) {console.log('---leaf:',path,display)} //console.log(key,element) break default : if (debug) {console.log('===========>',key,typ)} } //console.log(key, typeof(element) ) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get refs() { return this._refs.values(); }", "function get_ref(key,value) {\n var refs = [];\n if(key === \"Ref\") {\n refs.push(value);\n }\n return refs;\n}", "get resources() {\n return this.resource ? [this.resource] : [];\n }", "function handlGetReferences(req, res, filter) {\n a...
[ "0.62000924", "0.6148235", "0.608144", "0.5874732", "0.5850201", "0.5822028", "0.5796609", "0.57905173", "0.578919", "0.56957126", "0.5662117", "0.56277275", "0.56223375", "0.56171227", "0.5603584", "0.55969363", "0.55770004", "0.55629504", "0.55409145", "0.55346596", "0.5491...
0.53722656
22
find canonical references from a single node. A canonical reference is where the
function findCanonicalReferences() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "refersTo() {\n //calculate links\n this.compute('coreference')\n // return them\n return this.map(m => {\n if (!m.found) {\n return m.none()\n }\n let term = m.docs[0][0]\n if (term.reference) {\n return m.update([term.reference])\n }\n ...
[ "0.67510694", "0.57971466", "0.5773545", "0.5727857", "0.53836536", "0.5305239", "0.5293217", "0.5276566", "0.52651995", "0.5235483", "0.52296466", "0.5186682", "0.5175149", "0.5175149", "0.5175149", "0.5175149", "0.5161893", "0.51330316", "0.51283544", "0.5126997", "0.510924...
0.77274764
0
Set the width of the side navigation to 0 and the left margin of the page content to 0
function closeNav() { document.getElementById("johngold-mySidenav").style.width = "0"; document.getElementById("main").style.marginLeft = "0"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function menuOpenClicked() {\n document.getElementById('leftSideBar').style.left = \"0\";\n document.getElementById('emptyPage').style.left = \"0\";\n }", "function closeNav() {\n document.getElementById(\"mySidebar\").style.width = \"0\";\n document.getElementById(\"page-top\").style.marginLeft = \...
[ "0.67312086", "0.65784436", "0.6542483", "0.64641595", "0.6428837", "0.634617", "0.6331535", "0.63293236", "0.63163006", "0.6314609", "0.63079983", "0.6303508", "0.6297552", "0.6297552", "0.6297552", "0.6297552", "0.6297552", "0.62916607", "0.6291525", "0.6291525", "0.6238352...
0.6070346
69
y devolver (return) el mayor.
function printMenorReturnMayor(arr){ var menor = arr[0]; var mayor = arr[0]; for (var i = 1; i < arr.length; i++){ if (arr[i] < menor){ menor = arr[i]; }else if (arr[i] > mayor){ mayor = arr[i]; } } console.log(menor); return mayor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "decc() {\n\t\tlet maxvx = 0.0;\n\t\tlet maxvy = 0.0;\n\n\t\tif( this.vx < maxvx ){\n\t\t\tthis.vx += this.dc;\n\t\t} else if( this.vx > maxvx ){\n\t\t\tthis.vx -= this.dc;\n\t\t}\n\n\t\tif( this.vy < maxvy ){\n\t\t\tthis.vy += this.dc;\n\t\t} else if( this.vy > maxvy ){\n\t\t\tthis.vy -= this.dc;\n\t\t}\n\n\t\tif(...
[ "0.59930885", "0.59178627", "0.58192056", "0.5700443", "0.5598714", "0.55888635", "0.55809", "0.55725545", "0.5531323", "0.55047894", "0.5430285", "0.54265606", "0.5358915", "0.53540444", "0.5318579", "0.5309919", "0.5306001", "0.53058094", "0.52936405", "0.5286793", "0.52855...
0.0
-1
fonction de la barre de progression
function update(player) { var duration = player.duration; // Durée totale var time = player.currentTime;// Temps écoulé var fraction = time / duration; var percent = Math.ceil(fraction * 100); var progress = document.querySelector('#progressBar'); progress.style.width = percent + '%'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startBar() {\n if (i == 0) {\n i = 1;\n width = 0;\n var id = setInterval(tick, 10);\n\n // 1 tick function of progress bar 1 tick = 100ms and\n function tick() {\n if (width >= 100 ) {\n clearInterval(id);\n i = 0;\n checkEndGame();\n ...
[ "0.73425585", "0.72827005", "0.7277741", "0.72719765", "0.72653747", "0.72653747", "0.72653747", "0.72653747", "0.72554433", "0.7242591", "0.72240907", "0.72208214", "0.7195294", "0.7133217", "0.70993173", "0.7097072", "0.70939004", "0.70855063", "0.7081227", "0.7004807", "0....
0.0
-1
rendre la barre cliquable
function getMousePosition(event) { return { x: event.pageX, y: event.pageY }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function retourneBarres() {\n\n requestAnimationFrame(retourneBarres)\n\n x = 0\n // \"getByteFrequencyData\" va nous retourner une valeur entre 0 et 255 par rapport à une fréquence de notre tableaud de fréquence\n // Il nous permettre de gérer la couleur (255 en rgb) mais également la...
[ "0.66485834", "0.61869884", "0.605423", "0.57213235", "0.56708986", "0.5590476", "0.5563641", "0.5442379", "0.53899765", "0.5376012", "0.5375396", "0.53570265", "0.5346018", "0.5316859", "0.53144884", "0.52999437", "0.5233804", "0.5233804", "0.5202831", "0.5182632", "0.518263...
0.0
-1
Obtener todas las categorias
function getCategorias(req, res){ Categoria.find({}, (err, Categorias) => { if (err) return res.status(500).send({message: `Error al realizar la petición: ${err}`}) if (!Categorias) return res.status(404).send({message: 'No existen Categorias'}) res.send(200, { Categorias }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getCategories() {\n return ['Snacks', 'MainDishes', 'Desserts', 'SideDishes', 'Smoothies', 'Pickles', 'Dhal', 'General']\n }", "function disneyCategories(){\n //fetch get index for attractions\n \n byCategory()\n}", "function buildCategories() {\n const selectCategories = {};\n\n for (...
[ "0.73029", "0.70099753", "0.6916483", "0.6821287", "0.67976314", "0.6776981", "0.6771568", "0.677076", "0.6629437", "0.66064984", "0.6528479", "0.6471163", "0.6469495", "0.64663595", "0.64600676", "0.6458984", "0.6409981", "0.6381994", "0.6367078", "0.63375616", "0.63296515",...
0.6171663
31
Obteniene una categoria dada su ID
function getCategoria(req, res){ let CategoriaId = req.params.CategoriaId //id de la categoria a buscar Categoria.findById(CategoriaId, (err, Categoria) => { if (err) return res.status(500).send({message: `Error al realizar la petición: ${err}`}) if (!Categoria) return res.status(404).send({message: `El Categoria no existe`}) res.status(200).send({ Categoria }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCategoryId (id) {\n window.categoriaid = id //Guardo el id de la categoria en global\n }", "function getCategoryId(id) {\n console.log(\"Catgory Id\", id);\n ipcRenderer.send(\"categoryId\", id);\n}", "function getCategory(id){\n return _categoryProducts.filter(category=>category.id===...
[ "0.7628056", "0.682565", "0.6698843", "0.6632235", "0.66204023", "0.66014063", "0.6524491", "0.6510747", "0.64841455", "0.63678354", "0.63324237", "0.6297673", "0.6294961", "0.62792224", "0.6262928", "0.6222589", "0.6168526", "0.6121667", "0.61082816", "0.60967857", "0.606984...
0.5979872
25
Modificacion de una categoria
function updateCategoria(req, res){ let CategoriaId = req.params.CategoriaId //id de la categoria a buscar let update = req.body //data a modificar //Busca la categoria Categoria.findById(CategoriaId, (err, Categoria) => { /*Modifica el nombre de la categoria en los usuarios asociados*/ User.find({nombreCtg: Categoria.nombre}, (err,usuario) =>{ for (var i = usuario.length - 1; i >= 0; i--) { User.findByIdAndUpdate(usuario[i]._id, {$set: {nombreCtg: req.body.nombre}}, (err,userUpdated)=>{ console.log(userUpdated) }) } }) /*Modifica el nombre de la categoria en las promociones asociadas*/ Promo.find({categoriaNew: Categoria.nombre}, (err, promo) =>{ for (var i = promo.length - 1; i >= 0; i--) { Promo.findByIdAndUpdate(promo[i]._id, {$set: {categoriaNew: req.body.nombre}}, (err,userUpdated)=>{ console.log(userUpdated) }) } }) /*Modifica el nombre de la categoria en las promociones asociadas*/ Promo.find({categoriaOld: Categoria.nombre}, (err, promo) =>{ for (var i = promo.length - 1; i >= 0; i--) { Promo.findByIdAndUpdate(promo[i]._id, {$set: {categoriaOld: req.body.nombre}}, (err,userUpdated)=>{ console.log(userUpdated) }) } }) }) /*Modifica la informacion de la categoria*/ Categoria.findByIdAndUpdate(CategoriaId, update, (err, CategoriaUpdated) => {//modificar a que solo sea el nombre if (err) res.status(500).send({message: `Error al actualizar el Categoria: ${err}`}) res.status(200).send({ Categoria: CategoriaUpdated }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "[consts.VIS_ADD_CATEGORY](state, val) {\n state.visAddCategory = val;\n }", "categ(state,data)\n {\n return state.category=data\n }", "function addCategory(category) {\n categories[category] = []\n originals[category] = []\n}", "function disneyCategories(){\n //fet...
[ "0.65193516", "0.65002346", "0.64359546", "0.6408688", "0.62715167", "0.62714213", "0.6177254", "0.6113952", "0.60609823", "0.6057501", "0.603812", "0.6036869", "0.6030975", "0.60170555", "0.5996101", "0.59766597", "0.5929407", "0.5900902", "0.5899198", "0.58973396", "0.58667...
0.0
-1
Eliminar una categoria dada
function deleteCategoria(req, res){ let CategoriaId = req.params.CategoriaId /*Busca la categoria por su id*/ Categoria.findById(CategoriaId, (err, Categoria) => { /*Verifica que no este asociada a un usuario*/ User.find({nombreCtg: Categoria.nombre}, (err,usuario) =>{ if(usuario.length > -1){ res.status(400).send({message: 'No se puede eliminar membresia asociada a usuarios'}) return null } }) /*Verifica que no este asociado a una promocion como categoria anterior*/ Promo.find({categoriaOld: Categoria.nombre}, (err,usuario) =>{ if(usuario.length > -1){ res.status(400).send({message: 'No se puede eliminar membresia asociada a usuarios'}) return null } }) /*Verifica que no este asociado a una promocion como categoria nueva*/ Promo.find({categoriaNew: Categoria.nombre}, (err,usuario) =>{ if(usuario.length > -1){ res.status(400).send({message: 'No se puede eliminar membresia asociada a usuarios'}) return null } }) /*Elimina la categoria*/ if (err) res.status(500).send({message: `Error al borrar el Categoria: ${err}`}) res.status(200).send({Categoria: Categoria}) console.log(err) Categoria.remove(err => { if (err) res.status(500).send({message: `Error al borrar el Categoria: ${err}`}) res.status(200).send({message: 'El Categoria ha sido eliminado'}) }) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function borrarCategoria(codigo) {\n borrarRegistro(\"Category\", codigo);\n}", "function removerCategoria() {\n consultarProdutos();\n}", "function hideCategoryTitles() {\n\t\tsvg.selectAll(\".category\").remove()\n\t}", "function resetCategories() {\n document.querySelectorAll(\".category\").for...
[ "0.6935602", "0.6799863", "0.6600557", "0.6500565", "0.64740884", "0.64398324", "0.636105", "0.6265936", "0.6211752", "0.6199044", "0.59036016", "0.58870727", "0.58538723", "0.5812417", "0.5707179", "0.5697552", "0.5695145", "0.56949425", "0.56668216", "0.56452554", "0.563190...
0.0
-1
returns boolean indicating if nodeValue exists in tree
contains(nodeValue) { //start with root if (this.value === nodeValue) { return true; } // if looking for nodeValue greater than current root, recursively search right subtree if right subtree exists, // otherwise return false if (nodeValue > this.value) { if (this.right) { return this.right.contains(nodeValue); } else { return false; } } // if looking for nodeValue less than current root, recursively search left subtree if a left subtree exists, // otherwise return false if (nodeValue < this.value) { if (this.left) { return this.left.contains(nodeValue); } else { return false; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "contains(value) {\n // let currentNode = this.root;\n\n const traverse = node => {\n\n if (!node) return false;\n if (node.value === value) return true;\n\n const left = traverse(node.left);\n const right = traverse(node.right);\n\n if (left || right) return true;\n };\n const ...
[ "0.79773223", "0.7441721", "0.7323101", "0.73008174", "0.7237273", "0.71992415", "0.71861005", "0.71503174", "0.7125384", "0.7116652", "0.7055416", "0.7052124", "0.70056844", "0.6877223", "0.68702006", "0.68373144", "0.68264145", "0.68127304", "0.6782869", "0.67786425", "0.66...
0.7218064
5
Note that a subarray must consist of consecutive elements from the original array. In the first example below, [100, 200, 300] is a subarray of the original array, but [100, 300] is not. Constraints: Time COmplexity O(N) Space Complexity O(1) My solution:
function maxSubarraySum(arr, num){ // add whatever parameters you deem necessary - good luck! let max = 0 if (num > arr.length) return null for (let i = 0; i < num; i++) { max += arr[i] } let temp = max for (let i = num; i < arr.length; i++) { temp += arr[i] - arr[i - num] if (temp>max) max=temp } return max }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find_subarrays(arr, target) {\n let result = [];\n let product = 1;\n let left = 0;\n for (let right = 0; right < arr.length; right++) {\n product *= arr[right];\n while (product >= target && left < arr.length) {\n product /= arr[left];\n left += 1;\n }\n // since the product of ...
[ "0.6822679", "0.67327064", "0.67258596", "0.6688721", "0.6624238", "0.65848935", "0.65220505", "0.6519364", "0.6507749", "0.65022993", "0.64961296", "0.64876413", "0.6487543", "0.64678705", "0.6380627", "0.63762677", "0.6368759", "0.63665414", "0.63537467", "0.6283314", "0.62...
0.0
-1
jQuery('calendar').fullCalendar('renderEvent', firstObject, true); /// SWITCHING LIST FROM 3 COLUMNS TO 2 COLUMN LIST
function reposTitle() { console.info("reposTitle"); if(jQuery(window).width() < 450) { if(!jQuery('.fc-header-title').is(':visible')) { if(jQuery('h3.calTitle').length == 0) { var m = jQuery('.fc-header-title h2').text(); jQuery('<h3 class="calTitle">'+m+'</h3>').insertBefore('#calendar table.fc-header'); } } } else { jQuery('h3.calTitle').remove(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderEvents() {\n var totalPercent = 100,\n currentEvent,\n curCol,\n width,\n height,\n leftOffset,\n eventText,\n i,\n j;\n \n // empty container before adding new events\n $el.empty();\n \n // go through all columns\n for (i=...
[ "0.64767957", "0.63997716", "0.602273", "0.59563565", "0.5944718", "0.5937498", "0.5926071", "0.59164333", "0.5899234", "0.589884", "0.5865304", "0.58624333", "0.5855095", "0.5837488", "0.58209175", "0.5804405", "0.5778538", "0.57650393", "0.5763953", "0.5762442", "0.5701233"...
0.0
-1
to save which days should be free (constraint) >>>>>>>>>>>>>>>>>// Example 1:
function addExample1() { myCourses.map((val) => { let course = { courseName: val.courseName, lecturerName: val.lecturerName, typeOfCourse: val.type, days: val.days, beginningTime: val.beginningTime, duration: val.duration }; addItem(course); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setConstraint() {\r\n var today = new Date();\r\n var endDay = new Date();\r\n var addDays = 6; // to set end day in 6 days time\r\n endDay.setDate(today.getDate() + addDays);\r\n\r\n document.getElementById('date').setAttribute('min', returnDate(today));\r\n docu...
[ "0.6225858", "0.5467173", "0.54231864", "0.5394018", "0.53434813", "0.53231823", "0.53178537", "0.5261939", "0.525134", "0.52462196", "0.51702756", "0.5132883", "0.511947", "0.51159805", "0.5114732", "0.51095665", "0.50809073", "0.50783175", "0.5071633", "0.503792", "0.503020...
0.0
-1
======================== useState SET functions start here : =======================
function clearTimeTableState() { setTimeTable([]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "prepareState() {\n /* ... */\n }", "function useState() {\n\n //verify last state of A3 controls, put it back to last saved state\n if (localStorage.saveState_analog_enabled_A3 == \"true\") { // if save state is true but the current setting is false\n if (analog_enabled_A3 == false) {\n ...
[ "0.6465174", "0.6349783", "0.627923", "0.6247384", "0.6195899", "0.6170716", "0.6143402", "0.6141321", "0.6112121", "0.60840625", "0.60369956", "0.6031734", "0.59970814", "0.5992493", "0.59451246", "0.5924356", "0.5923286", "0.5880098", "0.5869265", "0.58533454", "0.5841591",...
0.0
-1
======================== useState SET functions end here. ======================= // =========================== Start Take Input From User ===============================================// / This function takes the lesson information inserted by the user, validate them and insert them to the lessons table
function takeCourse(event) { event.preventDefault(); // Prevent page restart matrixArr.sort(matrixArrSort); // sort by [day , time] if (matrixArr.length === 0) { // If the user did not choose days & hours for the lesson setMatrixEmpty(true); return; } setMatrixEmpty(false); let course = { courseName: "", lecturerName: "", typeOfCourse: "", days: [], beginningTime: [], duration: [] }; let [courseName, lecturerName, typeOfCourse] = Object.values(takeInput); course.courseName = courseName; course.lecturerName = lecturerName; course.typeOfCourse = typeOfCourse; let index = 0; // dayIndex while (matrixArr.length > 0) { // taking the button's location which represents the day and the hour var [button, setButtonColor] = matrixArr.pop(); var row = button.id; var col = button.name; // Push the first lessons' hour to "course" object if (course.days[0] === undefined) { course.days.push(tnum(col)); course.beginningTime.push(tnum(row)); course.duration.push(1); } // In case we got a consecutive lessons' hours so => update the beginning time and increase the duration else if ( (tnum(col) === course.days[index]) && (course.beginningTime[index] === tnum((+row + 1).toString())) ) { course.beginningTime.pop(); course.beginningTime.push(tnum(row)); course.duration[index]++; } // In case we got a lesson with split hours so => add another cell to the arrays "days", "beginningTime" & "duration" else { index++; course.days.push(tnum(col)); course.beginningTime.push(tnum(row)); course.duration.push(1); } setButtonColor(button); // Set the matrix's button's color to the original color } // If this course already exist return without adding it to the "items" array that contains all the courses for (const x of items) { if (isEquivalent(course, x)) return; } // In case that tnum didn't succeed to convert well : for(var i = 0; i < course.days.length ; i++){ if(course.days[i] === undefined || course.beginningTime[i] === undefined) return; } // Add this course to "Items" addItem(course); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function LessonsMain() {\n // ^^ Chg to File Name \n\n // Setting our component's initial state\n const [lessonsmain, setLessonsMain] = useState([])\n const [formObject, setFormObject] = useState({})\n\n // Load all books and store them with setBooks\n useEffect(() => {\n loadLessonsMain()\n }, [])\...
[ "0.674326", "0.6029086", "0.6007591", "0.5776786", "0.5729975", "0.56104946", "0.5595754", "0.5548195", "0.55341595", "0.5433966", "0.5415039", "0.54099053", "0.5405129", "0.5369882", "0.5350393", "0.53468704", "0.5312738", "0.52719134", "0.5262518", "0.52609724", "0.5258956"...
0.50842
38
=========================== End Take Input From User ===============================================// ========================== Start Algorithem To Find TimeTables ===================================
function findSchedule() { clearTimeTableState(); // Remove all the previous timetables // Validation for start & end time to each day for (var val of constStartEnd) { if (val.start !== "" && val.end !== "") { if (parseInt(val.start) > parseInt(val.end)) { alert("זמני התחלה וסיום לא הגיוניים"); return; } } } items.sort(coursesSort); // Sort items array by course name and then by course type // "constItems" will contain only the relevant lessons depends on user constraints const constItems = items.filter((val) => { var flag = true; for (var i = 0; i < val.days.length; i++) { if ( (constFreeDay[snum(val.days[i]) - 1]) || (parseInt(constStartEnd[snum(val.days[i]) - 1].start) > parseInt(val.beginningTime[i])) || (parseInt(constStartEnd[snum(val.days[i]) - 1].end) < (parseInt(val.beginningTime[i]) + val.duration[i] - 1)) ) { flag = false; break; } } if (flag) return val; }); let prev = []; let curr = []; let courseTypeIndex = []; let differTypes = 0; // "differTypes" variable summarize all the differnte types of lecture in each course in "items" array (the original array) for (var i = 0; i < items.length; i++) { curr = [items[i].courseName, items[i].typeOfCourse]; if (!curr.equals(prev)) { differTypes++; prev = curr; } } /* The next loop save in "courseTypeIndex" the beginning index of each differnte lesson type. Differnte lesson type is when we have differnt course name or differnte types in the same lesson */ curr = []; prev = []; for (i = 0; i < constItems.length; i++) { curr = [constItems[i].courseName, constItems[i].typeOfCourse]; if (!curr.equals(prev)) { courseTypeIndex.push(i); prev = curr; } } // If the number of different lesson type isn't equal that's mean that when we filtered "items" into // "constItems" we subtracted a whole type lecture of some course if (courseTypeIndex.length !== differTypes || courseTypeIndex.length === 0) { setAlertMsg("לא נמצאו התאמות"); return; } // If the flag "highPriority" is true => the user has a preference to some particular lesson if (highPriority) setRelevantCoursesFirst(courseTypeIndex, constItems); let schedule = Array(14) .fill() .map(() => Array(7).fill("")); schedule = initSchedule(schedule); // Initiate the matrix schedule with Days & Hours findAndPrint(0, courseTypeIndex, schedule, constItems); if (timeTable.length === 0) // In cases that there were not found a timetables setAlertMsg("לא נמצאו התאמות"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runProgram(input){\n let input_arr = input.trim().split(\"\\n\")\n let [_, days] = input_arr[0].trim().split(\" \").map(Number)\n let array = input_arr[1].trim().split(\" \").map(Number)\n let total_time = array.reduce((acc, i) => acc + i)\n \n let low = 0\n let high = total_time\n ...
[ "0.6207013", "0.59677005", "0.5962626", "0.5891129", "0.5769364", "0.57128286", "0.56796074", "0.56580836", "0.56519806", "0.56313366", "0.5623594", "0.562091", "0.56062967", "0.5588415", "0.55840933", "0.5579423", "0.557821", "0.55776113", "0.556862", "0.55571985", "0.554311...
0.57894015
4
Starts of recursive function to find the timetables
function findAndPrint(i, typeIndex, schedule, constItems) { // In case we need to print the schedule if (i === typeIndex.length) { if (checkIfWindowless(schedule)) { addTimeTable(JSON.parse(JSON.stringify(schedule))); //Deep copy of object with JSON } return; } let end = typeIndex[i + 1]; if (end === undefined) end = constItems.length; for (let curr = typeIndex[i]; curr < end; curr++) { if (putLesson(constItems[curr], schedule)) { findAndPrint(i + 1, typeIndex, schedule, constItems); removeLesson(constItems[curr], schedule); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findSchedule() {\n\n clearTimeTableState(); // Remove all the previous timetables \n\n // Validation for start & end time to each day\n for (var val of constStartEnd) {\n if (val.start !== \"\" && val.end !== \"\") {\n if (parseInt(val.start) > parseInt(val.end)) {\n alert(\"...
[ "0.6245258", "0.5752182", "0.5644393", "0.5551526", "0.55352044", "0.55056787", "0.5432454", "0.5409614", "0.5324132", "0.5315506", "0.5286552", "0.52751213", "0.52491677", "0.5239412", "0.5211545", "0.52028286", "0.519877", "0.5197853", "0.51887804", "0.51651174", "0.5139213...
0.0
-1
End of recursive function to find the timetables // / >>>>>>>>>>>>>>>>>>>>>>
function setRelevantCoursesFirst(courseTypeIndex, constItems) { const moreRelevant = takeRelevantCourses(); // "moreRelevant" contains the marked lessons that should be in first priority while (moreRelevant.length) { var tmp = moreRelevant.pop(); var index = constItems.indexOf(tmp); if (index !== -1) { // Enter the "if" statement only if the marked course appear in "constItems" if (!courseTypeIndex.includes(index)) { // If temp index apear in "courseTypeIndex" => he already will be taken first var curr = 0, prev = 0; for (var i = 0; i < courseTypeIndex.length; i++) { //In this loop we find the closer index in "course TypeIndex" that smaller than "index" (tmp index) curr = courseTypeIndex[i]; if (prev < index && curr > index) break; prev = curr; } [constItems[index], constItems[prev]] = [constItems[prev], constItems[index]]; // make the swap } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findSchedule() {\n\n clearTimeTableState(); // Remove all the previous timetables \n\n // Validation for start & end time to each day\n for (var val of constStartEnd) {\n if (val.start !== \"\" && val.end !== \"\") {\n if (parseInt(val.start) > parseInt(val.end)) {\n alert(\"...
[ "0.67265695", "0.6258476", "0.61203283", "0.5742033", "0.5632289", "0.55477273", "0.5490696", "0.5466132", "0.5465236", "0.544087", "0.542335", "0.54020905", "0.5401708", "0.5382085", "0.53780645", "0.53596437", "0.5343224", "0.5311349", "0.5303155", "0.52903974", "0.52884704...
0.0
-1
================================ End Algorithem To Find TimeTables ================================== // ================================ Start Take input from .html file of Braude WebSite ==================================
function addCourseBasedOnScrap(event) { var file = event.target.files[0]; if (file === undefined) { return; } var reader = new FileReader(); reader.onload = function (event) { // The file's text will be printed here let inputAsText = event.target.result; let course = { // The Object that will be contained in "items" array courseName: "", lecturerName: "", typeOfCourse: "", days: [], beginningTime: [], duration: [] }; let copyFrom, paste, tmp; course.courseName = inputAsText.substring(inputAsText.indexOf('<link rel="stylesheet" href="./') + 31, inputAsText.indexOf("_files/")); while ((tmp = inputAsText.indexOf("<b>")) != -1) { inputAsText = inputAsText.slice(tmp + 3); course.typeOfCourse = inputAsText.substring(0, inputAsText.indexOf("</b>")); // This section might be problematic in case we got more than one type that not includes in coursesTypes ---> if (!coursesTypes.includes(course.typeOfCourse)) { course.typeOfCourse = coursesTypes[3]; // if the type in not "הרצאה, תרגיל , מעבדה או אחר" put "אחר" in type } // <---- End of problematic section inputAsText = inputAsText.slice(inputAsText.indexOf("<b>") + 3); var _timer = Date.now(); for (var i = 0; (inputAsText.indexOf("<b>") > (copyFrom = inputAsText.indexOf("<td>&nbsp;")) || (inputAsText.indexOf("<b>") === -1 && copyFrom !== -1)) && copyFrom !== -1; i++) { inputAsText = inputAsText.slice(copyFrom + 10); paste = inputAsText.substring(0, inputAsText.indexOf("</td>")); switch (i % 5) { case 0: break; case 1: course.days.push(cDay(paste)); break; case 2: course.beginningTime.push(paste); break; case 3: course.duration.push(parseInt(paste) - parseInt(course.beginningTime[parseInt(i / 5)])); // can also write course.beginningTime.length - 1 insted of i / 5 break; case 4: course.lecturerName = paste; break; // default is useless here because i is an integer and (i % 5) cant be different than 0,1,2,3,4 } if(Date.now() - _timer > 5000) break; } if (course.days.length !== course.duration.length || course.days[0] === undefined) { alert("קיים חשש לקריאת נתונים שגויה מהקובץ!"); } else { // In case that cDay did not succeed to convert well : for(var i = 0; i < course.days.length ; i++){ if(course.days[i] === undefined || course.beginningTime[i] === undefined) return; } var existedCourse = false; for (const x of items) { // Checks if this lesson already exist in "items" if (isEquivalent(course, x)) existedCourse = true; } if (!existedCourse) { // Adding lesson addItem(JSON.parse(JSON.stringify(course))); } } // Reset the array before we are taking the next lesson: course.days = []; course.duration = []; course.beginningTime = []; course.lecturerName = ""; course.typeOfCourse = ""; } } reader.readAsText(file); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseHtmlResults(html, callback) {\n var cheerio = require(\"cheerio\"),\n $ = cheerio.load(html);\n if ($(\".page404\").length > 0) {\n callback({\"error\": \"Times not found\", \"status\": 404});\n } else {\n var times = []\n $(\"tbody > tr\").each(function(i, tr){\n var time = {\n ...
[ "0.5666792", "0.5658094", "0.56336904", "0.56146866", "0.5586195", "0.55497205", "0.55481166", "0.55030805", "0.5487592", "0.5481867", "0.5470393", "0.54668355", "0.5424579", "0.5407747", "0.537692", "0.53762496", "0.5349278", "0.5343973", "0.53131443", "0.52939814", "0.52600...
0.5046722
56
Function that tracks a click on an outbound link in Google Analytics. This function takes a valid URL string as an argument, and uses that URL string as the event label. Setting the transport method to 'beacon' lets the hit be sent using 'navigator.sendBeacon' in browser that support it.
function trackOutboundLink (url, post_name, editor) { // ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]); ga('send', 'event', 'outbound', post_name, url, { 'transport': 'beacon', // If opening a link in the current window, this opens the url AFTER // registering the hit with Analytics. Disabled because here want the // link to open in a new window, so this hit can occur in the current tab. //'hitCallback': function(){document.location = url;} }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _trackOutbound() {\n $(document).on(\"click\", \"a\", function(e) {\n e.currentTarget.hostname === \"cors.bicrement.com\" ||\n planner.trackPageView(e.currentTarget.href, \"outbound\");\n });\n }", "function trackOutbound(obj, category, value) {\n\n\tvalue = ty...
[ "0.60660326", "0.56870353", "0.55411625", "0.5434693", "0.5383314", "0.5344997", "0.5307008", "0.52630657", "0.52429956", "0.52203953", "0.5144375", "0.5043849", "0.5037569", "0.5031466", "0.50244284", "0.501435", "0.49832177", "0.49796754", "0.49778265", "0.49626192", "0.495...
0.65727776
0
helper functions used in debug to fetch tile coordinate JSON files
function long2tile(lon,zoom) { return (Math.floor((lon+180)/360*Math.pow(2,zoom))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "parseJSONDataIntoObject(data) {\n let tiledMapData = {};\n // get basic map data\n tiledMapData.mapWidth = data.width;\n tiledMapData.mapHeight = data.height;\n tiledMapData.tileWidth = data.tilewidth;\n tiledMapData.tileHeight = data.tileheight;\n // get layer data...
[ "0.62650126", "0.6223749", "0.6179386", "0.5949959", "0.59471756", "0.5941059", "0.5871947", "0.57908034", "0.5756904", "0.57501787", "0.57431453", "0.570822", "0.5684779", "0.5680142", "0.56798685", "0.5674684", "0.56595606", "0.5627377", "0.56173456", "0.55867195", "0.55770...
0.0
-1
detect webgl on browser for Tangram
function hasWebGL() { try { var canvas = document.createElement('canvas'); return !!(window.WebGLRenderingContext && (canvas.getContext('webgl') || canvas.getContext('experimental-webgl'))); } catch (x) { return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SigmaEnableWebGL() { return null }", "function DetectaWebkit(){\n\n if (uagent.search(engineWebKit) > -1)\n\n return true;\n\n else\n\n return false;\n\n}", "function initWebGL() {\n gl = null;\n\n try {\n gl = canvas.getContext(Constants.WEBGL_CANVAS_CONTEXT);\n } catch (e) {\n ...
[ "0.6383144", "0.61911756", "0.6122595", "0.60167414", "0.59835273", "0.5957747", "0.59243536", "0.5908307", "0.590394", "0.58995456", "0.5872157", "0.5858201", "0.5822352", "0.5822352", "0.5820203", "0.5802663", "0.5785441", "0.578254", "0.5767983", "0.57411623", "0.5717669",...
0.63417584
1
LS way instead of looping the string, it loops the object keys and replace any word in the string that matches Object's key with value please note on how they use "new RegExp(pattern, attributes)"
function wordToDigit2(string) { let newString = string; Object.keys(obj).forEach(element => { let regex = new RegExp('\\b' + element + '\\b', 'gi'); // note on using 'g' atttributes to replace all matching cases. // note on using '\\b' + element '\\b' in orer to hande where a number word is a prt of another word newString = newString.replace(regex, obj[element]); }); return newString; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "replace(string, object) {\n const keys = Object.keys(object);\n keys.forEach(key => {\n // checks that key starts with a letter, to ignore array sets and numbers\n // ! I intended to flesh this out more, however a typeof check would be more concise\n if (key.charAt(0).match(/[a-zA...
[ "0.8055007", "0.7607977", "0.6969304", "0.6256213", "0.62002677", "0.62002677", "0.61851907", "0.61833113", "0.6178626", "0.61555505", "0.61297005", "0.6076331", "0.6006186", "0.5988335", "0.59090614", "0.5888413", "0.5857047", "0.5821351", "0.5818139", "0.563931", "0.5622796...
0.54882294
25
"Please call me at 5 5 5 1 2 3 4. Thanks." LS way 2
function wordToDigit3(words) { const NUMBERS = { zero: 0, one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, }; return words.replace(/\w+/g, (word) => { const key = word.toLowerCase(); return Object.keys(NUMBERS).includes(key) ? NUMBERS[key] : word; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lookAndSay (n) {\n strArr = n.toString().split(\"\");\n \n let i = 0;\n let count = 1;\n let result = [];\n \n while(i < strArr.length){\n if(strArr[i+1] == strArr[i]) {\n count ++;\n i++;\n }\n if(strArr[i+1] !== strArr[i]){\n result.push(count);\n ...
[ "0.62827116", "0.6095803", "0.6054275", "0.6000948", "0.5989036", "0.5977458", "0.5921843", "0.5867866", "0.58497125", "0.58284944", "0.58203435", "0.57891226", "0.5788695", "0.5784278", "0.57697946", "0.57637095", "0.57546794", "0.57428575", "0.5738198", "0.57307255", "0.572...
0.0
-1
"Please call me at 5 5 5 1 2 3 4. Thanks." myway
function wordToDigit(string) { return string.split(' ').map(element => { if(Object.keys(obj).includes(element)) { return element = obj[element]; } else if (element[element.length - 1] === '.' && Object.keys(obj).includes(element.slice(0, -1))) { return element = String(obj[element.slice(0, -1)]) + '.'; } else{ return element; }}).join(' '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lookAndSay (n) {\n strArr = n.toString().split(\"\");\n \n let i = 0;\n let count = 1;\n let result = [];\n \n while(i < strArr.length){\n if(strArr[i+1] == strArr[i]) {\n count ++;\n i++;\n }\n if(strArr[i+1] !== strArr[i]){\n result.push(count);\n ...
[ "0.62086177", "0.6027145", "0.6003836", "0.5987632", "0.58612615", "0.5852406", "0.58510095", "0.5769128", "0.5657762", "0.5656811", "0.5649842", "0.564902", "0.56408525", "0.56228536", "0.5614508", "0.5609134", "0.5604527", "0.5595492", "0.55722857", "0.5567338", "0.55500764...
0.0
-1
Not logged in, direct to login. Otherwise, get team and populate
function checkUserLogin() { if (!user) { loginWithRedirect() } else { getUserTeam(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static async getLogin(ctx) {\n const context = ctx.flash.formdata || {};\n\n // user=email querystring?\n if (ctx.request.query.user) context.username = ctx.request.query.user;\n\n if (context.username) {\n // if username set & user has access to more than one org'n, show lis...
[ "0.6484081", "0.6194976", "0.6163025", "0.60862076", "0.6072617", "0.6015066", "0.6012523", "0.5932712", "0.5813331", "0.5787819", "0.56803435", "0.56795216", "0.56619334", "0.5660869", "0.5656791", "0.564688", "0.56214213", "0.56096053", "0.5596364", "0.55903596", "0.556241"...
0.6798055
0
Call teamPlayers data from the database. Sets owner key in team.
function getUserTeam() { API.getTeam(user.email) .then(res => { if (res.data != null) { setTeam(res.data) setTeamPlayers(res.data.players); } }) .catch(err => console.log(err)) setTeam({ ...team, owner: user.email }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async players(ctx) {\n console.log('Controller HIT: DataCenterController::Players');\n return new Promise((resolve, reject) => {\n const query = ' SELECT * FROM Players;';\n \n chpConnection.query(query, (err, res) => {\n if(err) {\n ...
[ "0.63067526", "0.58964217", "0.57793474", "0.57639843", "0.5645174", "0.5645174", "0.5621735", "0.55725837", "0.5532105", "0.55161154", "0.5488687", "0.5486576", "0.5469855", "0.5461198", "0.5459876", "0.5456407", "0.5449322", "0.5431864", "0.5428586", "0.5391763", "0.5390701...
0.65147287
0
Create a new team if no team exists, save to db.
function createTeam(e) { e.preventDefault() API.createNewTeam(team) .then(res => window.location.reload()) .catch(err => console.log(err)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveTeam() {\n vm.form.submitted = true;\n\n if (vm.form.$invalid) {\n return;\n }\n\n // Update or create new team.\n var req;\n if (vm.team.id > 0) {\n req = updateTeam();\n }\n else {\n...
[ "0.72246903", "0.71770334", "0.7149476", "0.7060649", "0.6918302", "0.67428374", "0.66041994", "0.65756416", "0.6554716", "0.65324944", "0.6425415", "0.6311836", "0.622515", "0.61597687", "0.6046412", "0.6044724", "0.5959759", "0.5953306", "0.5907466", "0.5899123", "0.5878974...
0.68544525
5
Performs Select all data query in ticket statuses database model and return the data
function fetTicketStatuses(){ return new Promise( async(resolve, reject)=>{ try { const ticket_status_con = await ticket_status_model(); ticket_status_con.find() .then((data) => { resolve(data); }) .catch(err => { logger.error(err, "An issue occured while fetching ticket status"); reject(); }) } catch (error) { logger.error(error, "An issue occured while fetching ticket status"); reject(); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async show() {\n // select * from ticket\n const result = await this.app.mysql.select('ticket', {\n orders: [['id','desc']],\n limit: 6,\n offset: 0,\n });\n\n return result;\n }", "@action getAllStatusesFromTicketHistoryResult() {\n return t...
[ "0.62521213", "0.62075675", "0.61357087", "0.5934254", "0.5931061", "0.58963233", "0.58078134", "0.5792182", "0.5772489", "0.57696855", "0.5749202", "0.5738866", "0.5738866", "0.570423", "0.5669568", "0.56635076", "0.5659946", "0.56142455", "0.56040865", "0.5597526", "0.55667...
0.70864195
0
FUNCIONES PARA EL CARRITO VACIO
function siCarritoVacio () { if ($("#productosCarrito").children().length== 0){ mostrarMensaje("El carrito está vacío"); desactivarBotones("btn-finalizar"); total=0; mostrarTotal(); } }
{ "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 condiçaoVitoria(){}", "nuevoCiclo() {\n let suma = 0;\n for (let i = 0; i < this.ve...
[ "0.69705135", "0.6545557", "0.64169806", "0.63626295", "0.6352939", "0.63441545", "0.62787026", "0.6277633", "0.62582785", "0.62499845", "0.6239276", "0.6222507", "0.61964077", "0.61819446", "0.61759067", "0.6168683", "0.61666125", "0.61652184", "0.61478853", "0.6147557", "0....
0.0
-1
Muestro alerts en el carrito
function mostrarMensaje (mensaje){ $("#productosCarrito").append(`<div class="mensaje"> <div class="text-center mt-4 mb-4"> <strong>${mensaje}</strong> </div> </div>`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mensajes(respuesta){\n\n\t\t\t\tvar foo = respuesta;\n\n\t\t\t\t\tswitch (foo) {\n\n\t\t\t\t\t\tcase \"no_exite_session\":\n\t\t\t\t\t\t//============================caso 1 NO EXISTE SESSION==================//\n\t\t\t\t\t\tswal(\n\t\t\t\t\t\t\t\t'Antes de comprar Inicia tu Session en la Pagina?',\n\t\t\t...
[ "0.67966765", "0.66768086", "0.6472352", "0.6385825", "0.63816965", "0.63467294", "0.6321607", "0.63141346", "0.62986434", "0.62855035", "0.62819326", "0.6272388", "0.6222822", "0.6220569", "0.6208732", "0.6161861", "0.61617136", "0.6154373", "0.6121883", "0.61205333", "0.610...
0.0
-1
Muestro en el modal el total del carrito en el modal
function mostrarTotal (){ $("#total").html(`Total: $${total}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function valorTotal(){\n\t\t$.post(APP +'/'+$('#role').val()+\"/item_pedidos/valorTotal\",{ \n\t\t\t},function(data){ \n\t\t\t\t//alert(data.valorTotal)\n\t\t\t\t$('.valorTotal').html(data.valorTotal);\n\t\t\t\t$('.valorArredondamento').html(data.valorArredondamento);\n\t\t\t},'json');\n\t}", "function UpdateTo...
[ "0.7466387", "0.7304474", "0.712604", "0.7110406", "0.705634", "0.700759", "0.6848637", "0.68278414", "0.6824448", "0.68147486", "0.68089384", "0.6804628", "0.6781141", "0.67393804", "0.6738369", "0.6702406", "0.66581297", "0.6656123", "0.6650774", "0.66452104", "0.6638086", ...
0.7026459
5
FUNCIONES PARA AGREGAR PRODUCTOS AL CARRITO
function agregarAlCarrito(e) { if($("#formularioEnvio").length===0){ let producto; if($(e.target).attr("id")!=undefined){ producto=arrayProductos.find(elemento=>elemento.nombre == $(e.target).attr("id").split("A")[0]); }else{ producto = arrayProductos.find(elemento=>elemento.nombre == $(e.target).children().attr("id").split("A")[0]); } producto.actualizarStock(1); if ($("#btn-finalizar").hasClass("disabled") && producto.stock>=0){ activarBotones("btn-finalizar") $("#productosCarrito").empty(); } if(producto.stock>=0){ total = total + producto.precio; arrayCarrito.push(producto.nombre); mostrarTotal(); mostrarProductoEnCarrito(producto); if(producto.stock===0){ $(`#${producto.nombre}CardproductosDestacados`).css("opacity", 0.5) $(`#${producto.nombre}CardgrillaProductos`).css("opacity", 0.5) } }else { swal("Lo sentimos. No tenemos stock en este momento"); producto.stock = 0; total = total; } } return total; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function leerDatosProductos(producto){\n const infoProducto = {\n img: producto.querySelector('.imagen').src,\n titulo: producto.querySelector('#title-product').textContent,\n cantidad: producto.querySelector('#cantidad').value,\n precio: producto.querySelector('#precio').textCo...
[ "0.6754991", "0.6659073", "0.66513973", "0.6485145", "0.6240765", "0.6197016", "0.6170657", "0.61460227", "0.6145843", "0.6127857", "0.6096415", "0.6092482", "0.60770154", "0.6062804", "0.60507464", "0.6050139", "0.6042259", "0.6000001", "0.59990835", "0.59914577", "0.5958649...
0.6253767
4
Genero en el HMTL las cards del carrito
function mostrarProductoEnCarrito(producto){ let cantidad=arrayCarrito.filter(el => el === producto.nombre).length; if($(`#${producto.nombre}EnCarrito`).length!=0){ $(`#${producto.nombre}Cantidad`).children().html(`Cantidad: ${cantidad}`) $(`#${producto.nombre}Precio`).html(`$${producto.precio*cantidad}`) }else{ $("#productosCarrito").append(`<div class="card mb-1 row g-0 p-2 align-" style="max-width:540px" id="${producto.nombre}EnCarrito"> <div class="row g-0"> <div class="col-3"> <img src="images/${producto.nombre.toLowerCase()}.png" class="img-fluid rounded-start" alt="..."> </div> <div class="col-5"> <div class="card-body"> <h6 class="card-title">${producto.nombre.split(/(?=[A-Z])/).join(" ").toUpperCase()}</h6> <p class="card-text" id="${producto.nombre}Cantidad"><small class="text-muted">Cantidad: ${cantidad}</small></p> </div> </div> <div class="col-3 card-body mt-4"> <p class="text-center" id="${producto.nombre}Precio">$${producto.precio*cantidad}</p> </div> <div class="col-1 mt-4 pt-1"> <button type="button" class="btn px-0" id="${producto.nombre}Eliminar"><i class="bi bi-trash tamanoIcono"></i></button> </div> </div> </div>`) $(`#${producto.nombre}Eliminar`).click(borrarDelCarrito); } $("#numBadge").html(`${arrayCarrito.length}`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function genarateCards(){\n const cardHTMLArray = [];\n\n CARD_NAMES.forEach((name, index) => {\n const imageCardHTML = `\n <div class=\"card\" data-id=\"${index}\">\n <div class=\"front-face face\"><img src=\"assets/images/${name}.jpg\"></div> \n <div class=\"back-face face\"><...
[ "0.7789381", "0.77679235", "0.7576371", "0.7540592", "0.74964964", "0.7482411", "0.74502325", "0.74221843", "0.74174464", "0.74105227", "0.73987544", "0.73608273", "0.734406", "0.7314713", "0.73114216", "0.73058397", "0.72938925", "0.72897154", "0.72730935", "0.72431624", "0....
0.0
-1
FUNCIONES PARA ELIMINAR PRODUCTOS DEL CARRITO
function borrarDelCarrito (e){ let producto = arrayProductos.find(elemento => elemento.nombre==$(e.target).parent().attr("id").split("Eli")[0]); let cantidad = arrayCarrito.filter(el => el === producto.nombre).length; producto.stock= producto.stock + cantidad; if (producto.stock>0){ $(`#${producto.nombre}CardproductosDestacados`).css("opacity", 1); $(`#${producto.nombre}CardgrillaProductos`).css("opacity", 1); } total = total - producto.precio*cantidad; arrayCarrito = arrayCarrito.filter(el => el != producto.nombre); $("#numBadge").html(`${arrayCarrito.length}`); mostrarTotal(); $(`#${producto.nombre}EnCarrito`).css({"background-color": "#E8F5E9", "border-color": " #007E33"}) .animate(({width: '110%', margin: '-1.25rem'})); $(`#${producto.nombre}EnCarrito`).slideUp("slow", function () { $(`#${producto.nombre}EnCarrito`).remove(); siCarritoVacio(); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function leerDatosProductos(producto){\n const infoProducto = {\n img: producto.querySelector('.imagen').src,\n titulo: producto.querySelector('#title-product').textContent,\n cantidad: producto.querySelector('#cantidad').value,\n precio: producto.querySelector('#precio').textCo...
[ "0.67185676", "0.6597392", "0.65962934", "0.64101875", "0.63541603", "0.630674", "0.6299472", "0.62576306", "0.62276095", "0.62207085", "0.6218994", "0.62092125", "0.6183613", "0.61809325", "0.61748827", "0.61581534", "0.6154929", "0.61548257", "0.6135215", "0.6117356", "0.61...
0.0
-1
FUNCIONES PARA CONFIRMAR LA COMPRA
function finalizarCompra(e){ localStorage.setItem("compra", JSON.stringify(arrayCarrito)); arrayCarrito=[]; $("#productosCarrito").empty(); modificarBotones("volver", "pagar", "seguir-comprando", "finalizar"); total = descuento(total); mostrarTotal(); preguntarEnvío(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function irAAgregarMaestro(){\r\n\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\tif(confirm(msg)) Cons_maestro(\"\", \"agregar\",tabla,titulo);\r\n}", "function confirmarTransaccion(mensaje) {\n\n return confirm(mensaje);\n\n }", "function comprobar_envio(mensaje) {\n\tif (confirm(mensaje))\n\t\tr...
[ "0.7111411", "0.69920313", "0.6863393", "0.6844784", "0.6775234", "0.6774704", "0.6720778", "0.67023724", "0.66662663", "0.66360956", "0.66295964", "0.6616987", "0.6607308", "0.65815276", "0.65044326", "0.6499388", "0.64900196", "0.648354", "0.64804333", "0.6458809", "0.64320...
0.0
-1
Modifica botones del modal
function modificarBotones (btn1, btn2, btn3, btn4){ $(`#btn-${btn1}`).removeClass("d-none"); $(`#btn-${btn2}`).removeClass("d-none"); $(`#btn-${btn3}`).addClass("d-none"); $(`#btn-${btn4}`).addClass("d-none"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function set_modal_data(i, bot){\n var q = \"\";\n $.each(bot.cmd_queue, function(j, cmd){\n q += j+1 + \". \" + cmd + \"\\n\";\n });\n $('#cmdq').html(q);\n $('#botid').val(i);\n $('#lastResponse').html(\"Current Command: \" + bot.current_command + \"\\nLast Command: \" + bot.last_command...
[ "0.64325196", "0.6355082", "0.6281209", "0.62606525", "0.6255312", "0.6246868", "0.62259394", "0.6210358", "0.620391", "0.6194906", "0.61868465", "0.61864847", "0.6181811", "0.61647296", "0.61598176", "0.61511564", "0.6141054", "0.61103827", "0.6106839", "0.61058307", "0.6087...
0.0
-1