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
Add New Employee Role
function addRole() { connection.query("SELECT role.title AS Title, role.salary AS Salary FROM role", function (err, res) { inquirer.prompt([ { name: "Title", type: "input", message: "What is the title for this role?" }, { name: "Salary", type: "input", message: "What is the salary?" } ]).then(function (res) { connection.query( "INSERT INTO role SET ?", { title: res.Title, salary: res.Salary, }, function (err) { if (err) throw err console.table(res); search(); } ) }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function addRole() {\n const departments = await db.findAllDepartments();\n const departmentChoices = departments.map(({\n id,\n name\n }) => ({\n name: name,\n value: id,\n }));\n const role = await prompt([{\n name: \"title\",\n message: \"what is the name of the role?\"\n },\...
[ "0.7386285", "0.73456043", "0.72563773", "0.72441345", "0.7221952", "0.71792287", "0.71648276", "0.71162015", "0.7024098", "0.7009604", "0.6980438", "0.6955104", "0.69191486", "0.69058406", "0.690205", "0.69010687", "0.68701094", "0.6848944", "0.6837454", "0.6818353", "0.6794...
0.0
-1
TODO amory: get team listing from Google Groups instead so that this can stay in sync.
function getTeams() { return [{ "channel": "learner-red-pandas", "oneOnOneEmails": [ "aschlender@coursera.org", "jn@coursera.org", "aahuja@coursera.org", "gschuller@coursera.org", "jkostiukova@coursera.org", "kchen@coursera.org", "ksun@coursera.org", "rbenkar@coursera.org", "sgogia@coursera.org", "wbowers@coursera.org", "billy@coursera.org", "cchen@coursera.org", "jkim@coursera.org", "ahickey@coursera.org", "mlazer@coursera.org", "stanleyfung@coursera.org", "pxu@coursera.org", "msingh@coursera.org" ], "lunchEmails": [ "aschlender@coursera.org", "jn@coursera.org", "aahuja@coursera.org", "gschuller@coursera.org", "jkostiukova@coursera.org", "kchen@coursera.org", "ksun@coursera.org", "rbenkar@coursera.org", "sgogia@coursera.org", "wbowers@coursera.org", "billy@coursera.org", "cchen@coursera.org", "jkim@coursera.org", "mustafa@coursera.org", "stanleyfung@coursera.org", "pxu@coursera.org", "msingh@coursera.org" ] }] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTeamList() {\n if (\"caches\" in window) {\n caches.match(ENDPOINT_EPL + \"teams\").then(function (response) {\n if (response) {\n response.json().then(function (data) {\n showTeamList(data);\n })\n }\n })\n }\n\...
[ "0.7275688", "0.69188476", "0.68264294", "0.67054564", "0.6695281", "0.66427034", "0.6642136", "0.6607248", "0.6599728", "0.6587166", "0.65654695", "0.656089", "0.65212804", "0.6480112", "0.6442994", "0.6440584", "0.64404196", "0.6414064", "0.6412702", "0.6412594", "0.6408762...
0.6400965
21
/ This will consume any overflow in the time accumulated from 'UpdateTime' in 'FixedTimeStep' chunks. / The passed functoin will be invoked for each consumed chunk. This allows us to catch up with any / fraction portions of our fixed time step that overflowed during the normal update cycle.
static ConsumeAccumulatedTime(func) { let stepped = 0; let stepRate = FIXED_TIME_STEP; while(Time._accu >= stepRate) { stepped++; func(); Time._accu -= stepRate; //this is a safety feature to ensure we never take longer than an allowed maximum time. if(Time._time - Time._lastTime > MAX_TIME_STEP) { Time._accu = 0; return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(timeStep) {\n\n }", "function timeStepUpdate() {\n if (incrementing == false) {\n incrementing = true;\n setTimeout(function () {\n time += 1;\n incrementing = false;\n }, timeStep * 1000);\n }\n}", "_processTick(tickTime, ticks) {\n // do t...
[ "0.5634498", "0.50159085", "0.49622566", "0.49606362", "0.48251945", "0.48162657", "0.48135534", "0.48130465", "0.47721896", "0.47691166", "0.47629115", "0.47433683", "0.4713767", "0.47011852", "0.46780702", "0.4674049", "0.4664973", "0.46626997", "0.4643626", "0.463386", "0....
0.55785924
1
x,y determines a hex, d determines the vertex of the hex Two values for d: WEST or NORTHWEST
function dispAtVertex(text, context, x, y, d) { var xcoord = 0; var ycoord = 0; //FIXME: Retool this, it doesn't actually ensure correctness. //or remove /*if (x < 0 || y < 0 || x > 11 || y > 11) { // invalid coords! console.warn("Invalid drawing coords in dispAtVertex!"); return -1; }*/ var coords = getVertexCoords(x,y,d); xcoord = coords[0]; ycoord = coords[1]; //console.log("displaying vertex at " + xcoord +"," + ycoord); context.fillStyle = 'rgb(0,0,0)'; context.font = '12px sans-serif'; context.fillText(text, xcoord, ycoord); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hexagon(x,y, r) {\r\n push();\r\n translate(x,y);\r\n beginShape();\r\n vertex(r,0);\r\n vertex(r*0.5,r*0.8660254);\r\n vertex(-r*0.5,r*0.8660254);\r\n vertex(-r,0);\r\n vertex(-r*0.5,-r*0.8660254);\r\n vertex(r*0.5,-r*0.8660254);\r\n endShape(CLOSE);\r\n pop();\r\n}", "hexToPixel( h ) {\n ...
[ "0.649759", "0.6325801", "0.62253255", "0.6198931", "0.61895376", "0.6178534", "0.61471224", "0.61114234", "0.60959464", "0.60959464", "0.5987963", "0.59076685", "0.5860176", "0.58549345", "0.5834054", "0.5831968", "0.5829414", "0.5815573", "0.5809667", "0.5804342", "0.580434...
0.0
-1
gives the pixel coordinates of the upper left hand corner of the square containing the hexagon to be drawn. Note that this pixel location is not actually inside the hexagon.
function getPixelCoords(x,y) { var xcoord = 0; var ycoord = 0; ycoord = 0.5 * (3 - x) * SCALE_HEIGHT + y * SCALE_HEIGHT; xcoord = (SCALE_WIDTH - SCALE_OFFSET) * x; ycoord += .5 * SCALE_HEIGHT; xcoord += SCALE_WIDTH - SCALE_OFFSET; return [xcoord, ycoord]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getHexCornerCoord( center, i ) {\n // KEY pointy or flat\n\n // flat\n // let angleDeg = 60 * i\n\n // pointy\n let angleDeg = 60 * i + 30\n\n let angleRad = Math.PI / 180 * angleDeg\n let x = center.x + this.state.hexSize * Math.cos( angleRad )\n let y = cen...
[ "0.65818816", "0.65176773", "0.6458529", "0.632223", "0.62293106", "0.6013692", "0.59704685", "0.59650815", "0.5955957", "0.5939201", "0.5933498", "0.5930881", "0.5928821", "0.59219396", "0.5915608", "0.58978283", "0.58835167", "0.5845123", "0.58370817", "0.58347845", "0.5828...
0.0
-1
(0,0) is measured as the northwest most piece on the board. TODO: Make this not draw things in the lower right hand corner
function drawHexAt(img, context, hexNum, x, y) { var xcoord = 0; var ycoord = 0; var coords = getPixelCoords(x,y); xcoord = coords[0]; ycoord = coords[1]; context.drawImage(img, TILE_WIDTH * hexNum, 0, TILE_WIDTH, TILE_HEIGHT, xcoord, ycoord, SCALE_WIDTH, SCALE_HEIGHT); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rePosition(){\r\n piece.pos.y = 0; // this and next line puts the next piece at the top centered\r\n piece.pos.x = ( (arena[0].length / 2) | 0) - ( (piece.matrix[0].length / 2) | 0);\r\n }", "function detectNextBlock_CornerDownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n ...
[ "0.63492", "0.63269633", "0.63209003", "0.62994176", "0.6282236", "0.62648076", "0.62557524", "0.62143517", "0.6188328", "0.61363137", "0.6107528", "0.607399", "0.60506564", "0.6042557", "0.60212743", "0.6017665", "0.60079527", "0.60072756", "0.5983221", "0.5980872", "0.59754...
0.0
-1
Once again, we need to create a data structure that can handle large numbers This time, let's create a class for it
function nDigitFibb(n) { class bigNum { constructor(value = 0) { this.num = value.toString().split("").map((digit) => +digit); } getLength() { return this.num.length; } add(num2) { // pad the smaller number with 0's so the digits line up if (this.getLength() < num2.getLength()) { this.num = Array(num2.getLength() - this.getLength()).fill(0).concat(this.num); } else if (this.getLength() > num2.getLength()) { num2.num = Array(this.getLength() - num2.getLength()).fill(0).concat(num2.num); } var carry = 0; var newNum = []; for (let i = this.num.length - 1; i >= 0; i--) { var newDigit = this.num[i] + num2.num[i] + carry; newNum.unshift(newDigit % 10); carry = Math.floor(newDigit / 10); } while (carry > 0) { newNum.unshift(carry % 10); carry = Math.floor(carry / 10); } var sum = new bigNum(); sum.num = newNum; return sum; } } var a = new bigNum(1); var b = new bigNum(1); var c = a.add(b); var count = 3; // var test1 = new bigNum(8); // var test2 = new bigNum(13); // var test3 = test1.add(test2); // console.log(test3); while (c.getLength() < n) { a = b; b = c; c = a.add(b); count++; } return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(n, p, r) {\n var o = this, i;\n\n if (JQX.Utilities.BigNumber.bigIntSupport) {\n if (n instanceof JQX.Utilities.BigNumber) {\n if (Array.isArray(n._d)) {\n n = (n._s ? '-' : '') + (n._d.slice(0, n._f).join('') || '0') + (n._f != n._d.length ? '...
[ "0.65659046", "0.65258074", "0.65258074", "0.626205", "0.6250921", "0.6239402", "0.6217185", "0.6197913", "0.617068", "0.617068", "0.61600167", "0.6112274", "0.6112274", "0.60709", "0.60119915", "0.5917327", "0.5898823", "0.5898823", "0.5898823", "0.5898823", "0.5898823", "...
0.58026785
23
Minor Programmeren Finalproject Musicvisualization // // Name: Noam Rubin // Studentnumber: 10800565 // // 27 06 2018 // // This script lets the user load a mp3 file and // updates the visualization // //
function uploadFile() { /* lets user upload a file and updates charts*/ // substract variables from html const realFileButton = document.getElementById("real-file"); const customButton = document.getElementById("custom-button"); const customText = document.getElementById("custom-text"); // activate realfilebutton when custombutton is clicked customButton.addEventListener("click", function() { realFileButton.click(); }); // if value realfilebutton changes realFileButton.addEventListener("change", function() { // if a file is chosen if (realFileButton.value) { // show filename customText.innerHTML = document.getElementById("real-file").files[0].name // update chart with new data var properties = playAudio(customText.innerHTML); // substract properties audio file context = properties[0] source = properties[1] analyserNode = properties[2]; // create frequencyArray and fill it frequencyArray = new Uint8Array(analyserNode.frequencyBinCount); analyserNode.getByteFrequencyData(frequencyArray); // create frequency barchart createBarChart(analyserNode); // create circle chart createCircleChart(analyserNode); // create linegraph startLineContext(analyserNode); // run synthesizer synthesizer(context, source); } // if file is not chosen yet else { // show customText.innerHTML = "File not chosen"; }; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function musicMainScreen() {\n //Get the file and play it\n}", "function loadMusic( music ) {\n title[0].textContent = music.Name_song\n audio.src = music.path\n coverAlbum.style.backgroundImage = music.cover_song \n imageVolume()\n}", "function readMusic(input) {\r\n if(input.files && input.f...
[ "0.68576103", "0.6848677", "0.6532257", "0.64853764", "0.64853764", "0.6469244", "0.6353492", "0.6349311", "0.63193065", "0.63169926", "0.6299768", "0.6248122", "0.6239355", "0.6223669", "0.6190795", "0.61619973", "0.6152982", "0.6137016", "0.61286", "0.6123768", "0.6117744",...
0.0
-1
alias for sending JSON encoded messages
function send(message) { if(stompClient && stompClient.connected){ stompClient.send("/socket-subscriber/call", {}, JSON.stringify(message)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JSONString(result, message){\r\n\tresult.write(JSON.stringify({quote: message}));\r\n\tresult.end();\t\r\n}", "sendMessage(type, data) {\n const message = { type: type, data: data };\n this.connection.send(JSON.stringify(message)); //La méthode JSON.stringify() convertit une valeur JavaScr...
[ "0.73147666", "0.6862307", "0.65187293", "0.6517685", "0.6491351", "0.64819676", "0.6453755", "0.6423328", "0.6287493", "0.6286235", "0.62554836", "0.6243486", "0.6197506", "0.617119", "0.6155696", "0.6146992", "0.6080151", "0.6080151", "0.60710937", "0.6066764", "0.60534626"...
0.0
-1
const isWindows = process.platform === 'win32'
function createWindow() { mainWindow = new BrowserWindow({ width: 900, height: 680, icon: `${__dirname}/images/logo.png`, titleBarStyle: 'hidden', backgroundColor: '#282c34', darkTheme: true, webPreferences: { nodeIntegration: true, enableRemoteModule: true, }, }) // mainWindow.maximize() mainWindow.menuBarVisible = false // Loading the web application mainWindow.loadURL( isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`, ) if (isDev) { mainWindow.webContents.openDevTools() } mainWindow.once('ready-to-show', () => { if (!mainWindow) { throw new Error('"mainWindow" is not defined') } if (process.env.START_MINIMIZED) { mainWindow.minimize() } else { mainWindow.show() mainWindow.focus() } }) // Open urls in the user's browser mainWindow.webContents.on('new-window', (event, url) => { event.preventDefault() shell.openExternal(url) }) mainWindow.on('closed', () => { mainWindow = null }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isWindows() {\n return process.platform.startsWith(\"win\");\n}", "isWindows() {\n return !!process.platform.match(/^win/);\n }", "isWindowsPlatform() {\n return process.platform.startsWith('win');\n }", "function isWindows() {\n if (!isNode() || !(process && process.platform))\n...
[ "0.94603986", "0.9295414", "0.9134149", "0.87568235", "0.81727165", "0.74788165", "0.74788165", "0.74510986", "0.74510986", "0.743265", "0.7424441", "0.73983884", "0.73940325", "0.7366195", "0.7364052", "0.7219087", "0.71349275", "0.6892083", "0.66629034", "0.6647219", "0.656...
0.0
-1
Zero pad an integer to the specified length.
function padInteger(num, length) { "use strict"; var r = '' + num; while (r.length < length) { r = '0' + r; } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zero_padding(num,length){\n return ('0000000000' + num).slice(-length);\n}", "function pad0(num, len){\r\n\t\t\t\treturn ('0000'+num).split('').reverse().splice(0,len).reverse().join('');\r\n\t\t\t}", "function zeroPad(val, len) {\n return ('00000000' + val).substr(-len);\n }", "functio...
[ "0.8077738", "0.807471", "0.7882664", "0.7766571", "0.77501804", "0.7675339", "0.7675339", "0.7668982", "0.7639093", "0.7619183", "0.7608734", "0.7608734", "0.75990826", "0.7553923", "0.7553889", "0.7543505", "0.7541089", "0.75135636", "0.751268", "0.7509517", "0.7479051", ...
0.7808235
3
Format a date to yyyymmddThhmmssZ (UTC).
function formatDate(d) { "use strict"; var year, month, day, hour, minute, second; year = d.getUTCFullYear(); month = padInteger(d.getUTCMonth() + 1, 2); day = padInteger(d.getUTCDate(), 2); hour = padInteger(d.getUTCHours(), 2); minute = padInteger(d.getUTCMinutes(), 2); second = padInteger(d.getUTCSeconds(), 2); return year + month + day + 'T' + hour + minute + second + 'Z'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateToUTC(d) {\n var arr = [];\n [\n d.getUTCFullYear(), (d.getUTCMonth() + 1), d.getUTCDate(),\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()\n ].forEach(function(n) {\n arr.push((n >= 10) ? n : '0' + n);\n });\n return arr.splice(0, 3).join('-') + '...
[ "0.6826333", "0.67047906", "0.651441", "0.6436641", "0.6324332", "0.6306206", "0.62392205", "0.61832565", "0.6170359", "0.61187994", "0.61064774", "0.61043894", "0.60808337", "0.6071499", "0.6040859", "0.60220987", "0.6017967", "0.59885806", "0.59659344", "0.5942233", "0.5929...
0.65411615
2
Generate a snapshot name given a base.
function snapshotName(base) { "use strict"; var when = formatDate(new Date()); return base + '-' + when; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateUsername(base) {\n base = base.toLowerCase();\n var entries = [];\n var finalName;\n return userDB.allDocs({startkey: base, endkey: base + '\\uffff', include_docs: false})\n .then(function(results){\n if(results.rows.length === 0) {\n return BPromise.resolve(base);...
[ "0.65490043", "0.6277193", "0.6116239", "0.60826117", "0.5952341", "0.5876089", "0.58199483", "0.573663", "0.5692679", "0.5687249", "0.5618089", "0.5602993", "0.5602118", "0.5575302", "0.5533787", "0.5522069", "0.55129623", "0.55129623", "0.55129623", "0.5436213", "0.5373377"...
0.8544114
0
Create a snapshot on the specified dataset with the specified name, exluding all datasets in excl.
function createSnapshot(ds, sn, excl) { "use strict"; function destroyExcludes(snaps, excl) { var toDestroy = snaps.filter(function (s) { var fields = s.name.split('@'); var createdNow = fields[1] === sn; var inExclude = _.contains(excl, fields[0]); return createdNow && inExclude; }); async.forEachSeries(toDestroy, function (snap, cb) { util.log('Destroy snapshot ' + snap.name + ' (excluded)'); zfs.destroy({ name: snap.name, recursive: true }, cb); }); } util.log('Create snapshot ' + ds + '@' + sn); zfs.snapshot({ dataset: ds, name: sn, recursive: true }, function (err) { if (err) { util.log(err); } else { zfs.list({ type: 'snapshot' }, function (err, snaps) { if (err) { util.log(err); } else { destroyExcludes(snaps, excl); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async snap(name) {\n await this.nemo.screenshot.snap(name || 'screenshot')\n }", "takeMemorySnapshot(name) {\n if (!isProfiling) return;\n const snapshot = profiler.takeSnapshot(name);\n const heapFileName = path.join(__dirname, `../../performance/memory/${name}_${(new Date().toISOString())}.heapsna...
[ "0.57099885", "0.49952084", "0.49173602", "0.4823329", "0.48050103", "0.47906417", "0.47362155", "0.47198105", "0.46961048", "0.46948686", "0.4675691", "0.46605006", "0.4631633", "0.46235973", "0.46117425", "0.4595298", "0.45672947", "0.4545511", "0.45219707", "0.4511676", "0...
0.5674466
1
Keep only num snapshots with the specified base on the specified dataset
function cleanSnapshots(ds, base, num) { zfs.list({ type: 'snapshot' }, function (err, snaps) { // Find all snapshots that match the specified dataset and base. var ourSnaps = snaps.filter(function (s) { var fields = s.name.split('@'); var parts = fields[1].split('-'); return fields[0] === ds && parts[0] === base; }); if (ourSnaps.length > num) { // Get just the sorted list of names. var snapNames = ourSnaps.map(function (s) { return s.name; }); snapNames.sort(); // Get the ones that exceed the specified number of snapshots. var toDestroy = snapNames.slice(0, snapNames.length - num); // Destroy them, one after the other. async.forEachSeries(toDestroy, function (sn, cb) { util.log('Destroy snapshot ' + sn + ' (cleaned)'); zfs.destroy({ name: sn, recursive: true }, cb); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pruneAggregated() {\n return Sample.destroy({\n where: { aggregated: false },\n }).then(count => {\n console.log('Pruned %d pre-aggregation samples', count);\n });\n}", "function filterData(dataset) {\n dList = [];\n \n for (i=0; i < dataset.otu_ids.length; i++) { \n // consol...
[ "0.5298788", "0.49141982", "0.4851278", "0.48118484", "0.46582255", "0.4651824", "0.4643439", "0.46391973", "0.46039373", "0.4591683", "0.4539239", "0.4504699", "0.44960055", "0.44899675", "0.4475318", "0.44503573", "0.44395456", "0.443218", "0.43800408", "0.4331613", "0.4324...
0.60423595
0
change view of page
function setPageTo(pageName, doNotPushState = false) { let pages = $(".pages"); let delay = 100, fadePromises = []; let activeIndex = -1; for(let p in self.models.pages){ self.models.pages[p].isActive = p === pageName; if(p === pageName){ activeIndex = Object.keys(self.models.pages).indexOf(p); } // toggle page sections based on isActive let pageSection = pages.find(self.models.pages[p].el); fadePromises.push(new Promise((fulfill,reject) => { pageSection.fadeOut(delay, () => fulfill()); })); } if(activeIndex === -1){ pageName = "Error"; activeIndex = Object.keys(self.models.pages).indexOf(pageName); //default to error page on invalid tab } self.log("activeIndex", activeIndex); self.tabBars.forEach(tabBar => tabBar.activeTabIndex = activeIndex); if(!doNotPushState){ window.history.pushState('pagechange', `JCCC - ${pageName}`, `./?link=${pageName}`); // from https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page } $('title').text(`JCCC - ${pageName}`); return Promise.all(fadePromises) .then(() => { return new Promise((fulfill,reject) => { if(self.models.pages[pageName]){ pages.find(self.models.pages[pageName].el) .animate({ scrollTop: 0 }, 0) .fadeIn(delay, () => fulfill()); }else{ fulfill(); //don't do anything --> may change to showing error page? } }); }).then(() => self.log("Set page to",pageName)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setView(view){\n\t\t\t\tif(this.currentView){\n\t\t\t\t\tthis.currentView.close();\n\t\t\t\t}\n\t\t\t\tthis.currentView = view;\n\t\t\t\t$('#mainContent').html(view.render().$el);\n\t\t\t}", "static view(v) {\n // Add history\n window.history.replaceState(State.preserve(), document.title);...
[ "0.7079589", "0.70540684", "0.69162357", "0.6901261", "0.68437594", "0.6839553", "0.6809734", "0.6743118", "0.66911536", "0.6654995", "0.6650799", "0.6650175", "0.6619408", "0.65656096", "0.65633875", "0.6555766", "0.65324944", "0.6510089", "0.650337", "0.6487248", "0.6444174...
0.0
-1
The unique Id used by omnichat integration to keep retailer in sync with the pipedrive related entry
get pipeDriveOrganizationId() { return this.get('pipeDriveId'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateId() { return this._get_uid() }", "generateId() {\n return `INV-${this.guid()}`;\n }", "id(){\n if(!this.uniqueID){\n var hashids = new Hashids(this.body.substring(0, this.body.length));\n this.uniqueID = hashids.encode([Math.floor(Math.random() * Math.floor(1000))]);\n }\n ...
[ "0.7009648", "0.6920787", "0.68806195", "0.6834801", "0.68126905", "0.68031836", "0.6782387", "0.67252517", "0.6636345", "0.66344", "0.6633762", "0.6618529", "0.6610944", "0.6605844", "0.660432", "0.6552705", "0.65194535", "0.65178496", "0.65169245", "0.65164095", "0.65148973...
0.0
-1
End GC related code A utility function that returns a function that returns a timeout promise of the given value
function weShouldWait(delay) { return function (value) { return WinJS.Promise.timeout(delay). then(function () { return value; }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timeout(t = 0){\n return new Promise((resolve, reject) =>{\n setTimeout(resolve, duration); \n })\n}", "function timeout() {\n return new Promise(function (resolve) {\n setTimeout(resolve, 1);\n });\n }", "function timeout(duration) { // Thanks joews\n return ...
[ "0.692368", "0.6794298", "0.6661205", "0.64586014", "0.6369239", "0.6356154", "0.6314156", "0.6314156", "0.6314156", "0.62891346", "0.62516814", "0.6213788", "0.6203829", "0.61843014", "0.61169535", "0.60962045", "0.6076807", "0.6047119", "0.60334164", "0.6032602", "0.6003052...
0.556977
70
A general purpose asynchronous looping function
function asyncWhile(conditionFunction, workFunction) { function loop() { return WinJS.Promise.as(conditionFunction()). then(function (shouldContinue) { if (shouldContinue) { return WinJS.Promise.as(workFunction()).then(loop); } else { return WinJS.Promise.wrap(); } }); } return loop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loop() {}", "loop() {}", "function asyncLoop(iterations, func, callback) {\nvar index = 0;\nvar done = false;\nvar loop = {\n next: function() {\n if (done) {\n return;\n }\n\n if (index < iterations) {\n index++;\n func(loop);\n\n } else {\n ...
[ "0.72461885", "0.72461885", "0.7172995", "0.70806426", "0.7041076", "0.6972913", "0.6813423", "0.670328", "0.6668472", "0.6651891", "0.6619193", "0.6540084", "0.64790845", "0.64158434", "0.63714194", "0.63507307", "0.62406176", "0.6235394", "0.6219778", "0.6201414", "0.617609...
0.60111964
89
TODO this is ugly, fux it!
function onTask1ButtonClick() { resultPlace.innerHTML = task1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "static final private internal function m106() {}", "transient private protected internal function m182() {}", "transient protected internal ...
[ "0.6259916", "0.60524917", "0.5910974", "0.5601794", "0.5559397", "0.5552204", "0.5447177", "0.53826153", "0.53333807", "0.52727056", "0.5226325", "0.5216695", "0.5129453", "0.50363356", "0.50354457", "0.5033487", "0.49476758", "0.49302447", "0.49243104", "0.4894097", "0.4887...
0.0
-1
Restores select box and checkbox state using the preferences stored in chrome.storage.
function restoreOptions() { console.log('restoreOptions') // Use default value color = 'red' and likesColor = true. chrome.storage.local.get({ maximumSize: 100, }, function(items) { console.log(items) document.getElementById('maximumSize').value = items.maximumSize }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restore_options() {\n $('#options-list input[type=\"checkbox\"]').each(function() {\n var obj = {};\n var check = $(this);\n obj[$(this).attr('id')] = 1;\n chrome.storage.sync.get(obj,\n function(item) {\n $(\"#\" + check.attr('id')).prop(\"checked\", item[check.attr('id')]);\n ...
[ "0.81279916", "0.79553115", "0.79523224", "0.79512316", "0.7809927", "0.78080046", "0.7783688", "0.77806747", "0.77361786", "0.7689198", "0.76792824", "0.76773286", "0.76684135", "0.7657092", "0.76448876", "0.7644227", "0.7636709", "0.7631444", "0.7629365", "0.7624595", "0.75...
0.0
-1
funcion que controla que se muestre el dialogo
function muestra(){ if(!$("#dialogoemergente").dialog("isOpen")){ $("#dialogoemergente").dialog("open"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ConfirmDialog(){\r\n\r\n \r\n \r\n }", "function mostrarDialogoConfirmacion(){\n\t$('#dialog-confirm-001').dialog('open');\n\treturn false;\n}", "function EnviarAviso(){\n\t$(\"#dialogEnviarAviso\").dialog(\"open\");\n}", "function terminaTurnoProduzione(){\r\n \"use strict\";\r\n va...
[ "0.7060399", "0.69042224", "0.68499523", "0.68241924", "0.67973536", "0.672315", "0.6715193", "0.67069167", "0.66626483", "0.6587793", "0.6583492", "0.6580355", "0.65671825", "0.6523991", "0.6501562", "0.64727396", "0.643945", "0.6425483", "0.64140314", "0.6410298", "0.640799...
0.68879086
2
Funcion para que se envien los datos mediante submit (que es lo que enlaza con php)
function enviaPHP() { var nombreusuario=$("#user").val(); var passusuario=$("#contra").val(); if(nombreusuario=="" || passusuario==""){//comprovamos que no sean campos vacios $("#errores").html("Todos los campos deben estar completos.");//si están vacios sacamos un mensaje por pantalla en el div "errores" $( "#shake" ).effect( "shake",{distance: 10},2000,oculta);//hacermos el efecto shake }else{ $("#loginsusuario").submit();//lo enviamos a la página de php para que compruebe en el servidor si el usuario existe } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSubmit(ev) {\n ev.preventDefault()\n console.log(`Iniciando submit`)\n\n if (!validacionFinal(aNodosValidables)) {\n return\n }\n aFormData.forEach(item => oDatos[item.name] = item.value)\n aCheckBox.forEach(item => oDatos[item.name] = item.checked)\n...
[ "0.69497025", "0.6778406", "0.66608065", "0.6570415", "0.6566612", "0.65514815", "0.6518139", "0.6515592", "0.65046453", "0.65041554", "0.6488728", "0.6485158", "0.6482255", "0.64678127", "0.64580643", "0.6441721", "0.6427507", "0.64092004", "0.6407309", "0.64032584", "0.6388...
0.0
-1
funcion que hace que una vez finalizado el efecto shake se oculte el texto
function oculta(){ $("#errores").html(" "); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finish() {\r\n let finish = this.FINISH_TEXT[Math.floor((Math.random() * this.FINISH_TEXT.length))];\r\n this.isActive = false;\r\n return '```' + finish + '```';\r\n }", "handleShakeAnimationEnd_() {\n const {LABEL_SHAKE} = MDCFloatingLabelFoundation.cssClasses;\n this.adapter_.rem...
[ "0.62259203", "0.6109418", "0.6109418", "0.6088812", "0.6060569", "0.59280056", "0.58706427", "0.5843161", "0.5830428", "0.57861495", "0.57644564", "0.5745211", "0.5696366", "0.56857187", "0.56516534", "0.5647392", "0.56357074", "0.56196386", "0.5602296", "0.55835384", "0.558...
0.0
-1
Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 20052009 The Closure Authors. All Rights Reserved.
function lq(a,b){this.ve=[];this.Wf=a;this.Of=b||null;this.Ed=this.bd=!1;this.fc=void 0;this.lf=this.lg=this.Fe=!1;this.ye=0;this.ob=null;this.Ge=0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "static final private internal function m106() {}", "protected internal function m252() {}", "transient private protected internal ...
[ "0.70156956", "0.68230677", "0.6473631", "0.64528495", "0.6364609", "0.63586444", "0.62848216", "0.6255084", "0.6182535", "0.6061806", "0.60070974", "0.5904644", "0.5878845", "0.5858129", "0.5827394", "0.58151114", "0.58105", "0.579608", "0.5785136", "0.57723707", "0.57715636...
0.0
-1
Automatically performs selection sort.
function autoSort(cards) { var steps = []; var toInsert = 0; var currentMin = Number.MAX_VALUE; var minIndex = Number.MAX_VALUE; var length = cards.length; for (var i = 0; i < length; i++) { // Find the minimum for (var j = toInsert; j < length; j++) { steps.push('consider:'+j); if (cards[j] < currentMin) { if (minIndex != Number.MAX_VALUE) { steps.push('unmarkMin:'+minIndex) } steps.push('markMin:'+j); currentMin = cards[j]; minIndex = j; } steps.push('unconsider:'+j); } // Move min to correct place steps.push('move:'+minIndex+';to;'+toInsert); steps.push('markSorted:'+toInsert); cards.move(minIndex, toInsert); toInsert++; currentMin = Number.MAX_VALUE; minIndex = Number.MAX_VALUE; } return steps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sortValues() {\n if (this.multiple) {\n const options = this.options.toArray();\n this._selectionModel.sort((a, b) => {\n return this.sortComparator ? this.sortComparator(a, b, options) :\n options.indexOf(a) - options.indexOf(b);\n });\n ...
[ "0.7324717", "0.7271149", "0.70171255", "0.69869155", "0.693823", "0.6932976", "0.6909064", "0.68955946", "0.6801726", "0.67874587", "0.67652714", "0.6755435", "0.6751376", "0.67510825", "0.6732474", "0.6725357", "0.67198277", "0.670808", "0.66885775", "0.66885775", "0.665891...
0.0
-1
Adds animations to a queue.
function animToQueue(theQueue, selector, props, css, globals, params) { theQueue.queue(function(next) { // CSS changes before animation // Reveal a card if (css === "reveal") { var select = '#' + globals.cardArray[params].num; // race condition $(select).css({ backgroundImage: 'url(' + globals.cardArray[params].frontFace + ')' }); // Flip it back over } else if (css === "flip") { var select = '#' + globals.cardArray[params].num; // race condition $(select).css({ backgroundImage: 'url(' + globals.cardArray[params].normalBack + ')' }); // Mark card as new min / max } else if (css === "min") { var select = '#' + globals.cardArray[params].num; $('.droppable').css('background-image', 'url(' + globals.cardArray[params].frontFace + ')'); // Set card as sorted } else if (css == "sort") { var select = '#' + globals.cards[params].num; spacifyCards(globals); $(selector).css({ backgroundImage:'url(' + globals.cards[params].sortedBack + ')' }); } else if (css == "move") { var to = params.split(';')[2]; var from = params.split(';')[0]; var select = '#' + globals.cardArray[from].num; $(select).insertBefore($('#' + globals.cardArray[to].num)); // Update globals.cardArray globals.cardArray.move(from, to); } else if (css == "unmin") { var select = '#' + globals.cardArray[params].num; } // Animation $(select).animate(props, next); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "queueAnimation(animateRequest) {\n this._animationQueue.push(animateRequest);\n }", "function __addInteractionAnimationLayerForObject(animations){\n animationQueue.push(animations);\n queueOnAction.push(false);\n currentAnimation.push([]);\n finishedAnimationQueue.push([]);\...
[ "0.73108494", "0.69189286", "0.6872656", "0.6602309", "0.6313919", "0.62044454", "0.619323", "0.6176435", "0.6167839", "0.6128189", "0.6041635", "0.6002934", "0.5993195", "0.5976831", "0.5976292", "0.5976292", "0.5961554", "0.5945264", "0.59262663", "0.5842631", "0.5825194", ...
0.63671196
4
Moves a card up to mimic mouseover.
function consider(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'-=' + globals.SELECT_MOVE}, "reveal", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseUp() { }", "onMouseUp(e) {}", "function over(e) {\n // Set the cursor to 'move' wihle hovering an element you can reposition\n e.target.style.cursor = 'move';\n\n // Add a green box-shadow to show what container your hovering on\n e.target.style.boxShadow = 'inset lime 0 0 1px, lime 0 0 1px...
[ "0.6505599", "0.64355415", "0.64339775", "0.6355162", "0.6273372", "0.6264013", "0.6259771", "0.6259771", "0.6254348", "0.6240024", "0.62064296", "0.6192178", "0.6192178", "0.61564434", "0.6145803", "0.6122854", "0.61192125", "0.6097186", "0.6096158", "0.6090497", "0.6073136"...
0.0
-1
Stop considering a card
function unconsider(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'0px'}, "flip", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loseCard(card) {\n this.numCards -= 1;\n if (this.numCards <= 0) {\n this.out = true;\n this.cards.pop();\n } else {\n if (this.cards[0] === card) {\n this.cards.shift();\n } else if (this.cards[1] === card) {\n this.cards.pop();\n }\n }\n }", "function endCard...
[ "0.6761672", "0.66552377", "0.6654198", "0.6632151", "0.65951824", "0.65638", "0.64893425", "0.647694", "0.6449515", "0.6442261", "0.64283836", "0.6404401", "0.6365564", "0.6359606", "0.63533914", "0.63405293", "0.63027596", "0.63004005", "0.6297379", "0.6294201", "0.628659",...
0.0
-1
Mark a card as the new minimum.
function markMin(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:globals.SELECT_MOVE}, "min", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set min(value) {\n this.changeAttribute('min', value);\n }", "set min(value) {\n Helper.UpdateInputAttribute(this, 'min', value);\n }", "set _min(value) {\n Helper.UpdateInputAttribute(this, \"min\", value);\n }", "set minIndex(_val) {\n (typeof _val === \"number\") && this.setAttrib...
[ "0.6762539", "0.6391446", "0.6310163", "0.5955062", "0.594887", "0.5933817", "0.57989806", "0.5765526", "0.5754966", "0.5736904", "0.57338846", "0.5725054", "0.5714888", "0.56963027", "0.56401217", "0.56140196", "0.56140196", "0.56140196", "0.56140196", "0.56140196", "0.56140...
0.68334275
0
Unmark a card as the minimum.
function unmarkMin(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'0px'}, "unmin", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove() {\n if (!this.value) {\n this.value = this.min || 0;\n }\n const step = this.ctrl_key ? 100 : this.shift_key ? 10 : this.step || 1;\n this.value -= step;\n if (this.value < this.min) {\n this.value = this.min || 0;\n }\n this.setValue(...
[ "0.5794074", "0.57848006", "0.56940156", "0.56817675", "0.5626896", "0.560562", "0.55201274", "0.54891515", "0.5468478", "0.5459153", "0.53400993", "0.5333994", "0.5292736", "0.52908754", "0.5239382", "0.51999056", "0.51772475", "0.5173613", "0.5171734", "0.51701933", "0.5157...
0.70508796
0
Mark a card as sorted.
function markSorted(globals, params, q) { animToQueue(q, '#' + globals.cards[params].num, {top:'0px'}, "sort", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortTheCard() {\n this.sort = this.cards.sort((currentCard, nextCard) => currentCard.value - nextCard.value);\n }", "function setSorted(globals, id) {\n var cards = globals.cards;\n cards[id].sorted = true;\n cards[id].flipped = false;\n globals.totFlip--;\n $('#' + id).css({\n ba...
[ "0.70687985", "0.6549775", "0.62567806", "0.6168512", "0.6131611", "0.59777063", "0.58453494", "0.5823961", "0.57884926", "0.5781722", "0.57808983", "0.57802534", "0.5776661", "0.5752555", "0.5728674", "0.5721736", "0.56574416", "0.5646556", "0.5619388", "0.5619064", "0.56166...
0.6925067
1
The player of the game State==0 means, that it is not their turn State==1 means, that it is their turn
constructor (color,human){ this.color = color; this.human = human; this.stones_hand = 9; this.stones_atall = 9; this.action = 'put'; if (this.color == 'black'){ this.state = 0; }else{ this.state = 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isMyTurn() {\n return playerId == turn;\n}", "isTheseusTurn()\n\t{\n\t\tif(this.props.ctx.currentPlayer==='0'){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "function PendingPlayerState() { }", "winnerIs(state){\n return state.players[0]['isXWin'] ? state.players[0]['playerX'] : ...
[ "0.71079755", "0.7041642", "0.6997196", "0.69796646", "0.69137615", "0.6905623", "0.689016", "0.68303704", "0.6801006", "0.6777729", "0.67727983", "0.67529804", "0.6744343", "0.66951376", "0.66811556", "0.6665887", "0.6665565", "0.66640234", "0.6644138", "0.6623281", "0.66158...
0.0
-1
this is the variable that we will use to save the index of the position, where we took the stone away
function create_rows(stones){ /*Input: The array of the stones Output: An array that consists out of the rows of the field. */ var rows = [[stones[0],stones[1],stones[2]], [stones[0],stones[7],stones[6]],[stones[2],stones[3],stones[4]],[stones[6],stones[5],stones[4]],[stones[8],stones[15],stones[14]], [stones[8],stones[9],stones[10]],[stones[10],stones[11],stones[12]],[stones[14],stones[13],stones[12]],[stones[16],stones[23],stones[22]], [stones[16],stones[17],stones[18]],[stones[18],stones[19],stones[20]],[stones[22],stones[21],stones[20]],[stones[7],stones[15],stones[23]], [stones[1],stones[9],stones[17]],[stones[19],stones[11],stones[3]],[stones[21],stones[13],stones[5]]]; return rows; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test() {\n var result = pos({})\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return result.position\n }", "function snakePosition() {\n\tfor (var i = 0; i < rry.length; i++) {\n\t\tfor (var j = 0; j < rry[i].length; j++) {\n\t\t...
[ "0.6527147", "0.65192896", "0.6507408", "0.6378171", "0.6378171", "0.6378171", "0.6378171", "0.6378171", "0.6332293", "0.6331541", "0.6311694", "0.6304309", "0.6291482", "0.6243825", "0.62395793", "0.62318027", "0.6228142", "0.62141657", "0.6209569", "0.6193158", "0.61496377"...
0.0
-1
The AI methods for the minmaxalgorithms
function convert_to_array(ar){ // Convert one of these weird 'deepcopy' array-objects into a proper array var test = Array(); var checker = true; var index = 0; while(checker){ if((typeof(ar[index])=='string')||(typeof ar[index]=='object')){ test.push(ar[index]) index++; }else{ checker = false; } } return test; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function minmax(newBoard,player) {\n var availSpots = emptySpots(newBoard);\n if(checkWinner(newBoard,huPLayer)) return {score:-10};\n else if (checkWinner(newBoard,aiPlayer)) return{score:+10};\n else if (availSpots.length === 0 ) return {score:0};\n //an arrar to collect all the objects\n var mov...
[ "0.63859135", "0.6126756", "0.6118419", "0.6077942", "0.603213", "0.6015189", "0.599978", "0.596573", "0.59024864", "0.5892248", "0.5881318", "0.5816229", "0.5733382", "0.57171476", "0.56853294", "0.567694", "0.5657124", "0.56354284", "0.5612829", "0.56044406", "0.559295", ...
0.0
-1
Specify the functions for the random AI
function ai_random(stones,color,action){ /*Input: The stone array and the color of the player Output: The modified stone array*/ if (action=='put'){ var possible_fields = []; for (var i=0; i<stones.length;i++){ if(stones[i]=='¤'){ possible_fields.push(i); } } var index = Math.floor(Math.random() * possible_fields.length); stones[possible_fields[index]]=color; //return stones[possible_fields[index]]; } else if(action=='move'){ var possible_moves = []; var my_fields = []; //create array with indices of all my stones for (var i=0;i<stones.length;i++){ if (stones[i]==color){ my_fields.push(i) } } for (var j=0;j<my_fields.length;j++){ //generate array of each neighbour var nbs = generate_neighbours(my_fields[j]); for (var k = 0; k<nbs.length;k++){ //check whether the neighbouring field is free if(stones[nbs[k]]=='¤'){ var move = [my_fields[j],nbs[k]]; possible_moves.push(move); } } } var index = Math.floor(Math.random() * possible_moves.length); var rmove = possible_moves[index]; stones[rmove[0]] = '¤'; stones[rmove[1]] = color; //return(rmove); } else if(action=='jump'){ var possible_jumps = []; //create array with indices of all my stones for (var i=0;i<stones.length;i++){ if (stones[i]==color){ for(var j=0;j<stones.length;j++){ if(stones[j]=='¤'){ var move = [i,j]; possible_jumps.push(move); } } } } var index = Math.floor(Math.random() * possible_jumps.length); var rmove = possible_jumps[index]; stones[rmove[0]] = '¤'; stones[rmove[1]] = color; //return(rmove); } return stones; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gen_random(){\r\n\treturn 0.3\r\n}", "function randomValues() {\n anime({\n targets: '#dot, #dot2, #dot3, #dot4, #dot5, #dot6, #dot7, #dot8',\n translateX: function() {\n return anime.random(0, 20);\n },\n\n translateY: function() {\n return anime.random(0, 20);\n },\n\n ea...
[ "0.60807693", "0.6039387", "0.59729785", "0.58664095", "0.5840664", "0.582137", "0.5806877", "0.573372", "0.5682601", "0.56586015", "0.5657882", "0.56531197", "0.5651629", "0.56497777", "0.5649004", "0.56451976", "0.5620432", "0.5607213", "0.56043446", "0.56015146", "0.556589...
0.0
-1
This is the AI method that'll be called in the game js file with the possibility to specify the type of the AI
function ai_multi(stones,color,action,type){ if (type=='random'){ if (action=='take'){ return ai_take_random(stones,color); }else{ return ai_random(stones,color,action); } } if (type=='smart'){ if (action=='take'){ return where_mill; }else{ return minmax(stones,color,action,0); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AI(){\r\n let best_choice=bestOption(game_board);\r\n game_board[Math.floor(best_choice/10)][best_choice%10]='o';\r\n document.getElementById(best_choice).classList.toggle('ring_active'); //display on the website\r\n checkEnd();\r\n }", "function handleAI(paddle1Pos, paddl...
[ "0.65789056", "0.637497", "0.6365794", "0.6363841", "0.62677985", "0.62266004", "0.6215718", "0.6137134", "0.61057854", "0.60712487", "0.6050705", "0.6031584", "0.6016021", "0.59890914", "0.5916784", "0.5911799", "0.5870207", "0.5855399", "0.58489895", "0.5804566", "0.5790118...
0.54133254
61
end the funcftion here a this is the graph of our layer / === ===tkharbi9 dial ayou === ===
function startRangingBeacons(){ // if(firstTime){ // $scope.loader=true; // } //alert(heatMap["B"][1].UUID); //alert(heatMap.length); // Request authorisation. t0=performance.now(); var t_beacon= []; var rssi_1218 =[]; var rssi_1219 =[]; var rssi_1221 =[]; var rssi_1222 =[]; var rssi_1211 =[]; var e = 0; //var deviceOreintation; // do{ // deviceOreintation=orientationDevice(function(hd){ return hd;}); // console.error('device orientation : '+deviceOreintation); // }while(deviceOreintation == undefined || deviceOreintation == 0) //orientationDevice(function(hd){ console.log(hd);}); //console.log('device orientation 1: '+deviceOreintation); /*orientationDevice(function(hd){ deviceOreintation=hd; console.log('device orientation 2: '+deviceOreintation); }); //console.log('device orientation 2: '+deviceOreintation); setTimeout(function(){},500); console.log('device orientation 3: '+deviceOreintation);*/ //$.when(navigator.compass.getCurrentHeading(onSuccess, onError)).then(heatos()); //var t0=performance.now(); navigator.compass.getCurrentHeading(onSuccess, onError); //var t1 = performance.now(); //console.log('performance time :'+(t1-t0)); //console.log('device orientation 3: '+deviceOreintation); //console.log('device orientation 3: '+deviceOreintation); //alert('biba '+biba); var heatMap = []; var der=''; //alert('device ortientation : '+deviceOreintation); // start 4 directions if(deviceOreintation>=105 && deviceOreintation<195){ heatMap = southHeatMap; //console.log("i m in south" +deviceOreintation); } if(deviceOreintation>=195 && deviceOreintation<285){ heatMap = westHeatMap; //console.log("i m in west" +deviceOreintation); } if((deviceOreintation>=285 && deviceOreintation<360) || (deviceOreintation>=0 && deviceOreintation<15)){ heatMap = northHeatMap; //console.log("i m in north" +deviceOreintation); } if(deviceOreintation>=15 && deviceOreintation<105){ heatMap = eastHeatMap; //console.log("i m in east" +deviceOreintation); } estimote.beacons.startRangingBeaconsInRegion( {}, // Empty region matches all beacons. function(beaconInfo) { $.each(beaconInfo.beacons, function(key, beacon){ var string_UUID = beacon.proximityUUID; var lengthUUID = string_UUID.length; var lastUUID = string_UUID.substr(lengthUUID - 4); if( lastUUID == '1218' ) rssi_1218.push(beacon.rssi); if( lastUUID == '1219' ) rssi_1219.push(beacon.rssi); if( lastUUID == '1221' ) rssi_1221.push(beacon.rssi); if( lastUUID == '1222' ) rssi_1222.push(beacon.rssi); if( lastUUID == '1211' ) rssi_1211.push(beacon.rssi); //t_beacon.push({ "uuid" :beacon.proximityUUID,"rssi" : beacon.rssi}); }); //t0=performance.now(); e++; //t1 = performance.now(); //console.log('performance time biba:'+(t1-t0)); if(e > 9){ //with the other algorithm /*if(rssi_1218.length>0){ var sum_1218 = rssi_1218.reduce(sum_array); var mean_1218 = sum_1218 / rssi_1218.length; var standat_1218 = standart_array(rssi_1218, mean_1218, sum_1218); var final_rssi_1218 = final_rssi(rssi_1218, mean_1218, standat_1218); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571218", "rssi": final_rssi_1218}); } if(rssi_1219.length>0){ var sum_1219 = rssi_1219.reduce(sum_array); var mean_1219 = sum_1219 / rssi_1219.length; var standat_1219 = standart_array(rssi_1219, mean_1219, sum_1219); var final_rssi_1219 = final_rssi(rssi_1219, mean_1219, standat_1219); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571219", "rssi": final_rssi_1219}); } if(rssi_1221.length>0){ var sum_1221 = rssi_1221.reduce(sum_array); var mean_1221 = sum_1221 / rssi_1221.length; var standat_1221 = standart_array(rssi_1221, mean_1221, sum_1221); var final_rssi_1221 = final_rssi(rssi_1221, mean_1221, standat_1221); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571221", "rssi": final_rssi_1221}); } if(rssi_1222.length>0){ var sum_1222 = rssi_1222.reduce(sum_array); var mean_1222 = sum_1222 / rssi_1222.length; var standat_1222 = standart_array(rssi_1222, mean_1222, sum_1222); var final_rssi_1222 = final_rssi(rssi_1222, mean_1222, standat_1222); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571222", "rssi": final_rssi_1222}); } if(rssi_1211.length>0){ var sum_1211 = rssi_1211.reduce(sum_array); var mean_1211 = sum_1211 / rssi_1211.length; var standat_1211 = standart_array(rssi_1211, mean_1211, sum_1211); var final_rssi_1211 = final_rssi(rssi_1211, mean_1211, standat_1211); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571211","rssi": final_rssi_1211}); }*/ // with kalman filter kalmanFilter(rssi_1218,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571218"); kalmanFilter(rssi_1219,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571219"); kalmanFilter(rssi_1221,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571221"); kalmanFilter(rssi_1222,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571222"); kalmanFilter(rssi_1211,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571211"); for(var i;i<t_beacon.length;i++){ console.log('uuid : '+t_beacon[i].uuid+' rssi :'+t_beacon[i].rssi) } // algorithme of heatMap var errorTab; var min=Math.pow(10,20); var err=0; var Zonefinale; for(var i=0;i<heatMap.length;i++){ var error = 0; var zone = heatMap[i].zone; var gefunden = false; for(k=0;k<t_beacon.length;k++){ for(j=0;j<heatMap[i].listBeacons.length;j++){ if(t_beacon[k].uuid.toLowerCase() == heatMap[i].listBeacons[j].uuid.toLowerCase()){ gefunden=true; err = Math.pow(Math.abs(heatMap[i].listBeacons[j].rssi)-Math.abs(t_beacon[k].rssi),2); } } if(!gefunden){ err = Math.pow(t_beacon[k].rssi,2); } error += err; } console.log("Zone "+zone+" Error "+error); if(min>error){ min = error; Zonefinale = zone; } } console.log("min ="+min+" zone="+Zonefinale); //alert('zone: '+Zonefinale+', direction : '+der); var lengthZone = zones.length; for(i =0;i<lengthZone;i++){ if(zones[i].zone == Zonefinale){ pos_device = { "x": zones[i].x, "y": zones[i].y }; } } d3.select("#Device_position").transition().duration(800) .attr("visibility","visible") .attr("cx",pos_device.x) .attr("cy",pos_device.y ); d3.select("#Device_position_error").transition().duration(800) .attr("visibility","visible") .attr("cx",pos_device.x) .attr("cy",pos_device.y ); // d3.select("#directionOfPosition").transition().duration(800) // .attr("visibility","visible") // .attr("x",pos_device.x) // .attr("y",pos_device.y ); // end heat map lagorithm t_beacon =[]; rssi_1218 =[]; rssi_1219 =[]; rssi_1221 =[]; rssi_1222 =[]; rssi_1211 =[]; e = 0; //var t0=performance.now(); navigator.compass.getCurrentHeading(onSuccess, onError); //var t1 = performance.now(); //console.log('performance time 2 :'+(t1-t0)); t1=performance.now(); console.log(' performance time : '+(t1-t0)); if(firstTime){ firstTime = false; findWay(Zonefinale); $('.loader').hide(); //$scope.panel = 1; } } }, function(errorMessage) { alert('Ranging error: ' + errorMessage) }); }//End Of startRangingBeacons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "layer (data) {\n return _layer.draw(data)\n }", "function draw() {\n clear();\n leg();\n}", "draw(data) {\n //clear the svg\n this.vis.selectAll(\"*\").remove();\n\n //our graph, represented through nodes and links\n let nodes = [];\n let links = [];\n\n //ad...
[ "0.63720614", "0.63054025", "0.60155", "0.60002244", "0.5979157", "0.5962448", "0.5900163", "0.58741266", "0.5856362", "0.5851411", "0.5830335", "0.58133125", "0.578028", "0.577274", "0.5767087", "0.57645446", "0.5762875", "0.57563996", "0.57557887", "0.5753289", "0.57512105"...
0.0
-1
the function of map
function mapinos(obj) { var rObj = {}; rObj[obj.uuid] = obj.rssi; return rObj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function map() {\n\n}", "function map(a,f){\r\n let b=[], i;\r\n for (i in a){\r\n b.push(f(a[i]));\r\n }\r\n return b;\r\n}", "map(f) { // Maps a function over this type (just like arrays)\n return f(this._value);\n }", "function myMap(arr, fn) {\n const arrOutput = [];\n for(let i = 0; i <...
[ "0.7475109", "0.7391365", "0.71711797", "0.71386784", "0.7133224", "0.7102631", "0.7068042", "0.70589274", "0.70399463", "0.70327586", "0.7015865", "0.7010355", "0.6944262", "0.6940311", "0.6938932", "0.6916924", "0.6902142", "0.6896268", "0.6895891", "0.6895197", "0.68774104...
0.0
-1
calculate the standart of some data
function standart_array(rssi_array, mean, sum){ var temp = 0; for(var i= 0;i<rssi_array.length;i++){ temp += Math.pow(rssi_array[i]-mean,2); } return Math.sqrt((1/sum)*temp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startData() { return {\n unlocked: true,\n points: new Decimal(0),\n best: new Decimal(0),\n\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n subspace: new Decimal(0),\r\n auto:...
[ "0.6367299", "0.63397056", "0.6321267", "0.62329835", "0.61852723", "0.61299384", "0.61247957", "0.61146003", "0.6068757", "0.59933585", "0.59275985", "0.59129316", "0.5865102", "0.58449256", "0.58365875", "0.58078015", "0.5736259", "0.57030255", "0.57030255", "0.57030255", "...
0.58766943
12
calculate the sum of some given data
function sum_array(total, sum){ return total + sum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumData(data) {\n\n return data.reduce(sum);\n }", "function calcSum(){\n var sum = 0;\n for (var i = 0; i < data.length ; i++) {\n if (data[i].type === 'inc') {\n sum += parseInt(data[i].value);\n\n }else if (data[i].type === 'exp') {\n sum -= parseInt(data[i].value);\n }\n ...
[ "0.81762326", "0.78467035", "0.7704513", "0.7694907", "0.76389396", "0.7378151", "0.73089653", "0.7301588", "0.72892815", "0.69822073", "0.6935143", "0.69191206", "0.6882943", "0.6880673", "0.6829435", "0.6761839", "0.6756418", "0.66930217", "0.6690375", "0.6690102", "0.66677...
0.6701153
17
calculate the average of some given data
function final_rssi(rssi_array, mean, standart){ for(var i= 0;i<rssi_array.length;i++){ if(rssi_array[i]<mean-2*standart) rssi_array.splice(i,1); } return rssi_array.reduce(sum_array)/rssi_array.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function average(data){\n let sum = data.reduce(function(sum, value){\n return sum + value;\n }, 0);\n \n let avg = sum / data.length;\n return avg;\n}", "function average(data){\n var sum = data.reduce(function(sum, value){\n return sum + value;\n }, 0);\n var avg = sum / data.length;\n ...
[ "0.8258804", "0.8206199", "0.81998265", "0.80797553", "0.80615735", "0.8038417", "0.79780704", "0.79375184", "0.7774714", "0.75901926", "0.7577477", "0.7478954", "0.7475001", "0.7375702", "0.7371123", "0.7346446", "0.7333981", "0.7316082", "0.7303658", "0.73003805", "0.728124...
0.0
-1
calculate the distance from the the rssi
function distance_rssi(rssi_p){ var cal= -66; var dist; if(cal<rssi_p){ dist = Math.pow(10,rssi_p/cal) } else{ dist = (0.9*Math.pow(7.71,rssi_p/cal)+0.11)*0.001 } return dist }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapBeaconRSSI(rssi)\n {\n if (rssi >= 0) return 1; // Unknown RSSI maps to 1.\n if (rssi < -100) return 100; // Max RSSI\n return 100 + rssi;\n }", "function mapBeaconRSSI(rssi) {\n if (rssi >= 0)\n return 1; // Unknown RSSI maps to 1.\n if (rssi < -100)\n return 100; // M...
[ "0.65244526", "0.647684", "0.6271676", "0.6180164", "0.5978584", "0.59419155", "0.59161425", "0.5910772", "0.5836793", "0.5821521", "0.58053833", "0.5753798", "0.5730081", "0.57222176", "0.571949", "0.5654595", "0.56274945", "0.562134", "0.5585668", "0.5531825", "0.54504734",...
0.8016069
0
Begin Of accelerationDevice get acceleration Device
function accelerationDevice(){ var acc; $('#ShowBeacons').empty(); setInterval(function(){navigator.accelerometer.getCurrentAcceleration( function(acceleration) { acc +='<p>Acceleration X: ' + acceleration.x + '</p>\n' + '<p>Acceleration Y: ' + acceleration.y + '</p>\n' + '<p>Acceleration Z: ' + acceleration.z + '</p>\n' + '<p>Timestamp: ' + acceleration.timestamp + '</p>\n<p>------------------</p>'; $('#ShowBeacons').append(acc); }, function() {alert('onError!');} );},5000); }//Ende of accelerationDevice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Acceleration() {}", "accelerometer() {\n this.setup();\n\n let accel = [0, 0, 0];\n\n //\n // taken from https://github.com/pimoroni/enviro-phat/pull/31/commits/78b1058e230c88cc5969afa210bb5b97f7aa3f82\n // as there is no real counterpart to struct.unpack in js\n //\...
[ "0.6690568", "0.6640508", "0.6575329", "0.6475521", "0.64167273", "0.6317041", "0.63064206", "0.6251409", "0.62481874", "0.6175653", "0.61529523", "0.6152147", "0.6133971", "0.600708", "0.600152", "0.59922844", "0.58851343", "0.5872435", "0.58339185", "0.5817319", "0.57336676...
0.63024956
7
Begin of All orientationDevice to get the Orientation
function orientationDevice(_callback){ navigator.compass.getCurrentHeading( function(heading){ hd = heading.magneticHeading; _callback(hd); //biba = 300; }, function(error){ alert('CompassError: ' + error.code);} ); //return hd; }//Ende of orientationDevice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get orientation() {\n return this._orientation;\n }", "get orientation() {\n return this._orientation;\n }", "get orientation() {\n return this._orientation;\n }", "function readDeviceOrientation() {\n\t switch (window.orientation) {\n\t case 0:\n\t break;\n\t case 180...
[ "0.71755445", "0.71755445", "0.71301854", "0.7077261", "0.69223964", "0.6693444", "0.66563964", "0.6649725", "0.6569375", "0.6569375", "0.65346885", "0.6391145", "0.63472396", "0.6303498", "0.62987596", "0.6279408", "0.6264217", "0.62104577", "0.61887944", "0.6141835", "0.611...
0.6605403
8
Ende of calculate_Tri / == end tkharbi9 dial ayoub == ==
function findWay(source){ var id_room = $('#room').val().split(" ").join("").toLowerCase(); id_room = zimmerNameId[id_room]; graph = new Graph(map); var shortWay = []; shortWay = graph.findShortestPath(zonesNameId[source],id_room); console.log("the short way to the destination : \n"+shortWay); var len = shortWay.length; // the points of each noud which will be drawed var points =[]; for(i=0;i<len;i++){ var key = shortWay[i]; if(mapCoordnidates[key]){ object = {"x":mapCoordnidates[key].x, "y":mapCoordnidates[key].y}; points.push(object); } } /*for(i=0;i<points.length;i++){ console.log("points of the line : \n"+points[i].x+' '+points[i].y); }*/ // draw the line of the points until the destination d3.select("#theWay").attr("visibility","hidden"); // hide the distination to draw it again // d3.select("#destination").attr("visibility","hidden"); var lineFunction = d3.svg.line() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }) .interpolate("linear"); // the arrow of the end var defs = d3.select("#svg8").append("svg:defs"); /* here to generate the marker shape and assign it the "arrow" id */ defs.append("svg:marker") .attr("id", "arrow") .attr("viewBox", "0 0 10 10") .attr("refX", 1) .attr("refY", 5) .attr("markerWidth", 6) .attr("markerHeight", 6) .attr("orient", "auto") .attr('fill','#3498db') .append('svg:path') .attr('d', "M 0 0 L 10 5 L 0 10 z"); d3.select("#theWay").attr("d", lineFunction(points)) .attr("id","theWay") .attr("stroke", "#3498db") .attr("stroke-width", 2) .attr("fill", "none") .attr("visibility","visible") .attr('marker-end', 'url(#arrow)'); // draw the destination // d3.select("#"+id_room) // .style("fill","#d35400") // .attr("r",3) // .attr('id','destination') // .attr("visibility","visible"); }// end finWay
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kiemTra(X, Y, viTriMoi){\n X = viTriX + X;\n Y = viTriY + Y;\n viTriMoi = viTriMoi || ViTriXoay; // khi xoay khoi co bi qua ngoai man hinh khong\n\n\n\n for ( var y = 0; y < 4; ++y ) {\n for ( var x = 0; x < 4; ++x ) {\n if ( viTriMoi [ y ][ x ] ) {\n if ( type...
[ "0.67896724", "0.6066422", "0.5990961", "0.5982269", "0.5970163", "0.5962472", "0.59592146", "0.592468", "0.5872448", "0.58453625", "0.5842195", "0.5775033", "0.5765286", "0.5762532", "0.57622886", "0.57548684", "0.57235354", "0.5721751", "0.57157576", "0.570762", "0.569522",...
0.0
-1
this function specifies the positions of bend points
bendPositionsFunction(ele) { return ele.data('bendPointPositions'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bpos()\n\t{\n\t\treturn [this.x + DIRS[this.dir][0], this.y + DIRS[this.dir][1]];\n\t}", "function Bezier(startPt, endPt, startCtrlPt, endCtrlPt) {\n\tvar b;\n\tb.startPoint=startPt;\n\tb.endPoint=endPt;\n\tb.startControlPoint = startCtrlPt;\n\tb.endControlPoint = endCtrlPt;\n\tb.getCartesianAt = new function(t)...
[ "0.6731586", "0.6204395", "0.6165572", "0.6045086", "0.6009413", "0.59384155", "0.5921679", "0.59192485", "0.5889758", "0.58740854", "0.58181715", "0.58097786", "0.5790465", "0.57809985", "0.5769285", "0.5757061", "0.5715059", "0.56950915", "0.5672013", "0.5658654", "0.560631...
0.6479256
1
Store the username and accessToken here so that it can be passed down to each corresponding child view.
login(username, accessToken) { this.setState({ username: username, accessToken: accessToken }); this.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "auth_user_data(state, user){\n state.auth_user = user\n }", "function processAuth() {\n\n // let the authProvider access the access token\n authToken = localStorage.token;\n\n if (localStorage.getItem('user') === null) {\n\n // Get the profile of the current user.\n GraphHelp...
[ "0.6262693", "0.62520564", "0.6088134", "0.60748285", "0.60652333", "0.60582477", "0.60401845", "0.5998425", "0.5996736", "0.59809166", "0.5964823", "0.5938157", "0.59332716", "0.59205633", "0.59056455", "0.5815292", "0.5793514", "0.57765085", "0.5760541", "0.5692263", "0.568...
0.5947306
11
Revokes the access token, effectively signing a user out of their session.
revokeAccessToken() { this.setState({ accessToken: undefined }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "logout() {\n this.setAccessToken(null);\n this.user = null;\n }", "function revokeToken() {\n\t\texec_result.innerHTML='';\n\t\tgetAuthToken({\n\t\t\t'interactive': false,\n\t\t\t'callback': revokeAuthTokenCallback,\n\t\t});\n\t}", "function oauth2SignOut() {\n if (params['access_token']) {...
[ "0.7372787", "0.73320144", "0.6912185", "0.68594915", "0.6820923", "0.6796137", "0.6788129", "0.6767535", "0.6717279", "0.6638095", "0.6565397", "0.65397465", "0.6532335", "0.64746284", "0.6449039", "0.639707", "0.63275737", "0.62895507", "0.62471837", "0.62442386", "0.621187...
0.6577832
10
Note that there are many ways to do navigation and this is just one! I chose this way as it is likely most familiar to us, passing props to child components from the parent. Other options may have included contexts, which store values above (similar to this implementation), or route parameters which pass values from view to view along the navigation route. You are by no means bound to this implementation; choose what works best for your design!
render() { // Our primary navigator between the pre and post auth views // This navigator switches which screens it navigates based on // the existent of an access token. In the authorized view, // which right now only consists of the profile, you will likely // need to specify another set of screens or navigator; e.g. a // list of tabs for the Today, Exercises, and Profile views. let AuthStack = createStackNavigator(); let Tab = createBottomTabNavigator(); const Stack = createStackNavigator(); const ProfileStack = createStackNavigator(); const screenOptionStyle = { // headerStyle: { // backgroundColor: "#9AC4F8", // }, // headerTintColor: "white", // headerBackTitle: "Back", }; const ProfileStackNavigator = () => { return ( <ProfileStack.Navigator screenOptions={screenOptionStyle}> <ProfileStack.Screen name="Profile" options={{ title: 'Profile', headerLeft: this.SignoutButton }} > {(props) => <ProfileView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} update={this.update} />} </ProfileStack.Screen> </ProfileStack.Navigator> ); }; const DayViewStackNavigator = () => { return ( <Stack.Navigator screenOptions={screenOptionStyle}> <Stack.Screen name="Today" options={{ title: 'Today', headerLeft: this.SignoutButton }}> {(props) => <TodayView {...props} goalDailyActivity={this.state.goalDailyActivity} activities={this.state.activities} activityDone={this.state.activityDone} revokeAccessToken={this.revokeAccessToken} />} </Stack.Screen> </Stack.Navigator> ); }; // const ExercisesStackNavigator = (props) => { // return ( // <ExercisesStack.Navigator screenOptions={screenOptionStyle}> // <ExercisesStack.Screen name="Exercises" options={{ // title: 'Exercises', // headerLeft: this.SignoutButton, // headerRight: ({ nv }) => <Text onPress={() => console.log(nv)}> hello</Text>, // }}> // {(props) => <ExercisesView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </ExercisesStack.Screen> // <ExercisesStack.Screen name="AddExercise" options={{ // title: 'Add Exercise' // }}> // {(props) => <AddExerciseView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </ExercisesStack.Screen> // </ExercisesStack.Navigator> // ); // }; const BottomTabNavigator = () => { return ( <Tab.Navigator initialRouteName="Feed" tabBarOptions={{ activeTintColor: '#e91e63', }} > <Tab.Screen name="Today" options={{ tabBarLabel: 'Today', tabBarIcon: ({ color, size }) => ( <MaterialIcons name="today" size={size} color={color} /> ), }} component={DayViewStackNavigator} /> <Tab.Screen name="Profile" options={{ tabBarLabel: 'Profile', tabBarIcon: ({ color, size }) => ( <MaterialCommunityIcons name="account" color={color} size={size} /> ), }} component={ProfileStackNavigator} /> <Tab.Screen name="Exercises" options={{ tabBarLabel: 'Exercises', tabBarIcon: ({ color, size }) => ( <FontAwesome5 name="running" size={size} color={color} /> ), }} > {(props) => <ExercisesStackNavigator {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} update={this.update} data={this.state.allActivities}></ExercisesStackNavigator>} </Tab.Screen> </Tab.Navigator>); }; return ( <NavigationContainer> {!this.state.accessToken ? ( <> <AuthStack.Navigator> <AuthStack.Screen name="Login" options={{ title: 'Fitness Tracker Welcome', }} > {(props) => <LoginView {...props} login={this.login} />} </AuthStack.Screen> <AuthStack.Screen name="SignUp" options={{ title: 'Fitness Tracker Signup', }} > {(props) => <SignupView {...props} />} </AuthStack.Screen> </AuthStack.Navigator> </> ) : ( // <> // <AuthStack.Screen name="FitnessTracker" options={{ // headerLeft: this.SignoutButton // }}> // {(props) => <ProfileView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </AuthStack.Screen> // </> <BottomTabNavigator /> )} </NavigationContainer > ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\n return (\n <div>\n {/* ROUTE: This component is for creating and linking pages with each other. Passing props to cummunicate between parent and chideren. */}\n <Route exact path=\"/\" render={() => (\n <BookShelfs\n books={this.state.books}\n select...
[ "0.62166464", "0.6067169", "0.60498744", "0.60171527", "0.5996524", "0.5996098", "0.59912044", "0.5903819", "0.588826", "0.5853206", "0.58374566", "0.5780554", "0.5774566", "0.57671595", "0.5743171", "0.57313657", "0.5705034", "0.56948984", "0.5681009", "0.5674471", "0.566711...
0.0
-1
lifecycle method, runs before render
componentWillMount() { //ListView (scalable component for rendering scrolling list) //if item goes beyond screen, its component reused for next item in list const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); //set libraries prop (via mapStateToProps) of component as listView data source this.dataSource = ds.cloneWithRows(this.props.libraries); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n if (!this.initialized) {\n this.init();\n }\n }", "onBeforeRendering() {}", "render() {\n if (!this.initialized) this.init();\n }", "onBeforeRender () {\n\n }", "postRender()\n {\n super.postRender();\n }", "render() {\n // always reinit on render\n this...
[ "0.733038", "0.7321592", "0.73008275", "0.7182236", "0.7138608", "0.71131814", "0.71131814", "0.7108738", "0.7108738", "0.7108738", "0.71041113", "0.70622796", "0.70622796", "0.70150745", "0.6959523", "0.69214433", "0.6911439", "0.6911439", "0.68797517", "0.68407214", "0.6794...
0.0
-1
helper method for rendering single library per row
renderRow(library) { return <ListItem library={library} />; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderRow(library) {\n\t\treturn <ListItem library={library} />; \n\t}", "renderRow( library ) {\n return <ListItem library={ library }/>\n }", "getLibraryCell(){\n\t\t\treturn <td>{this.getLibrariesInCombinations()['libraries']}</td>;\n\t\t}", "function render() {\n myLibrary.forEach((value, inde...
[ "0.7772568", "0.75394875", "0.6713735", "0.6692541", "0.6594222", "0.6527876", "0.6480885", "0.6388772", "0.6106803", "0.6100448", "0.60722", "0.5896136", "0.5722626", "0.5690623", "0.5689655", "0.5630077", "0.5628221", "0.56192666", "0.5600598", "0.5591161", "0.5584242", "...
0.7407983
2
render component to screen
render() { return ( <ListView dataSource={this.dataSource} renderRow={this.renderRow} /> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_renderScreen() {\n\t\tif (this._el && this._component) {\n\t\t\tthis._component.render(this._el);\n\t\t}\n\t}", "render() { this.screen.render() }", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\t}", "render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document....
[ "0.79888844", "0.77857107", "0.7595934", "0.75242615", "0.7523502", "0.7491365", "0.72410214", "0.72268414", "0.7118406", "0.7088789", "0.7088789", "0.707844", "0.7069973", "0.7069973", "0.706419", "0.70557594", "0.7053476", "0.7050479", "0.70393616", "0.7024166", "0.7024166"...
0.0
-1
! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at THIS CODE IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NONINFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
function e(e,t,s,n){return new(s||(s=Promise))((function(i,r){function a(e){try{h(n.next(e))}catch(e){r(e)}}function o(e){try{h(n.throw(e))}catch(e){r(e)}}function h(e){e.done?i(e.value):new s((function(t){t(e.value)})).then(a,o)}h((n=n.apply(e,t||[])).next())}))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SBRecordsetPHP_analyzePlatformSpecific()\r\n{\r\n\r\n\r\n}", "function getClientVersion() { return '0.14.4'; }", "_getPageMetadata() {\n return undefined;\n }", "createObjectContext2() {\n console.log('deprecated')\n return C.extension\n }", "function test_crosshair_op_azone_azure() {}"...
[ "0.5057278", "0.5027019", "0.4967857", "0.49631536", "0.4953607", "0.4946838", "0.4899115", "0.48889872", "0.48588374", "0.48144326", "0.48144326", "0.47849244", "0.475549", "0.4749384", "0.47311443", "0.47307473", "0.47276986", "0.47170758", "0.47090656", "0.47090656", "0.47...
0.0
-1
Draws the pipe on the canvas
draw(index) { fill(pipeColors[3 * this.status], pipeColors[3 * this.status + 1], pipeColors[3 * this.status + 2]); rect(index * pipesWidth + index * pipesWidth / (pipesAmount + 1), canvasHeight - this.height - (2 * minPipeHeight), pipesWidth, this.height + minPipeHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n \n // Clear the canvas\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n \n addIfPipeNeeded();\n\n // Check for collisions\n collisionDetection();\n \n for (var i = 0; i < pipes.length ; i++) {\n var pipe = pipes[i];\n pipe.move();\n drawcompo...
[ "0.74068165", "0.7403428", "0.73269916", "0.72956324", "0.7271177", "0.72699153", "0.72699153", "0.72699153", "0.72699153", "0.72226834", "0.7203878", "0.697974", "0.6968142", "0.6883081", "0.6842452", "0.6762215", "0.6756254", "0.67520845", "0.6738171", "0.66951376", "0.6682...
0.7366688
2
Restarts the animation completely
function restartAnimation() { setup(); frameCounter = 0; animationIndex = 0; focusedPipeIndex = 0; lowestUnsortedIndex = 1; // Recreate the pipes array if the animation has been played before if (needsScrambling) { pipes = []; for (let i = 0; i < pipesAmount; i++) pipes.push(new Pipe(i * minPipeHeight)); pipes = scramble(pipes); pipes[0].status = 2; } needsScrambling = true; loop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animateRestart() {\n animation1.restart();\n animation2.restart();\n animation3.restart();\n animation4.restart();\n}", "restartAnimation() {\n for (var key in this.animations) {\n if (this.animations.hasOwnProperty(key)) {\n this.animations[key].setFinished(false);\...
[ "0.8510034", "0.8280984", "0.8237393", "0.82202595", "0.7657908", "0.7548187", "0.7501904", "0.73825663", "0.727779", "0.723018", "0.7139637", "0.7132513", "0.7120546", "0.70794916", "0.7055592", "0.7039486", "0.7033863", "0.70324564", "0.6966964", "0.6898116", "0.68861574", ...
0.73322004
8
Sets the size and position of the canvas, thus not interrupting or restarting the animation
function setup() { let canvasDiv = document.getElementById('animation'); canvasWidth = canvasDiv.offsetWidth; canvasHeight = canvasDiv.offsetHeight; pipesAmount = Math.floor(canvasHeight / (minPipeHeight + 1)); pipesWidth = canvasWidth / (pipesAmount + 1); // Creates canvas let canvas = createCanvas(canvasWidth, canvasHeight); // Declares the parent div of the canvas canvas.parent('animation'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setCanvas() {\n this.canvas.width = this.height = 800;\n this.canvas.height = this.width = 800;\n }", "resetCanvas() {\n this.positions = this.calcSizeAndPosition();\n }", "function setCanvasSize() {\n\t\t// Get the screen height and width\n\t\tscreenHeight = window.innerHeight || document.d...
[ "0.75288343", "0.742607", "0.69726217", "0.69726217", "0.69273144", "0.6848055", "0.6791445", "0.66832364", "0.6642979", "0.66321373", "0.66212213", "0.66188926", "0.6609722", "0.65976095", "0.658687", "0.6559662", "0.6556843", "0.6542627", "0.6540094", "0.6537532", "0.652124...
0.0
-1
Gets called 60 times per second
function draw() { // Clear the canvas clear(); // Draw all pipes for (let i = 0; i < pipes.length; i++) pipes[i].draw(i); // If (60 / fps) frames have passed if (frameCounter++ > 60 / fps) { frameCounter %= 60 / fps; // Call the next animation and increment the animationIndex if it returns true or else decrement if (animations[animationIndex]()) animationIndex = (animationIndex + 1) % animations.length; else animationIndex--; if (focusedPipeIndex === pipesAmount) noLoop(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTimeEveryMinute() {\n time.increment();\n flipClock(time.copy());\n setTimeout(updateTimeEveryMinute, 60000);\n }", "function updateEveryMinute() {\n var interval = setInterval(update, 1000 * 60)\n}", "function refresh () {\n // If the ticker is not running already...\n ...
[ "0.6989338", "0.6910424", "0.6772006", "0.67140764", "0.66397476", "0.6564741", "0.6493163", "0.64645714", "0.64138275", "0.6410152", "0.63766956", "0.6360742", "0.6347203", "0.6343222", "0.6321748", "0.63145185", "0.6313648", "0.63086504", "0.6308331", "0.6290789", "0.625544...
0.0
-1
Scrambles the given array
function scramble(arr) { let scrambled = []; let maxI = arr.length; for (let i = 0; i < maxI; i++) { // Appends the value at a random index in arr to the scrambled array and deletes it from arr let randomIndex = Math.floor(Math.random() * arr.length); scrambled.push(arr.splice(randomIndex, 1)[0]); } return scrambled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scramble(arr) {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n return arr;\n }", "function getScramble() {\n var moves = new Array();\n moves['r'] = new Array(\"R...
[ "0.7952491", "0.722264", "0.6984794", "0.6961692", "0.6949615", "0.6908133", "0.681594", "0.67960477", "0.6733211", "0.658768", "0.65754473", "0.656906", "0.6533714", "0.65197945", "0.6506822", "0.64934915", "0.64804894", "0.645834", "0.645834", "0.645834", "0.6449667", "0....
0.7307965
1
check if quality params (min, max, etc) are correct & change to correct values
function checkParamsCorrect(wObj, mode) { var val = wObj.val().replace('+', ''); var wParent = wObj.parents('.sub_row.txt'); var check_name = wObj.attr('name').toString(); var input_val = parseFloat(val).toFixed(1); //check if input value is float or if value is negative, otherwise return saved correct value if((!checkCorrectFloat(val) || parseFloat(val) < 0 && wObj.parents('.quality-param-intro.percent_block').length == 0) && checkCorrectFloat(wObj.attr('data-tempval'))) { wObj.val(wObj.attr('data-tempval')); return; } //check where were changes if(check_name.length != check_name.replace('BASE', '').length) {//base parameter was changed //remove dump value wParent.find('.quality-dump-table-item').remove(); wParent.find('.quality-dump-table-intro').removeClass('active'); wParent.find('.add-dump-table, .add_straight_or').removeClass('inactive'); //change min & max values var minObj = wParent.find('input[name*="MIN"]'); if(minObj.length == 1 && parseFloat(minObj.val()) > input_val) {//if base val < min -> change min minObj.val(input_val); } var maxObj = wParent.find('input[name*="MAX"]'); if(maxObj.length == 1 && parseFloat(maxObj.val()) < input_val) {//if base val > max -> change max maxObj.val(input_val); } } else { if(check_name.length != check_name.replace('DUMP', '').length) {//dump parameter was changed var min_el = wParent.find('input[name*="MIN"]:first'); var max_el = wParent.find('input[name*="MAX"]:first'); var kb_check = true; if(mode == true && check_name.length != check_name.replace('MIN', '').length) {//keyboard input & input is dump min //check if input is in first & unused section kb_check = false; var min_check_val = parseFloat(min_el.val()); if(min_check_val > input_val) { kb_check = false; input_val = min_check_val; wObj.val(input_val); } else { wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ var temp_check = parseFloat($(temp_c_obj).find('input[type="text"][name*="MIN"]').val()); if(temp_check < input_val) {//founded section lefter than input value kb_check = true; } }); } if(kb_check == false) {//new value is ok -> change this section right margin var right_min_margins_list = wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item'); if(right_min_margins_list.length > 0) { var temp_lowest_max_val = 1000000; right_min_margins_list.each(function(temp_ind, temp_c_obj){ var temp_chk_val = parseFloat($(temp_c_obj).find('input[type="text"][name*="MIN"]').val()); if(temp_lowest_max_val > temp_chk_val) { temp_lowest_max_val = temp_chk_val; } }); if(temp_lowest_max_val < 1000000) { wObj.parents('.quality-dump-table-item').find('input[name*="MAX"]').val(temp_lowest_max_val); } } else { kb_check = true; } } } if(kb_check) {//interface input or keyboard input need check if(check_name.length != check_name.replace('MIN', '').length) {//dump min parameter was changed var compare_max_val = -1000000; //get other dump max values to prevent intersections (highest of dump maximums that lower than check value) var compare_max_val_higher = 1000000; //get other dump max values to prevent intersections (lowest of dump maximums that higher than check value) var max_dump_el = wObj.parents('.quality-dump-table-item').find('input[name*="MAX"]'); var all_min_equal_check = 0; var old_val = 0; var step_val = parseFloat(wObj.parents('.quality-dump-table-intro').attr('data-step')); //looking for larger of dump maximums that lower than check value wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ $(temp_c_obj).find('input[type="text"][name*="MAX"]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) < input_val && compare_max_val < parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) <= Math.round(parseFloat(max_dump_el.val()) * 100)) { compare_max_val = parseFloat($(cObj).val()); all_min_equal_check++; } if(parseFloat($(cObj).val()) > input_val && compare_max_val_higher > parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) < Math.round(parseFloat(max_dump_el.val()) * 100)) { compare_max_val_higher = parseFloat($(cObj).val()); } }); //check if all dump minimiums are same as dump maximums -> then set user's value (or min if user value is not correct) if(all_min_equal_check == 1) {//all maximums are equal -> check minimums old_val = compare_max_val; $(temp_c_obj).find('input[type="text"][name*="MIN"]').each(function(ind, cObj){ if(old_val != $(cObj).val()) { old_val = $(cObj).val(); all_min_equal_check++; return; } }); } }); if(all_min_equal_check == 1) {//if all dump minimiums are same as dump maximums -> set user's value (if user value is correct) if(input_val < parseFloat(min_el.val())) { wObj.val(min_el.val()); } else if(input_val > parseFloat(max_el.val())) { wObj.val(max_el.val()); } else if(parseFloat(max_dump_el.val()) < input_val) { wObj.val(max_dump_el.val()); } } else if(compare_max_val >= input_val) {//reset value if intersects with other dumps wObj.val(compare_max_val); } else if(min_el.length == 1 && input_val < parseFloat(min_el.val())) {//compare value with min value wObj.val(min_el.val()); } else if(compare_max_val_higher != 1000000 && checkCorrectFloat(wObj.attr('data-tempval')) && parseFloat(wObj.attr('data-tempval')) >= compare_max_val_higher && input_val < compare_max_val_higher ) {//check intersect with other section (new section contain other sections) wObj.val(compare_max_val_higher); } else if(compare_max_val == -1000000 && compare_max_val_higher < 100000 && compare_max_val_higher > input_val || compare_max_val_higher < 100000 && compare_max_val_higher == (input_val + step_val) ) { wObj.val(compare_max_val_higher); } else { if(parseFloat(max_dump_el.val()) < input_val) {//compare with dump max parameter (check if dump min > dump max) wObj.val(max_dump_el.val()); } else if(input_val + step_val == max_dump_el.val()) {//need check next section (if exists that have same dump maximum and other dump minimum -> prevent intersection) wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ if(max_dump_el.val() == $(temp_c_obj).find('input[type="text"][name*="MAX"]').val() && max_dump_el.val() != $(temp_c_obj).find('input[type="text"][name*="MIN"]').val() ) {//found intersection wObj.val(max_dump_el.val()); return; } }); } } } else if(check_name.length != check_name.replace('MAX', '').length) {//dump max parameter was changed var compare_min_val = 1000000;//get other dump min values to prevent intersections (lowest of dump minimums that higher than check value) var compare_min_val_lower = -1000000;//get other dump min values to prevent intersections (highest of dump minimums that lower than check value) var min_dump_el = wObj.parents('.quality-dump-table-item').find('input[name*="MIN"]'); var all_min_equal_check = 0; var old_val = 0; var step_val = parseFloat(wObj.parents('.quality-dump-table-intro').attr('data-step')); //looking for lower of dump minimums that higher than check value wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ $(temp_c_obj).find('input[type="text"][name*="MIN"]').each(function(ind, cObj){ if(compare_min_val > parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) > Math.round(parseFloat(min_dump_el.val()) * 100)) { compare_min_val = $(cObj).val(); all_min_equal_check++; } if(parseFloat($(cObj).val()) < input_val && compare_min_val_lower < parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) > Math.round(parseFloat(min_dump_el.val()) * 100)) { compare_min_val_lower = parseFloat($(cObj).val()); } }); //check if all dump minimiums are same as dump maximums -> then set user's value (if user value is correct) if(all_min_equal_check == 1) {//all minimiums are equal -> check maximums old_val = compare_min_val; $(temp_c_obj).find('input[type="text"][name*="MAX"]').each(function(ind, cObj){ if(old_val != $(cObj).val()) { old_val = $(cObj).val(); all_min_equal_check++; return; } }); } }); if(all_min_equal_check == 1) {//if all dump minimiums are same as dump maximums -> set user's value (if user value is correct) if(input_val < parseFloat(min_el.val())) { wObj.val(min_el.val()); } else if(input_val > parseFloat(max_el.val())) { wObj.val(max_el.val()); } else if(parseFloat(min_dump_el.val()) > input_val) { wObj.val(min_dump_el.val()); } } else if(parseFloat(compare_min_val) < input_val) {//reset value if intersects with other dumps wObj.val(compare_min_val); } else if(max_el.length == 1 && input_val > parseFloat(max_el.val())) {//compare value with max value wObj.val(max_el.val()); } // else if(compare_min_val == 1000000 && compare_min_val_lower > -1000000 && compare_min_val_lower < input_val) // { // console.log('1'); // } // else if(compare_min_val_lower > -1000000 && compare_max_val_higher == (input_val - step_val)) // { // console.log('2'); // } else {//compare with dump min parameter (check if dump max < dump min) if(parseFloat(min_dump_el.val()) > input_val) { wObj.val(min_dump_el.val()); } else if(Math.round((input_val - step_val) * 100) == Math.round(parseFloat(min_dump_el.val()) * 100)) {//need check next section (if exists that have same dump maximum and other dump minimum -> prevent intersection) wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ if(min_dump_el.val() == $(temp_c_obj).find('input[type="text"][name*="MIN"]').val() && min_dump_el.val() != $(temp_c_obj).find('input[type="text"][name*="MAX"]').val() ) {//found intersection wObj.val(min_dump_el.val()); return; } }); } } } else if(check_name.length != check_name.replace('DISCOUNT', '').length) {//if percent value if(input_val < -100) { wObj.val(-100); } else if(input_val > 100) { wObj.val(100); } else {//check if input_val value is not 0.5 var temp_val = val.toString(); if(temp_val.length != temp_val.replace('.', '').length) {//there is dot in float value -> check last value var precision_val = temp_val.split('.'); var check_precision_int = parseInt(precision_val[1].substr(0, 1)); var plus_val = (check_precision_int < 8 ? 0 : (input_val < 0 ? -1 : 1)); var res_val = plus_val + parseInt(precision_val[0]); if(check_precision_int > 2 && check_precision_int < 8) { res_val = (input_val < 0 && res_val == 0 ? '-' : '') + res_val + '.5'; } input_val = res_val; wObj.val(input_val); } } } } } else if(check_name.length != check_name.replace('MIN', '').length) {//min parameter was changed //compare value with base value var base_el = wParent.find('input[name*="BASE"]'); if(base_el.length == 1 && input_val > parseFloat(base_el.val())) {//change if min < base wObj.val(base_el.val()); } else {//change dump min values wParent.find('.quality-dump-table-item .quality-param-intro input[name*=MIN]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) < input_val) { $(cObj).val(input_val); //check dump max value (change if dump min > dump max) var temp_dump_max = $(cObj).parents('.quality-dump-table-item').find('input[name*=MAX]'); if(temp_dump_max.length == 1 && input_val > parseFloat(temp_dump_max.val())) { temp_dump_max.val(input_val); } } }); } } else if(check_name.length != check_name.replace('MAX', '').length) {//max parameter was changed //compare value with base value var base_el = wParent.find('input[name*="BASE"]'); if(base_el.length == 1 && input_val < parseFloat(base_el.val())) {//change if max > base wObj.val(base_el.val()); } else {//change dump max values wParent.find('.quality-dump-table-item .quality-param-intro input[name*=MAX]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) > input_val) { $(cObj).val(input_val); //check dump min value (change if dump max < dump min) var temp_dump_min = $(cObj).parents('.quality-dump-table-item').find('input[name*=MIN]'); if(temp_dump_min.length == 1 && input_val < parseFloat(temp_dump_min.val())) { temp_dump_min.val(input_val); } } }); } } } //correct result val if it have > 1 digits after dot var res_val = val.toString(); var temp_val = res_val.split('.'); if(typeof temp_val[1] != 'undefined' && temp_val[1].toString().length > 1) { wObj.val(parseFloat(val).toFixed(1)); } else { wObj.val(parseFloat(val)); } //set correct data as temporary wObj.attr('data-tempval', val); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set quality(value) {}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "get quality() {}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQu...
[ "0.76522565", "0.685296", "0.685296", "0.685296", "0.685296", "0.6773027", "0.6488042", "0.6488042", "0.6488042", "0.6488042", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "...
0.602445
95
This function check the message is empty or not
function checkMessage(){ //get the message from the text field var message=document.getElementById("message").value; //when the message is empty, show the error message in the div which id is invalidmessage and return false if(message.length==0) { document.getElementById("invalidmessage").innerHTML="This field is required"; return false; } //when the message is not empty, return true if(message.length!=0) { document.getElementById("invalidmessage").innerHTML=""; return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "messageIsValid(messageText) {\n return messageText.length > 0;\n }", "function check_message_content()\n {\n var val = $(\"#sms_content\").val();\n if(val.trim().length == 0 )\n {\n alert(\"Please Enter Message\");\n return false;\n }\n else\n {\n return true;\n ...
[ "0.8118761", "0.7435108", "0.7228619", "0.71116185", "0.67072123", "0.66997784", "0.66961217", "0.66620976", "0.6633871", "0.6633401", "0.65545267", "0.64940137", "0.64691967", "0.64190483", "0.6411557", "0.6346142", "0.63197523", "0.63104206", "0.6288672", "0.6267536", "0.62...
0.6403483
15
This function check the email format and is empty or not
function checkEmail() { //get the email from the text field var email=document.getElementById("email").value; //when the email is empty, show the error message in the div which id is invalidemail and return false if(email.length==0) { document.getElementById("invalidemail").innerHTML="This field is required"; return false; } //when the email is not empty, check the email format if(email.length!=0) { document.getElementById("invalidemail").innerHTML=""; /* check the email format, if it is a valid address which should contain a single @ symbol with at least 2 characters before it, and contain a single . with at least 2 characters after it. The . must be after the @. When the format is wrong, return false and show the error message in the div which id is invalidemail*/ if(!/^([0-9a-zA-Z\-]{2,})+@([0-9A-Za-z])+\.([0-9a-zA-Z]{2,})+$/.test(email)) { document.getElementById("invalidemail").innerHTML="Please enter a valid email address"; return false; } //when the email format is right, return true if(/^([0-9a-zA-Z\-]{2,})+@([0-9A-Za-z])+\.([0-9a-zA-Z]{2,})+$/.test(email)) { document.getElementById("invalidemail").innerHTML=""; return true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isEmail(src){\r\n src = lrtrim(src);\r\n if(isEmpty(src)){ //????????\r\n return true;\r\n }\r\n\r\n if((src.indexOf(\"@\")<=0) || (src.indexOf(\".\")<=0) || (src.indexOf(\".\")==src.length-1)){\r\n return false;\r\n }\r\n if((src.indexOf(\"@\")>src.indexOf(\".\")) || (src.indexOf(\"@\")...
[ "0.74725217", "0.74389255", "0.7394451", "0.7300666", "0.7287701", "0.7226614", "0.719154", "0.7173728", "0.7171827", "0.71708316", "0.7139826", "0.7138879", "0.71083045", "0.710582", "0.70877147", "0.70877147", "0.70768815", "0.7073165", "0.7050943", "0.7050357", "0.703677",...
0.0
-1
This function is check name, message and email are all correct or not
function send() { checkName(); checkMessage(); checkEmail(); //when all are right, show the successful message in the div which id is sendsuccessfully and return true if(checkName()==true && checkMessage()==true && checkEmail()==true) { document.getElementById("sendsuccessfully").innerHTML="Message successfully sent"; return true; } //if one of name, message and email is not right, return false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkForm() {\n // set empty string to make it easy to return + boolean to check whether it's successful\n var isSuccess = true;\n var message = \"\";\n\n var patt = new RegExp(\"@\")\n if (!patt.test(this.email)) {\n isSuccess = false;\n message += \"Email\\n\"\n }\n\n ...
[ "0.72876227", "0.72092676", "0.7138774", "0.6939998", "0.68874925", "0.68563795", "0.6844679", "0.68276906", "0.67909074", "0.67764115", "0.673086", "0.67229444", "0.6699208", "0.66854614", "0.66806394", "0.66806203", "0.66764474", "0.6672204", "0.66700214", "0.66590005", "0....
0.0
-1
representa al car de proveedor que va a estar insertado en el contenedor
function DatProveedor(id, nom, cor, cel) { return '<div class="row padding-0">' + ' <div class="col">' + ' <div class="card">' + ' <div class="card-header" id="headingOne">' + ' <h2 class="row mb-0">' + ' <div class="col-8" data-toggle="collapse"' + ' data-target="#collapseExample' + id + '" aria-expanded="false"' + ' aria-controls="collapseExample' + id + '">' + ' <div >' + ' <h5>' + nom + '</h5>' + ' </div>' + ' </div>' + ' <div class="col-4">' + ' <button type="button" onclick="deleProvee(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </h2>' + ' </div>' + ' <div class="collapse" id="collapseExample' + id + '">' + ' <div class="card card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">👷</span>' + ' </div>' + ' <input type="text" id="ProveeNombre' + id + '" value="' + nom + '" class="form-control"' + ' placeholder="Nombre del prodcuto"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📧</span>' + ' </div>' + ' <input type="text" id="ProveeCorreoElectonico' + id + '" value="' + cor + '" class="form-control"' + ' placeholder="Correo electronico"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📱</span>' + ' </div>' + ' <input type="text" id="ProveeCelular' + id + '" value="' + cel + '" class="form-control"' + ' placeholder="Celular"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuProvee(' + id + ')" id="NewProdut"' + ' class="btn btn-success btn-block">Actualizar' + ' Proveedor</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertarNodoP(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar,ne,contenido){\r\n\tvar nuevo = new nodo();\r\n\tnuevo.proceso = proceso;\r\n\tnuevo.nombre=nombre;\r\n\tnuevo.tiempo = tiempo;\r\n\tnuevo.quantum = quantum;\r\n\tnuevo.Tllegada=tll;\r\n\tnuevo.Tfinalizacion=tf;\r\n\tnuevo.Turnarround=tr;\...
[ "0.6409173", "0.6152649", "0.61303747", "0.59899956", "0.59842926", "0.5980979", "0.58879983", "0.5838787", "0.5826788", "0.5826788", "0.57586384", "0.5756563", "0.5740777", "0.57175094", "0.5716188", "0.5716019", "0.5715275", "0.56862587", "0.56861013", "0.5677974", "0.56741...
0.0
-1
Cart de categorias que va a ser insertado en el contenedor
function DatCategoriMP(id, Nombre) { return '<option value="' + id + '">' + Nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pesquisarCategoria() {\n apiService.get('/api/produtopromocional/fornecedorcategoria', null,\n categoriaLoadCompleted,\n categoriaLoadFailed);\n }", "function addProductCategory(){\r\n\t var categoryId = 0;\r\n\t var categoryName,categoryOptions ;\r\n\...
[ "0.6485429", "0.6356314", "0.6313848", "0.62323105", "0.61262023", "0.60931385", "0.6025986", "0.60150266", "0.6000567", "0.5921758", "0.5843933", "0.5839238", "0.5836382", "0.5816684", "0.5801649", "0.5798945", "0.57898134", "0.5787598", "0.57755375", "0.57716054", "0.576244...
0.0
-1
Cart de proveedor que va a ser insertado en el contenedor
function DatProveMP(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCart(nome, valor, info){\n let list = {\n nome: nome,\n valor: valor,\n informacao: info\n };\n setPedido(oldArray => [...oldArray, list])\n setAcao(!acao)\n //await AsyncStorage.setItem('@pedido', JSON.stringify(pedido));\n }", "...
[ "0.68824446", "0.68560034", "0.6795127", "0.67779076", "0.6773141", "0.66966105", "0.6679588", "0.66137606", "0.6580311", "0.6567401", "0.65085727", "0.65066904", "0.6482573", "0.64625907", "0.64479834", "0.64133143", "0.6396837", "0.63860077", "0.63860077", "0.6356494", "0.6...
0.0
-1
Mantenimiento de la categoria de producto
function ManteniCatPro() { return '<div class="row">' + ' <div class="col">' + ' <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">' + ' <li class="nav-item" role="presentation">' + ' <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home"' + ' role="tab" aria-controls="pills-home" aria-selected="true">Insertar' + ' Categoria</a>' + ' </li>' + ' <li class="nav-item" role="presentation">' + ' <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile"' + ' role="tab" aria-controls="pills-profile" aria-selected="false">Actualizar' + ' Categoria</a>' + ' </li>' + ' </ul>' + ' <div class="tab-content" id="pills-tabContent">' + ' <div class="tab-pane fade show active" id="pills-home" role="tabpanel"' + ' aria-labelledby="pills-home-tab">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col-4">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">📋</span>' + ' </div>' + ' <select class="custom-select" id="inputGroupSelect01">' + ' <option selected>Icono</option>' + DatIcont() + ' </select>' + ' </div>' + ' </div>' + ' <div class="col-8">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">📺</span>' + ' </div>' + ' <input type="text" class="form-control" id="cateText"' + ' placeholder="Nombre de la Categoria" aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" id="AgregCat"' + ' class="btn btn-success btn-block">Agregar' + ' Catehoria</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="tab-pane fade" id="pills-profile" role="tabpanel"' + ' aria-labelledby="pills-profile-tab">' + '<div' + 'style="background: #eceff1; width: 100%; height: 400px; display: grid;grid-template-columns:100% ;grid-row: 5; ;grid-row-gap: 1px; overflow:scroll;overflow-x: hidden;">' + '<div class="accordion" id="ContentCategori" style="width: 100%; height: 400px;overflow:scroll;overflow-x: hidden;">' + '</div>' + '<!------------------------------------>' + '</div>' + ' </div>' + ' </div>' + ' </div>' + '</div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pesquisarCategoria() {\n apiService.get('/api/produtopromocional/fornecedorcategoria', null,\n categoriaLoadCompleted,\n categoriaLoadFailed);\n }", "function categType (category){\n if(category == 1){\n category = \"Limpeza\";\n }...
[ "0.6824172", "0.62069243", "0.61706656", "0.6168234", "0.6161641", "0.6113012", "0.6080224", "0.6078219", "0.60684687", "0.60113174", "0.6008036", "0.59902835", "0.59564185", "0.59369546", "0.5920561", "0.5902915", "0.5897361", "0.584797", "0.5830665", "0.57977146", "0.579167...
0.0
-1
Cart de datos de los iconos que se van a mostrar el en contenedor
function DatIcont() { return '<option value="1">👕</option>' + '<option value="2">👟</option>' + '<option value="3">👞</option>' + '<option value="4">👖</option>' + '<option value="5">💻</option>' + '<option value="6">📱</option>' + '<option value="7">🔫</option>' + '<option value="8">👙</option>' + '<option value="9">🎮</option>' + '<option value="10">🎸</option>' + '<option value="11">♟</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cargarIconos(){\n // iconos para mostrar puntos\n estilosMarcadores[\"carga\"] = styles.marcadorCarga();\n estilosMarcadores[\"traslado\"] = styles.marcadorTraslado();\n }", "function cargarIconos(){\n // iconos para mostrar puntos\n estilosA...
[ "0.7962983", "0.7633804", "0.6897386", "0.68852496", "0.66509026", "0.6532745", "0.637194", "0.63657635", "0.6291417", "0.6248317", "0.6210424", "0.61642706", "0.6088295", "0.6083301", "0.6069628", "0.604909", "0.60433394", "0.59284854", "0.5928148", "0.5905255", "0.58991957"...
0.0
-1
Car de proveedores que se van a mostrar
function DatCaegor(id, icon, Nombre) { return '<div class="row padding-0">' + ' <div class="col">' + ' <div class="card">' + ' <div class="card-header" id="headingOne">' + ' <h2 class="row mb-0">' + ' <div class="col-8" data-toggle="collapse"' + ' data-target="#collapseExample' + id + '" aria-expanded="false"' + ' aria-controls="collapseExample' + id + '">' + ' <div class="col">' + ' <h5>' + icon + Nombre + '</h5>' + ' </div>' + ' </div>' + ' <div class="col-4">' + ' <a id="NewProdut" onclick="catproDelet(' + id + ')"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</a>' + ' </div>' + ' </h2>' + ' </div>' + ' <div class="collapse" id="collapseExample' + id + '">' + ' <div class="card card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📋</span>' + ' </div>' + ' <select class="custom-select"' + ' id="catSelet' + id + '">' + ' <option selected>' + icon + '</option>' + DatIcont() + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📺</span>' + ' </div>' + ' <input type="text" class="form-control" id="catTex' + id + '"' + ' placeholder="Nombre de la Categoria" value = "' + Nombre + '"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="catproUp(' + id + ')"' + ' class="btn btn-success btn-block">Agregar' + ' Catehoria</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Carro(marca) {\n this.marca = marca;\n this.numPuertas;\n //method set num puertas\n this.setPuertas = function(numPuert) {\n this.numPuertas = numPuert;\n };\n this.getDescrip = function() {\n return \"Este es un carro: \" + this.marca + \" que tiene \" + this.numPuertas + \" Puertas!\";\n }...
[ "0.6447861", "0.63530546", "0.6286339", "0.6138603", "0.61293054", "0.6076284", "0.6044103", "0.6036169", "0.60360914", "0.6033844", "0.6032603", "0.6019213", "0.60176426", "0.6009436", "0.6006949", "0.59953874", "0.5994543", "0.59943336", "0.59932256", "0.598679", "0.5977851...
0.0
-1
contenerdor de que se usara para mostrar los datos de los departamentos
function DatDepart(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button" data-toggle="collapse"' + ' data-target="#collapseOne' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapseOne' + id + '">' + '🌎 ' + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleDepart(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + ' <div id="collapseOne' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <input type="text" id="TextDepart' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre del departamento"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuDepart(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Departamento</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewDepartments(){\n // Select all data from the departmenets table\n connection.query(`SELECT * FROM department_table`, (err, res) => {\n // If error log error\n if (err) throw err;\n // Display the data in a table format...\n ...
[ "0.6860861", "0.6847966", "0.66786003", "0.6615127", "0.65699804", "0.6525777", "0.65161496", "0.6483957", "0.6481827", "0.64705336", "0.6459466", "0.6452986", "0.6435863", "0.643057", "0.6323305", "0.6319397", "0.6314972", "0.63025004", "0.62924814", "0.6255458", "0.624899",...
0.0
-1
contenedor de quera unsa para mostrar los datos de los ciudades
function DatCiu(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button" data-toggle="collapse"' + ' data-target="#collapci' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapci' + id + '">' + '🗾 ' + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleCiuda(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + ' <div id="collapci' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LDepInt' + id + '">' + ' <option' + ' selected>' + ' Deàrtamento' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🗾</span>' + ' </div>' + ' <input type="text" id="textCiud' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre de la ciudad"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuCiuda(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Ciudad</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\n }", "function cargarCgg_res_beneficiarioCtrls(){\n if(inInfoPersona.CRPER_CODIGO...
[ "0.6151246", "0.61081386", "0.6103436", "0.61009806", "0.5991096", "0.59855425", "0.59708446", "0.59583426", "0.59121543", "0.59019583", "0.5845118", "0.58449155", "0.5820936", "0.5813818", "0.5803204", "0.5803204", "0.5803204", "0.58001643", "0.5792509", "0.57750016", "0.574...
0.0
-1
Contenerodot que sera usado para mostrar los datos de las ciudades existentes
function DatDistrito(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button"' + ' data-toggle="collapse"' + ' data-target="#collapseOne' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapseOne' + id + '">' + "🌃 " + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleDistri(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + '' + ' <div id="collapseOne' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LDepDist' + id + '" onchange="IncetDat(' + id + ')">' + ' <option' + ' selected>' + ' Deàrtamento' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🗾</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LCiuDist' + id + '" >' + ' <option' + ' selected>' + ' Ciudad' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌃</span>' + ' </div>' + ' <input' + ' type="text" id="textDist' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre de la Distrito"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button' + ' type="button" onclick="ActuDistri(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Distrito</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes...
[ "0.62147325", "0.62147325", "0.62147325", "0.6159115", "0.61129856", "0.60013026", "0.5920522", "0.58973265", "0.5827785", "0.5803361", "0.57637894", "0.57512033", "0.5745033", "0.57262886", "0.57129127", "0.56810206", "0.56801534", "0.56613994", "0.56613994", "0.56467205", "...
0.0
-1
car para de departamento para listado
function DatLisDepart(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "function deptList() {\n return con...
[ "0.6952878", "0.6720546", "0.6717672", "0.66944206", "0.66405255", "0.6623729", "0.6491975", "0.6464398", "0.64349055", "0.6414195", "0.6366378", "0.6347393", "0.62816465", "0.6280265", "0.62619394", "0.62166506", "0.61779237", "0.61597264", "0.61573666", "0.61376184", "0.613...
0.0
-1
car para de ciudad para listado
function DatLisCiry(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "obtenerTodosCiudad() {\n return axios.get(`${API_URL}/v1/ciudad`);\n }", "function cambiarCiudad(id_p){\n\t$.post(\"/contacts/get_city\",{id_pais:id_p},function(data){\n\t\tvar obj_int = jQuery.parseJSON(data);\n\t\tvar opciones = \"\";\n\t\tif(obj_int){\n\t\t\t$.each(obj_int, function(i, item) {\t\n\t...
[ "0.7260528", "0.7181152", "0.6979924", "0.6458958", "0.64531326", "0.6435541", "0.633695", "0.6231", "0.62308604", "0.6204876", "0.614203", "0.61321753", "0.61061156", "0.609788", "0.605269", "0.6017308", "0.60037667", "0.5988487", "0.5951727", "0.5934652", "0.5920953", "0....
0.0
-1
opccion que sirve para poder listar las ciudades dependindo de la celencion del departamento en cada itent
function IncetDat(id) { var auxc = new ApiCiudad("", "", ""); var id_conte_lis = "#LCiuDist" + id; var id_conte_depart = "#LDepDist" + id; $(id_conte_lis).html(" "); // limpia la casilla para que se pueda ver var id_depart = $(id_conte_depart).val(); var dat = { llave: id_conte_lis, idCiu: 0, iddist: id_depart }; auxc.idDepart = id_depart; auxc.List(dat); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cargaCombosDependientes() {\n\tcargaCombosMarcaCanal();\n\tcargaCombosClientes();\n\tcargaCombosZonas();\n\tif (parametrosRecargaCombos.length > 0) {\n\t\trecargaComboMultiple(parametrosRecargaCombos); \n\t\tparametrosRecargaCombos = new Array();\n\t}\n}", "function getCuponesPorIndustria(idIndustria){\...
[ "0.60088456", "0.59903276", "0.59153014", "0.5846319", "0.5771146", "0.57610315", "0.5730923", "0.57061726", "0.5665966", "0.5642549", "0.5595356", "0.55906004", "0.5590081", "0.5555582", "0.55520856", "0.5538663", "0.5535483", "0.5516374", "0.5492069", "0.54724574", "0.54720...
0.5283222
40
escucha del Boton para insertar un file
function clickFile() { var idchan = '#imgLog'; var idchankey = 'imgLog'; $(idchan).click();//obliga un click const imgFile = document.getElementById(idchankey); imgFile.addEventListener("change", function () { const file = this.files[0]; localStorage.setItem("foto", JSON.stringify(file)); console.log(file); var yave = '#ImganItenAdmin'; if (file) { const render = new FileReader(); render.addEventListener("load", function (event) { console.log(this.result); $(yave).attr("src", this.result); }); render.readAsDataURL(file); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertFile(file) {\n uploadFile(file, function (url) {\n var text = \"[img]\" + url + \"[/img]\";\n typeInTextarea(text);\n });\n }", "function writeFile() {\n const ERR_MESS_WRITE = \"TODO: Trouble writing file\";\n\n todocl.dbx.filesUpload({\n contents: todocl...
[ "0.68735355", "0.64927906", "0.62077713", "0.61448157", "0.6049083", "0.5986293", "0.5915053", "0.58955085", "0.587885", "0.58744836", "0.58110887", "0.5807969", "0.57775176", "0.5752871", "0.57418543", "0.5734034", "0.5730628", "0.5725759", "0.57099086", "0.56894624", "0.561...
0.0
-1
escucha del Boton para insertar un file
function clickFileItenAdmin(id) { var idchan = '#imgLog' + id; var idchankey = 'imgLog' + id; $(idchan).click(); const imgFile = document.getElementById(idchankey); imgFile.addEventListener("change", function () { const file = this.files[0]; var tmppath = URL.createObjectURL(this.files[0]); var yave = '#ImganItenAdmin' + id; if (file) { const render = new FileReader(); render.addEventListener("load", function (event) { console.log(this.result); $(yave).attr("src", this.result); $(yave).attr("value", $(idchan).val()); }); render.readAsDataURL(file); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertFile(file) {\n uploadFile(file, function (url) {\n var text = \"[img]\" + url + \"[/img]\";\n typeInTextarea(text);\n });\n }", "function writeFile() {\n const ERR_MESS_WRITE = \"TODO: Trouble writing file\";\n\n todocl.dbx.filesUpload({\n contents: todocl...
[ "0.68741524", "0.64936984", "0.62079936", "0.61457", "0.6047881", "0.5987449", "0.5914952", "0.5896543", "0.587927", "0.5875236", "0.5811419", "0.5808281", "0.5778995", "0.5752688", "0.57424104", "0.57340324", "0.57310104", "0.57255894", "0.5709673", "0.5689511", "0.56180185"...
0.0
-1
codigo directamente extraido de store el cual da la informacion del pedido
function CarritoCompra(id, montoT, depart, city, dis, direc, estd) { console.log(estd + montoT); return '<div class="container">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col-7">' + ' <h5>Productos en Carrito</h5>' + ' </div>' + ' <div class="col-5">' + ' <div class="form-group" style="width: 100%;">' + ' <div class="input-group">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">S/.</span>' + ' </div>' + ' <input value="' + montoT + '" type="text" disabled class="form-control" placeholder="00.0" aria-label="Direccion" aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <div id="containerprodutIten' + id + '" style="background: #eceff1; width: 100%; height: 250px; display: grid;grid-template-columns:100% ; grid-row-gap: 1px; overflow:scroll;overflow-x: hidden;">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + depart + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + city + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + dis + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <div class="form-group" style="width: 100%;">' + ' <div class="input-group">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">🌍</span>' + ' </div>' + ' <input value="' + direc + '" disabled type="text" class="form-control" placeholder="Direccion" aria-label="Direccion" aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="conteSetP ' + id + '" onclick="Setprogressbar3(' + id + ')">' + ' <ul id="stp-dsjdhj" value="0" class="Setprogressbar padre">' + '<li value="1" class="li-iten-sep hijo ' + ((estd > 0) ? 'active' : '') + '">Pedido Recivido</li>' + '<li value="2" class="li-iten-sep hijo ' + ((estd > 1) ? 'active' : '') + '">Enviado</li>' + '<li value="3" class="li-iten-sep hijo ' + ((estd > 2) ? 'active' : '') + '">Paquete entregado</li>' + ' </ul>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row my-1">' + ' <button onclick="ActualiEstate(' + id + ')" type="button" id="NewProdut" class="btn btn-success btn-block">Actualizar' + ' Estado</button>' + ' </div>' + ' </div>' + ' <div class="row my-1">' + ' </div>' + ' </div>' + ' <div Class="row">' + ' ' + ' </div>' + '</div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "departamento() {\n return super.informacion('departamento');\n }", "getTransactionID() {\n let length = window.Database.DB.bought.length;\n var lastID = window.Database.DB.bought[length - 1].transaction_id;\n\n return parseInt(lastID) + 1;\n }", "siguiente() {\n this.ultimo +...
[ "0.57631433", "0.57293063", "0.56946915", "0.56655455", "0.56218576", "0.5588355", "0.55774826", "0.5539779", "0.5488174", "0.5485053", "0.5478459", "0.5471516", "0.5451059", "0.54306024", "0.54273885", "0.5418395", "0.54030174", "0.5362091", "0.53156966", "0.5313468", "0.529...
0.0
-1
Make the scroll to top button scroll onto the screen.
function animatedSpawn() { let button = document.getElementById("to-top-button-container"), speed = 2, currentPos = -100; button.style.bottom = -100+"px"; let animateInterval = setInterval(() => { currentPos += speed; if (currentPos >= 20 && speed > 0) { currentPos = 20; speed = -2 * speed; } if (currentPos <= 20 && speed < 0) { clearInterval(animateInterval); } button.style.bottom = currentPos+"px"; }, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function scrollToTop() {\n\troot.scrollTo({\n\t\ttop: 0,\n\t\tbehavior: \"smooth\"\n\t});\n}", "function scrollToTop () {\n //getting the currentPosition position of the button\n let ...
[ "0.84501475", "0.8380421", "0.8304555", "0.8081443", "0.7991134", "0.79668593", "0.7950554", "0.7948563", "0.7930293", "0.78774136", "0.7875608", "0.78726774", "0.78673387", "0.78286725", "0.7823822", "0.78231", "0.78216136", "0.78036195", "0.77948207", "0.7794795", "0.777193...
0.0
-1
Make the scroll to top button scroll off the screen.
function animatedDespawn() { let button = document.getElementById("to-top-button-container"), speed = 2, currentPos = 20; button.style.bottom = 20+"px"; let animateInterval = setInterval(() => { currentPos -= speed; if (currentPos <= -100 && speed > 0) { currentPos = -100; speed = -2 * speed; } if (currentPos >= -100 && speed < 0) { clearInterval(animateInterval); } button.style.bottom = currentPos+"px"; }, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function toTop() {\n document.body.scrollTop= 0;\n hideButton();\n}", "function setGoToTopBtn() {\n $toTopBtn.click(function( e ) {\n e.preventDefault();\n $( 'html, body' ).animat...
[ "0.81223875", "0.7986207", "0.7811879", "0.77617437", "0.77012914", "0.7694131", "0.76831794", "0.7659606", "0.762973", "0.7610274", "0.76081365", "0.7532701", "0.7500178", "0.74892294", "0.7474345", "0.7461487", "0.7458119", "0.7449892", "0.74492997", "0.74432147", "0.743465...
0.0
-1
Scroll user to top of page
function scrollToTop() { // safari document.body.scrollTop = 0; // other browsers document.documentElement.scrollTop = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop() {\n Reporter_1.Reporter.debug('Scroll to the top of the page');\n scrollToPoint(0, 0);\n }", "ScrollToTop() {\n /** The user is scrolled to the top of the page */\n document.body.scrollTop = 0;\n document.documentElement.scrollTo({\n top: '0',\n behavior...
[ "0.8427779", "0.8401175", "0.8137684", "0.8025861", "0.8018002", "0.80142736", "0.7993937", "0.79847014", "0.7970048", "0.79540867", "0.7936717", "0.79301775", "0.792929", "0.79064053", "0.79057753", "0.7903937", "0.79021", "0.7886774", "0.7884233", "0.78811276", "0.78683335"...
0.74897224
61
find the (or one of them) smallest square who have A as a corner and B on a side
function findSquare (lineA, colA, lineB, colB) { // length of a side of that square let line, col; let dim = max(abs(lineA - lineB), abs(colA - colB)); if (lineB >= lineA) line = lineA; else line = lineA - dim; if (colB >= colA) col = colA; else col = colA - dim; return [line, col, dim + 1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "minSquare() {\n var ind = -1;\n var min = L + 1;\n for (let i = 0; i < B; i++) {\n if (this.choices[i] != -1 && this.choices[i] < min) {\n min = this.choices[i];\n ind = i;\n }\n }\n return ind;\n }", "function getMinBox() ...
[ "0.69085807", "0.6315294", "0.6315294", "0.6236337", "0.6224419", "0.6206841", "0.612851", "0.6127941", "0.6090618", "0.60611093", "0.5930872", "0.58946407", "0.58901054", "0.58175117", "0.5788505", "0.577618", "0.5757049", "0.573049", "0.5715967", "0.57059723", "0.5675279", ...
0.6543187
1
We want to approximate the length of a curve representing a function y = f(x) with a<= x <= b. First, we split the interval [a, b] into n subintervals with widths h1, h2, ... , hn by defining points x1, x2 , ... , xn1 between a and b. This defines points P0, P1, P2, ... , Pn on the curve whose xcoordinates are a, x1, x2 , ... , xn1, b and ycoordinates f(a), f(x1), ..., f(xn1), f(b) . By connecting these points, we obtain a polygonal path approximating the curve. Our task is to approximate the length of a parabolic arc representing the curve y = x x with x in the interval [0, 1]. We will take a common step h between the points xi: h1, h2, ... , hn = h = 1/n and we will consider the points P0, P1, P2, ... , Pn on the curve. The coordinates of each Pi are (xi, yi = xi xi). The function len_curve (or similar in other languages) takes n as parameter (number of subintervals) and returns the length of the curve. You can truncate it to 9 decimal places. alternative text
function lenCurve(n) { function seglg() { return Math.sqrt(Math.pow(n, 2) + 4 * Math.pow(k, 2) + 4 * k + 1) / Math.pow(n, 2); } var s = 0; for (var k = 0; k < n; k++) { s += seglg(); } return Math.floor(s * 1e9) / 1e9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function curveLength({\n fun,\n curveStartParam,\n curveEndParam,\n\n //optionals:\n funIsAVector, //true for t |-> [x,y], false for y=f(x) \n INTEGRATION_POINTS_LIM,\n calculationAccuracy,\n STARTING_EXPONENT_FOR_2,\n SAFETY_INTERACTIONS_LIM...
[ "0.6769427", "0.58905506", "0.5680087", "0.56241846", "0.5448378", "0.54405534", "0.5429641", "0.5369592", "0.53184587", "0.5288144", "0.5247235", "0.5210314", "0.5191495", "0.5182685", "0.5181171", "0.51801234", "0.5155166", "0.509476", "0.50758535", "0.5073273", "0.50525904...
0.6514496
1
This is required to get the initial backgroundcolor of an element. The element might have it's bgcolor already set before the transition. Transition should continue/start from this color. This will be used only once.
function getElementBG(elm) { var bg = getComputedStyle(elm).backgroundColor; bg = bg.match(/\((.*)\)/)[1]; bg = bg.split(","); for (var i = 0; i < bg.length; i++) { bg[i] = parseInt(bg[i], 10); } if (bg.length > 3) { bg.pop(); } return bg; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_background_color(element) {\n\t\t\tvar rgb = $(element).css('background-color');\n\t\t\trgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\t\t function hex(x) {return (\"0\" + parseInt(x).toString(16)).slice(-2);}\n\t\t return \"0x\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n\t\t}",...
[ "0.67202586", "0.66573995", "0.6308161", "0.624183", "0.624183", "0.6237227", "0.61843956", "0.6155856", "0.61313987", "0.607703", "0.60034966", "0.59706646", "0.59679496", "0.5951827", "0.59298515", "0.5918471", "0.5871218", "0.5788366", "0.57687056", "0.57489926", "0.573663...
0.5929184
15
A function to generate random numbers. Will be needed to generate random RGB value between 0255.
function random() { if (arguments.length > 2) { return 0; } switch (arguments.length) { case 0: return Math.random(); case 1: return Math.round(Math.random() * arguments[0]); case 2: var min = arguments[0]; var max = arguments[1]; return Math.round(Math.random() * (max - min) + min); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRGB() {\n\tvar temp = Math.floor(Math.random() * 256 + 0);\t\t\t \n\treturn temp;\n}", "function randomRgb(){\n\treturn Math.floor(Math.random() * 256) + 1;\n}", "function generateRandomRGB() {\n return (Math.floor(Math.random() * 250) + 1);\n}", "function randomRGB() {\n return Math.flo...
[ "0.84629315", "0.8441063", "0.8434318", "0.8310729", "0.8310729", "0.8310729", "0.83100295", "0.8299048", "0.82989496", "0.8291947", "0.82895803", "0.82887584", "0.8250796", "0.8248388", "0.81949645", "0.8120089", "0.8116231", "0.80770665", "0.8058588", "0.8044184", "0.804125...
0.0
-1
Generates a random RGB value.
function generateRGB(min, max) { var min = min || 0; var max = min || 255; var color = []; for (var i = 0; i < 3; i++) { var num = random(min, max); color.push(num); } return color; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function random_rgb() {\n var o = Math.round, r = Math.random, s = 255;\n return 'rgb(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ',' + 0.5 + ')';\n }", "function randomRGB() {\n\treturn Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 25...
[ "0.85708714", "0.8509267", "0.85029066", "0.85029066", "0.85029066", "0.8496365", "0.8478096", "0.8449106", "0.8444731", "0.8441071", "0.84302837", "0.8419111", "0.841833", "0.84080756", "0.8392647", "0.83915836", "0.8388949", "0.8388949", "0.83758664", "0.8332442", "0.832568...
0.0
-1
Calculates the distance between the RGB values. We need to know the distance between two colors so that we can calculate the increment values for R, G, and B.
function calculateDistance(colorArray1, colorArray2) { var distance = []; for (var i = 0; i < colorArray1.length; i++) { distance.push(Math.abs(colorArray1[i] - colorArray2[i])); } return distance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rgbDistance (r, g, b) {\n const [r1, g1, b1] = this\n const rMean = Math.round((r1 + r) / 2)\n const [dr, dg, db] = [r1 - r, g1 - g, b1 - b]\n const [dr2, dg2, db2] = [dr * dr, dg * dg, db * db]\n const distanceSq =\n (((512 + rMean) * dr2) >> 8) + (4 * dg2) + (((767 - rMean) * db2) >> 8)\n ...
[ "0.854238", "0.8022885", "0.7506141", "0.74120796", "0.7324789", "0.7211602", "0.71846014", "0.7160846", "0.7160846", "0.70001143", "0.69889766", "0.69381386", "0.68725896", "0.6802981", "0.6688095", "0.66868526", "0.6551371", "0.654201", "0.65148985", "0.6450123", "0.642014"...
0.68192565
13
Calculates the increment values for R, G, and B using distance, fps, and duration. This calculation can be made in many different ways.
function calculateIncrement(distanceArray, fps, duration) { var fps = fps || 30; var duration = duration || 1; var increment = []; for (var i = 0; i < distanceArray.length; i++) { var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration))); if (incr == 0) { incr = 1; } increment.push(incr); } return increment; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateIncrement(distanceArray, fps, duration) {\n var fps\t\t\t= fps || 30;\n var duration\t= duration || 1;\n var increment\t= [];\n for (var i = 0; i < distanceArray.length; i++) {\n var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration)));\n if (incr == 0) {\n ...
[ "0.71802247", "0.56769407", "0.5670698", "0.56258494", "0.5583371", "0.5529605", "0.55150187", "0.55066925", "0.54881376", "0.5478588", "0.5415672", "0.5410037", "0.53956777", "0.539482", "0.5379198", "0.5377735", "0.53744066", "0.53606665", "0.5356631", "0.5353362", "0.53515...
0.71370786
1
Converts RGB array [32,64,128] to HEX string 204080 It's easier to apply HEX color than RGB color.
function rgb2hex(colorArray) { var color = []; for (var i = 0; i < colorArray.length; i++) { var hex = colorArray[i].toString(16); if (hex.length < 2) { hex = "0" + hex; } color.push(hex); } return "#" + color.join(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rgbToHex (array) {\n var hexChars = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F'};\n var result = '';\n for (var i = 0; i < array.length; i++) {\n var d1 = parseInt(array[i] / 16);\n result += hexChars[d1];\n var d2 = arra...
[ "0.7556023", "0.73206246", "0.71314526", "0.71244615", "0.7061715", "0.7028961", "0.70205355", "0.6992772", "0.6978075", "0.6971078", "0.6907708", "0.68681127", "0.68507344", "0.6831597", "0.65897954", "0.6584251", "0.6574992", "0.65680873", "0.65485245", "0.65251356", "0.651...
0.7285543
2
==================== Transition Initiator ====================
function startTransition() { clearInterval(transHandler); targetColor = generateRGB(); distance = calculateDistance(currentColor, targetColor); increment = calculateIncrement(distance, fps, duration); transHandler = setInterval(function() { transition(); }, 1000/fps); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start() {\n classes.isTransition = true;\n original.addEventListener('transitionend', end);\n }", "stateTransition(){return}", "function initTransition(transition) {\r\n const currTransition = JSON.parse(JSON.stringify(newTransition))\r\n\r\n for (let player in currTransition)\r\n cu...
[ "0.67823213", "0.66147184", "0.65315574", "0.6438239", "0.6239101", "0.62327784", "0.62327784", "0.62327784", "0.6154615", "0.6144665", "0.6142564", "0.6139299", "0.6124338", "0.6103054", "0.60899705", "0.6081108", "0.6056934", "0.60539234", "0.60092807", "0.59602845", "0.595...
0.6356494
4
==================== Transition Calculator ====================
function transition() { // checking R if (currentColor[0] > targetColor[0]) { currentColor[0] -= increment[0]; if (currentColor[0] <= targetColor[0]) { increment[0] = 0; } } else { currentColor[0] += increment[0]; if (currentColor[0] >= targetColor[0]) { increment[0] = 0; } } // checking G if (currentColor[1] > targetColor[1]) { currentColor[1] -= increment[1]; if (currentColor[1] <= targetColor[1]) { increment[1] = 0; } } else { currentColor[1] += increment[1]; if (currentColor[1] >= targetColor[1]) { increment[1] = 0; } } // checking B if (currentColor[2] > targetColor[2]) { currentColor[2] -= increment[2]; if (currentColor[2] <= targetColor[2]) { increment[2] = 0; } } else { currentColor[2] += increment[2]; if (currentColor[2] >= targetColor[2]) { increment[2] = 0; } } // applying the new modified color transElement.style.backgroundColor = rgb2hex(currentColor); // transition ended. start a new one if (increment[0] == 0 && increment[1] == 0 && increment[2] == 0) { startTransition(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transition() {\n generateNewColour();\n\n for (var key in Colour) {\n if(colour[key] > nextColour[key]) {\n colour[key] -= delta[key];\n if(colour[key] <= nextColour[key]) {\n delta[key] = 0;\n ...
[ "0.6630601", "0.6541303", "0.6538054", "0.63178617", "0.63018835", "0.62306374", "0.6152068", "0.61283296", "0.60233706", "0.5993718", "0.5973599", "0.59581375", "0.59218556", "0.59086174", "0.5902313", "0.58689725", "0.5867377", "0.5865813", "0.58509195", "0.58506835", "0.58...
0.67392343
0
var y = 0 var a = 200 var b = 160 var c = 180 var g = 140
function setup() { createCanvas(800, 800); strokeWeight(0); //Triangulos negros en pareja punta arriba for (var x = 160; x < 320; x = x + 20) { for (var y = 160; y < 320; y = y + 20) { fill(0); triangle(x, y, x, y + 20, x + 20, y + 20); noFill(); } } //linea superior rectángulo blanco linea 1 y 5 + triangulo pareja //punta abajo for (var a = 200; a < 320; a = a + 80) { for (var b = 160; b < 320; b = b + 80) { fill(255) rect(a, b, 40, 20); noFill(); fill(0); triangle(a, b, a + 20, b, a + 20, b + 20); triangle(a + 20, b, a + 40, b, a + 40, b + 20); noFill(); } } //rectangulos línea 2 y 6 + triangulos punta abajo en pareja for (var c = 180; c < 320; c = c + 80) { for (var d = 180; d < 320; d = d + 80) { fill(255) rect(c, d, 40, 20); noFill(); fill(0); triangle(c, d, c + 20, d, c + 20, d + 20); triangle(c + 20, d, c + 40, d, c + 40, d + 20); noFill(); } } //rectangulos linea 3 y 7 + triangulos punta abajo en parejas for (var e = 160; e < 320; e = e + 80) { for (var f = 200; f < 320; f = f + 80) { fill(255) rect(e, f, 40, 20); noFill(); fill(0) triangle(e, f, e + 20, f, e + 20, f + 20); triangle(e + 20, f, e + 40, f, e + 40, f + 20); noFill(); } } // Rectángulos linea 4 y 8 + triangulos en pareja punta abajo for (var g = 140; g < 318; g = g + 80) { for (var h = 220; h < 318; h = h + 80) { fill(255) rect(g, h, 40, 20); noFill(); fill(0); triangle(g, h, g + 20, h, g + 20, h + 20); triangle(g + 20, h, g + 40, h, g + 40, h + 20); noFill(); fill(255) rect(140, 220, 20, 20) noFill(); fill(255) rect(140, 300, 20, 20); noFill(); fill(255) rect(320, 220, 20, 20); noFill(); fill(255) rect(320, 300, 20, 20); noFill(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_point_y(c) {\n\treturn 94 + c * 75;\n}", "function Ay(t,e,n){var r=t.getResolution(n),i=my(t,e[0],e[1],r,!1),o=py(i,2),a=o[0],s=o[1],l=my(t,e[2],e[3],r,!0),u=py(l,2),c=u[0],d=u[1];return{minX:a,minY:s,maxX:c,maxY:d}}", "function n(e,t,a,l){return{x:e,y:t,width:a,height:l}}", "function fillConsta...
[ "0.6391052", "0.61730516", "0.61370814", "0.6108678", "0.6094876", "0.60914975", "0.6068002", "0.598916", "0.5968246", "0.5942434", "0.5940826", "0.591112", "0.58868766", "0.58752006", "0.5857745", "0.58426124", "0.5839398", "0.58363694", "0.58009154", "0.57877654", "0.578482...
0.0
-1
END OF ISSUE RELATED VIEWS
function resetPreHeights(reverse) { // Set height of pre-columns to 100% of parent - bad CSS problem. var objectivePres = $('.explorer-resource-section-listing-item-pre, .explorer-resource-listing-labels-pre'); var i, objectivePre; for (i = 0; i < objectivePres.length; i++){ objectivePre = $(objectivePres[i]); if (reverse && reverse === true){ objectivePre.height(objectivePre.parent().find( '.explorer-resource-listing-body-content').height()); } else { objectivePre.height(objectivePre.parent().height()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function View() {\n }", "function LView(){}", "function LView() { }", "function LView() { }", "function LView() {}", "function LView() {}", "function LView() {}", "function View(){}", "function TView() { }", "function TView() { }", "function directUserFromViewInfo() {\n if (nextSt...
[ "0.64383423", "0.6414478", "0.6263517", "0.6263517", "0.61634195", "0.61634195", "0.61634195", "0.6117753", "0.6082107", "0.6082107", "0.6082054", "0.6058179", "0.6007057", "0.6007057", "0.6007057", "0.6007057", "0.59570825", "0.5939924", "0.5938893", "0.5938893", "0.5938893"...
0.0
-1
=================================== GET FUNCTIONS ===================================
function getCustomer(res, mysql, context, complete, customerID){ mysql.pool.query("SELECT * FROM customers WHERE customer_id = ?", customerID, function(err, result){ if(err){ next(err); return; } context.customer = result[0]; complete(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_data() {}", "get() {}", "_get () {\n throw new Error('_get not implemented')\n }", "function getInfo(){\t\t\n\treturn cachedInfo;\n}", "static get attributes() {}", "getData () {\n }", "private public function m246() {}", "get(name){\n var result=this.getPath(name);\n return...
[ "0.65289366", "0.6266646", "0.617106", "0.6085017", "0.6076472", "0.60344386", "0.59548247", "0.5851485", "0.58506924", "0.58433396", "0.5839511", "0.58211654", "0.58146363", "0.5781314", "0.5762597", "0.5675487", "0.56609714", "0.5650497", "0.56503266", "0.56429654", "0.5632...
0.0
-1
get list on the basis on
function getplayersByTeamId(teamId) { var wkUrl = config.apiUrl + 'playersListByTeam/'; return $http({ url: wkUrl, params: { teamId: teamId }, method: 'GET', isArray: true }).then(success, fail) function success(resp) { return resp.data; } function fail(error) { var msg = "Error getting list: " + error; //log.logError(msg, error, null, true); throw error; // so caller can see it } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLists() {}", "list(filterFn = this._list_filter) {\n const list = this.get('list') || [];\n return list.reduce((a, i) => {\n if (filterFn(i)) {\n a.push(i);\n }\n return a;\n }, []);\n }", "list() {\n const listings = t...
[ "0.6232334", "0.61338603", "0.61326045", "0.60422355", "0.5983285", "0.5833092", "0.58275867", "0.5807358", "0.57620746", "0.5690261", "0.5684759", "0.5680404", "0.56588656", "0.5641119", "0.563561", "0.56234515", "0.56033593", "0.55922544", "0.5586068", "0.55778646", "0.5527...
0.0
-1
get list on the basis on
function getPlayersListByMatchId(homeTeamId, awayTeamId) { var wkUrl = config.apiUrl + 'teamsListByMatchId/'; return $http({ url: wkUrl, params: { homeTeamId: homeTeamId, awayTeamId: awayTeamId }, method: 'GET', isArray: true }).then(success, fail) function success(resp) { return resp.data; } function fail(error) { var msg = "Error getting list: " + error; //log.logError(msg, error, null, true); throw error; // so caller can see it } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLists() {}", "list(filterFn = this._list_filter) {\n const list = this.get('list') || [];\n return list.reduce((a, i) => {\n if (filterFn(i)) {\n a.push(i);\n }\n return a;\n }, []);\n }", "list() {\n const listings = t...
[ "0.6232334", "0.61338603", "0.61326045", "0.60422355", "0.5983285", "0.5833092", "0.58275867", "0.5807358", "0.57620746", "0.5690261", "0.5684759", "0.5680404", "0.56588656", "0.5641119", "0.563561", "0.56234515", "0.56033593", "0.55922544", "0.5586068", "0.55778646", "0.5527...
0.0
-1
Computes all the neccessary variables for drawing a connection. Singleton.
function ConstraintSolver(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addConnection(){\n\n\n\t\t//draw horizontal part of connection spouses\n\t\tarrayConnections.push(new Connection2(arrayRelationship[0].begining_x_middle_horizontal, arrayRelationship[0].begining_y_middle_horizo1l, arrayRelationship[0].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[0].begini...
[ "0.6440213", "0.64037186", "0.60672873", "0.59336716", "0.5864556", "0.58592737", "0.5836391", "0.57788295", "0.57110137", "0.5693107", "0.5689007", "0.5672295", "0.56445223", "0.56256276", "0.5607018", "0.5601943", "0.558718", "0.5569125", "0.55452734", "0.5527118", "0.55082...
0.0
-1
The popup dialog uses this function to insert the Selected Entry, Selected Page, or Reciprocal Association.
function insertSelectedObject(obj_title, obj_id, obj_class, obj_permalink, field, blog_id) { // Check if this is a reciprocal association, or just a standard Selected // Entry/Page. if ( jQuery('input#'+field+'.reciprocal-object').length ) { // If a reciprocal association already exists, we need to delete it // before creating a new association. if ( jQuery('input#'+field+'.reciprocal-object').val() ) { deleteReciprocalAssociation( field, jQuery('input#'+field+'.reciprocal-object').val() ); createReciprocalAssociation( obj_title, obj_id, obj_class, obj_permalink, field, blog_id ); } // No existing association exists, so just create the new reciprocal // entry association. else { createReciprocalAssociation( obj_title, obj_id, obj_class, obj_permalink, field, blog_id ); } } // This is just a standard Selected Entries or Selected Pages insert. else { // Create a list item populated with title, edit, view, and remove links. var $li = createObjectListing( obj_title, obj_id, obj_class, obj_permalink, blog_id ); // Insert the list item with the button, preview, etc into the field area. jQuery('ul#custom-field-selected-objects_'+field) .append($li) var objects = new Array(); objects[0] = jQuery('input#'+field).val(); objects.push(obj_id); jQuery('input#'+field).val( objects.join(',') ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function InsertAnchor() {\r\n anchorSelectedText = getSelectedText();\r\n anchorSelectedText = anchorSelectedText.toString();\r\n var options = SP.UI.$create_DialogOptions();\r\n options.args = getSelectedText();\r\n options.title = \"Please enter the anchor name\";\r\n options.width = 400;\r\n ...
[ "0.6523596", "0.6398907", "0.6202359", "0.6027628", "0.5991657", "0.5936035", "0.58974165", "0.5896731", "0.57702357", "0.57117313", "0.5699788", "0.5677821", "0.56710464", "0.56627035", "0.56620127", "0.5650618", "0.562125", "0.55912447", "0.55584615", "0.55424947", "0.55280...
0.6296618
2
Create an object listing for an entry or page. This is used for Selected Entry, Selected Page, and Reciprocal Objects.
function createObjectListing(obj_title, obj_id, obj_class, obj_permalink, blog_id) { var $preview = jQuery('<span/>') .addClass('obj-title') .text(obj_title); // Edit link. var $edit = jQuery('<a/>') .attr('href', CMSScriptURI+'?__mode=view&_type='+obj_class+'&id='+obj_id+'&blog_id='+blog_id) .addClass('edit') .attr('target', '_blank') .attr('title', 'Edit in a new window') .html('<img src="'+StaticURI+'images/status_icons/draft.gif" width="9" height="9" alt="Edit" />'); // View link. var $view; if (obj_permalink) { $view = jQuery('<a/>') .attr('href', obj_permalink) .addClass('view') .attr('target', '_blank') .attr('title', 'View in a new window') .html('<img src="'+StaticURI+'images/status_icons/view.gif" width="13" height="9" alt="View" />'); } // Delete button. var $remove = jQuery('<img/>') .addClass('remove') .attr('title', 'Remove selected entry') .attr('alt', 'Remove selected entry') .attr('src', StaticURI+'images/status_icons/close.gif') .attr('width', 9) .attr('height', 9); // Insert all of the above into a list item. var $li = jQuery('<li/>') .attr('id', 'obj-'+obj_id) .append($preview) .append($edit) .append($view) .append($remove); return $li; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newListEntry(entry) {\n var listEntry = newElement('li');\n var listText = newElement('span');\n var actionContainer = newElement('div');\n var runButton = createIconButton('power-off', true, null, entry, _run);\n var editButton = createIconButton('edit', true, null, entry, _edit);\n var...
[ "0.5590515", "0.557202", "0.55439574", "0.553152", "0.54849875", "0.53939384", "0.5362691", "0.53309596", "0.5288687", "0.52574104", "0.5232727", "0.5219121", "0.52162504", "0.52097124", "0.5176707", "0.51550287", "0.5143397", "0.5116031", "0.5105161", "0.5089701", "0.5076542...
0.6963715
0
Create the reciprocal entry association. This happens after selecting an entry from the popup.
function createReciprocalAssociation(obj_title, recip_obj_id, obj_class, obj_permalink, field, blog_id) { jQuery('input#'+field+'.reciprocal-object').val( recip_obj_id ); // Create a list item populated with title, edit, view, and remove links. var $li = createObjectListing( obj_title, recip_obj_id, obj_class, obj_permalink, blog_id ); jQuery('ul#custom-field-reciprocal-'+field) .append($li); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRelationship() {\n this.mapTypeForm.reset();\n this.submitted = false;\n this.displayModal = true;\n this.isedit = false;\n }", "function create_related_entry_dialog(data) {\n let dialog = elementFactory({ type: \"div\" });\n let lst_wrap = elementFactory({ type: \"div\", ...
[ "0.5368761", "0.5305341", "0.5257124", "0.5232171", "0.51533616", "0.51533616", "0.51533616", "0.51533616", "0.5139111", "0.51008296", "0.50781304", "0.5073649", "0.5039997", "0.5020927", "0.5015054", "0.496429", "0.4951728", "0.4947675", "0.49365643", "0.49352273", "0.488835...
0.6117439
0