Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
get the list of all players excluding current player
getOtherPlayerList() { let observable = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](observer => { this.socket.on('serverUpdatePlayerList', (msg) => { var output = this.getAllOtherPlayersList(msg); observer.next(output); }); return () => { this.disconnectSocket(); }; }); return observable; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAllOtherPlayersList(allPlayers) {\n console.log(\"all players: \" + allPlayers);\n var output = [];\n allPlayers.forEach((player) => {\n if (player.Id != this.socket.id) {\n output.push(player);\n }\n });\n console.log(\"all other players: ...
[ "0.7257226", "0.69411683", "0.68079126", "0.67732334", "0.6686449", "0.66828924", "0.66386527", "0.6516458", "0.65144897", "0.647565", "0.64249885", "0.6396365", "0.6321484", "0.62742126", "0.62732077", "0.62045807", "0.62041897", "0.6194216", "0.61882687", "0.6176238", "0.61...
0.0
-1
Adds a DataPoint to |this| with the specified time and value. DataPoints are assumed to be received in chronological order.
addPoint(timeTicks, value) { const time = new Date(timeTicks); this.dataPoints_.push(new DataPoint(time, value)); if (this.dataPoints_.length > MAX_STATS_DATA_POINT_BUFFER_SIZE) { this.dataPoints_.shift(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DataPoint(ts, value) {\n // Timestamp of the DataPoint [Date]\n this.t = ts;\n // Value [Number]\n this.v = value;\n}", "function addDataPoint() {\n // add a new data point to the dataset\n // var now = vis.moment();\n // dataset.add({\n // x: now,\n // y: y(now / 1000)\n /...
[ "0.63708514", "0.61181086", "0.58761024", "0.584897", "0.578221", "0.5456121", "0.53846174", "0.5295532", "0.5280697", "0.52230346", "0.5213346", "0.5185427", "0.51432675", "0.51043075", "0.5094851", "0.5094851", "0.50717664", "0.50651485", "0.50619066", "0.50361395", "0.4977...
0.74504495
0
Returns a list containing the values of the data series at |count| points, starting at |startTime|, and |stepSize| milliseconds apart. Caches values, so showing/hiding individual data series is fast.
getValues(startTime, stepSize, count) { // Use cached values, if we can. if (this.cacheStartTime_ === startTime && this.cacheStepSize_ === stepSize && this.cacheValues_.length === count) { return this.cacheValues_; } // Do all the work. this.cacheValues_ = this.getValuesInternal_(startTime, stepSize, count); this.cacheStartTime_ = startTime; this.cacheStepSize_ = stepSize; return this.cacheValues_; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getValuesInternal_(startTime, stepSize, count) {\n const values = [];\n let nextPoint = 0;\n let currentValue = 0;\n let time = startTime;\n for (let i = 0; i < count; ++i) {\n while (nextPoint < this.dataPoints_.length &&\n this.dataPoints_[nextPoint].time < time) {\n curren...
[ "0.7949372", "0.5502136", "0.5275158", "0.5233204", "0.515285", "0.5107172", "0.5053928", "0.50388145", "0.50058025", "0.49254194", "0.4901491", "0.48911986", "0.48689213", "0.48393866", "0.4835799", "0.4820728", "0.47670266", "0.47472343", "0.47414076", "0.47237545", "0.4670...
0.70340323
1
Returns the cached |values| in the specified time period.
getValuesInternal_(startTime, stepSize, count) { const values = []; let nextPoint = 0; let currentValue = 0; let time = startTime; for (let i = 0; i < count; ++i) { while (nextPoint < this.dataPoints_.length && this.dataPoints_[nextPoint].time < time) { currentValue = this.dataPoints_[nextPoint].value; ++nextPoint; } values[i] = currentValue; time += stepSize; } return values; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getValues(startTime, stepSize, count) {\n // Use cached values, if we can.\n if (this.cacheStartTime_ === startTime &&\n this.cacheStepSize_ === stepSize &&\n this.cacheValues_.length === count) {\n return this.cacheValues_;\n }\n\n // Do all the work.\n this.cacheValues_ = this.g...
[ "0.7175927", "0.579356", "0.579356", "0.55021775", "0.5450643", "0.5441113", "0.5408668", "0.5340319", "0.52413726", "0.51009965", "0.5085878", "0.5084537", "0.50807005", "0.50741255", "0.5020163", "0.5007443", "0.49845633", "0.49801472", "0.4963073", "0.4924633", "0.49241197...
0.59739953
1
To validate the POST PUT requestes
function userValidating(post) { const postSchema = { 'title': Joi.string().min(3).required(), 'desc': Joi.string().required(), 'numberOfLikes':Joi.number().required() } return Joi.validate(post, postSchema); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validatePut() {\n return true\n}", "function san_val_put_company(req, res, next) {\n let errors = [];\n\n // checking if request contains body and all necessary paramters\n if (\n req.body &&\n req.params.COMPANY_ID &&\n (req.body.COMPANY_NAME ||\n req.body.C...
[ "0.77935976", "0.65498644", "0.645182", "0.6132676", "0.611337", "0.61037457", "0.6102296", "0.61022615", "0.6091944", "0.60917646", "0.60834396", "0.60297185", "0.60134286", "0.6008321", "0.5983211", "0.5928611", "0.5914858", "0.59109133", "0.5903403", "0.5892364", "0.586977...
0.0
-1
Process On Terminate Function
function onTerminate() { console.log('') // Handle Database Connection switch (config.schema.get('db.driver')) { case 'mongo': dbMongo.closeConnection() break case 'mysql': dbMySQL.closeConnection() break } // Gracefully Exit process.exit(0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onTerminate() {}", "_onExit() {\n super._onExit()\n super.kill()\n }", "function terminate() {\n\tt.murder(eventHandlers.cb);\n}", "function endMonitorProcess( signal, err ) {\n\n if ( err ) {\n \n log.e( 'Received error from ondeath?' + err ); \n\n releaseOracleResources( 2 ); \n\n\n } else...
[ "0.8056823", "0.70037967", "0.6967343", "0.6862495", "0.6821444", "0.679979", "0.67964846", "0.6760413", "0.6698206", "0.66550475", "0.6637419", "0.662789", "0.66210735", "0.65994316", "0.6591299", "0.6562848", "0.65348005", "0.6460739", "0.6455078", "0.6393499", "0.63908046"...
0.6654438
10
Returns the current date
function getCurrentDate() { var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) { dd = '0'+dd } if(mm<10) { mm = '0'+mm } today = yyyy + '-' + mm + '-' + dd; return today; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sc_currentDate() {\n return new Date();\n}", "function CurrentDate(){\n var today = new Date();\n var dd = today.getDate();\n var mm = today.getMonth()+1;\n var yyyy = today.getFullYear();\n if(dd<10){dd='0'+dd}\n if(mm<10){mm='0'+mm}\n today = mm+'/'+d...
[ "0.86594594", "0.84389967", "0.83948004", "0.8334861", "0.83152723", "0.8295576", "0.82777315", "0.8275042", "0.8185778", "0.8184289", "0.8143182", "0.8140003", "0.81310153", "0.81298274", "0.8125518", "0.80962473", "0.80596393", "0.80360407", "0.8015244", "0.799693", "0.7979...
0.7893115
25
Reads json file and passes data to parser method
function readTextFile(file) { var rawFile = new XMLHttpRequest(); rawFile.open("GET", file, false); rawFile.onreadystatechange = function () { if(rawFile.readyState === 4) { if(rawFile.status === 200 || rawFile.status == 0) { var allText = rawFile.responseText; var obj = JSON.parse(allText); var str = JSON.stringify(obj, null, 2); parseJSON(obj); } } } rawFile.send(null); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reader (filename,callback){\n\n\tfs.readFile(filename, function (err, data) {\n\t\tif (err) {\n\t\t\tthrow err;\n\t\t}\n\t\t\n\t\tvar parsedText = JSON.parse(data)\n\n\t\tcallback(parsedText);\n\t});\n\n}", "loadJson() {\n return readFile(this.jsonPath, { encoding: 'utf8' }).then((jsonText) => {\...
[ "0.67824835", "0.6726265", "0.6695549", "0.6536521", "0.6478231", "0.64763534", "0.6452149", "0.64507335", "0.6448424", "0.6391008", "0.63832694", "0.6361461", "0.6313841", "0.6299634", "0.6297305", "0.6260001", "0.6248647", "0.62397015", "0.62390524", "0.622761", "0.6219928"...
0.0
-1
Parses json file and calls db write methods
function parseJSON(data) { document.write(data) for (var date in data) { if (data.hasOwnProperty(date)) { //console.log(date + " -> " + data[date]); var day = data[date]; //console.log("Date: " + date) writeDateData(date); for (var meal in day) { if (day.hasOwnProperty(meal)) { //console.log(meal + " -> " + day[meal]) var mealOfTheDay = day[meal]; for (var loc in mealOfTheDay) { if (mealOfTheDay.hasOwnProperty(loc)) { //console.log(loc + " -> " + mealOfTheDay[loc]) var menuItems = mealOfTheDay[loc]; if (menuItems.length > 1) { for (var menuItem in menuItems) { writeUserData(date, meal, loc, menuItems[menuItem]) } } else { writeUserData(date, meal, "Burton", menuItems[0]) writeUserData(date, meal, "East Hall", menuItems[0]) writeUserData(date, meal, "Sayles Hill Café", menuItems[0]) writeUserData(date, meal, "Weitz Café", menuItems[0]) /*console.log("There should be no specials at this time") console.log("Date" + date) console.log("Meal" + meal) console.log("Location" + loc) console.log(menuItems[0])*/ } } } } } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeFile() {\n const fs = require(\"fs\");\n fs.readFile(\"src/database.json\", \"utf8\", (err, jsonString) => {\n //error checkign to make sure that the database is read correctly\n if (err) {\n //This line will print if an error occurs\n console.log(\"Error reading file from disk:\", ...
[ "0.6860506", "0.65818477", "0.6333148", "0.6280978", "0.627536", "0.6262113", "0.6189909", "0.61827916", "0.61372495", "0.6128318", "0.606334", "0.5987601", "0.59530705", "0.59397733", "0.58932877", "0.58763736", "0.5875181", "0.5843882", "0.58392274", "0.58118874", "0.579077...
0.0
-1
Writes food data to masterData database
function writeUserData(date, meal, location, food) { firebase.database().ref(`masterData`).push().set({ date : date, meal : meal, location : location, food : food }); document.write("Successfully wrote " + food + " to master db") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeStock(x){\n database.ref('/').update({\n Food: x\n })\n }", "function writeToArchive(food) {\n firebase.database().ref('foodArchive').push().set({\n food : food\n });\n}", "function writeStock(x){\n database.ref('/').update({\n Food:x\n })\n}", "function writeDataInt...
[ "0.6487674", "0.64178115", "0.6354973", "0.6253716", "0.6202341", "0.6094093", "0.6038725", "0.5960817", "0.5937026", "0.59279096", "0.59090024", "0.5897781", "0.588479", "0.58187705", "0.5793781", "0.5792784", "0.577725", "0.5767684", "0.576122", "0.5753659", "0.57479596", ...
0.74519974
0
Writes food to archive database
function writeToArchive(food) { firebase.database().ref('foodArchive').push().set({ food : food }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeStock(x){\n database.ref('/').update({\n Food: x\n })\n }", "function writeStock(x){\n database.ref('/').update({\n Food:x\n })\n}", "function writeUserData(date, meal, location, food) {\n firebase.database().ref(`masterData`).push().set({\n date : date,\n meal : meal,\n ...
[ "0.6566954", "0.63741714", "0.62838346", "0.62368333", "0.602272", "0.6016315", "0.59534913", "0.5855415", "0.58547926", "0.5844566", "0.5824655", "0.58016104", "0.5801507", "0.57301253", "0.57039255", "0.5694352", "0.5691133", "0.5671416", "0.56539744", "0.56539273", "0.5653...
0.7830355
0
Writes date info to date db
function writeDateData(date) { firebase.database().ref(`dateData`).push().set({ date : date }); document.write("Successfully wrote " + date + " to date db") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function write_dos_date(buf, date) {\n\tif(typeof date === \"string\") date = new Date(date);\n\tvar hms = date.getHours();\n\thms = hms << 6 | date.getMinutes();\n\thms = hms << 5 | (date.getSeconds()>>>1);\n\tbuf.write_shift(2, hms);\n\tvar ymd = (date.getFullYear() - 1980);\n\tymd = ymd << 4 | (date.getMonth()+...
[ "0.6638407", "0.6638407", "0.6638407", "0.6638407", "0.6625939", "0.63798", "0.6170891", "0.6144417", "0.6002292", "0.59971064", "0.5844244", "0.57393384", "0.57343763", "0.5712451", "0.57115763", "0.57115763", "0.56815004", "0.5662586", "0.5655457", "0.5617467", "0.5568135",...
0.7149188
0
Maintains date database. Removes dates that are prior to current date
function removeDates() { firebase.database().ref(`dateData`).remove() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function refreshCurrentDate() {\n\t\t\t\tdateCurrent = getDateInRange(dateCurrent, dateShadow, before, after);\n\t\t\t}", "function setPastDate() {\n const curDate = new Date();\n // curDate.setMonth(curDate.getMonth()+1);\n console.log(curDate);\n \n for (let i = 0; i < accounts.length; i++) {\n ...
[ "0.6364958", "0.6122942", "0.60358655", "0.5911743", "0.58935905", "0.5851424", "0.5843821", "0.5830777", "0.5826743", "0.5745396", "0.57338226", "0.5714266", "0.56157845", "0.56037474", "0.55963063", "0.55894434", "0.5560354", "0.5540093", "0.5533836", "0.55116546", "0.55042...
0.5841105
7
Maintains master database. Archives food by moving to archive db
function archiveMasterData() { var query = firebase.database().ref('masterData'); query.once("value") .then(function(snapshot) { snapshot.forEach(function(childSnapshot) { var key = childSnapshot.key; // childData will be the actual contents of the child var childData = childSnapshot.val(); var childDate = childData.date; console.log("child date " + childDate); if (Date.parse(childDate) < Date.parse(getCurrentDate())) { console.log("Archive") writeToArchive(childData.food); firebase.database().ref('masterData').child(key).remove(); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static createNewDatabase() {\n idb.open(restaurantsDb, 1, upgradeDb => {\n if (!upgradeDb.objectStoreNames.contains(restaurantsTx)) {\n upgradeDb.createObjectStore(restaurantsTx, { keypath: 'id', autoIncrement: true });\n }\n console.log('restaurants-db has been created!');\n });\n }",...
[ "0.58556265", "0.57273406", "0.56701666", "0.56268066", "0.55796015", "0.556098", "0.55478877", "0.5431047", "0.5351945", "0.5272653", "0.52718055", "0.52420247", "0.5189631", "0.51891845", "0.5162892", "0.5154225", "0.5104157", "0.5103771", "0.5101198", "0.5086682", "0.50730...
0.54298306
8
XXX: the following will not work with IE9 (requires server proxy).
function saveAs(options) { var dataURI = options.dataURI; var fileName = options.fileName; var data = dataURI; if (typeof data == "string" && window.Blob) { var parts = data.split(";base64,"); var contentType = parts[0]; var base64 = atob(parts[1]); var array = new Uint8Array(base64.length); for (var idx = 0; idx < base64.length; idx++) { array[idx] = base64.charCodeAt(idx); } data = new Blob([ array.buffer ], { type: contentType }); } if (navigator.msSaveBlob) { navigator.msSaveBlob(data, fileName); } else { var link = document.createElement("a"); link.download = fileName; data = link.href = URL.createObjectURL(data); var e = document.createEvent("MouseEvents"); e.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); link.dispatchEvent(e); setTimeout(function() { URL.revokeObjectURL(data); }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FindProxyForURLByAutoProxy(url, host) {\n\nreturn \"DIRECT\";\n}", "function ajaxCallRemotePage(url){\r\n\tif (window.XMLHttpRequest){\r\n\t\t// Non-IE browsers\r\n\t\treq = new XMLHttpRequest();\r\n\t\treq.onreadystatechange = processStateChange;\r\n\t\treq.open(\"GET\", url, false);\r\n\t\treq.setRequ...
[ "0.58006835", "0.5777379", "0.5755845", "0.5647004", "0.5631766", "0.5621737", "0.55939966", "0.55678576", "0.553245", "0.55000085", "0.548248", "0.548248", "0.5478454", "0.5460261", "0.5402878", "0.5368801", "0.5359872", "0.5356389", "0.53487295", "0.53408", "0.5336359", "...
0.0
-1
eslintdisable nomultispaces, keyspacing, indent, camelcase, spacebeforeblocks, eqeqeq, bracestyle / eslintdisable spaceinfixops, spacebeforefunctionparen, arraybracketspacing, objectcurlyspacing / eslintdisable nonestedternary, maxparams, defaultcase, noelsereturn, noempty / eslintdisable noparamreassign, novar, blockscopedvar mergeSort is stable.
function mergeSort(a, cmp) { if (a.length < 2) { return a.slice(); } function merge(a, b) { var r = [], ai = 0, bi = 0, i = 0; while (ai < a.length && bi < b.length) { if (cmp(a[ai], b[bi]) <= 0) { r[i++] = a[ai++]; } else { r[i++] = b[bi++]; } } if (ai < a.length) { r.push.apply(r, a.slice(ai)); } if (bi < b.length) { r.push.apply(r, b.slice(bi)); } return r; } return (function sort(a) { if (a.length <= 1) { return a; } var m = Math.floor(a.length / 2); var left = a.slice(0, m); var right = a.slice(m); left = sort(left); right = sort(right); return merge(left, right); })(a); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeSort(arr) {\n\n}", "sort() {\n const a = this.dict;\n const n = a.length;\n\n if( n < 2 ) { // eslint-disable-line \n } else if( n < 100 ) {\n // insertion sort\n for( let i = 1; i < n; i += 1 ) {\n const item = a[ i ];\n ...
[ "0.5849792", "0.5728862", "0.5665709", "0.5441658", "0.53172743", "0.5193221", "0.51930773", "0.5136816", "0.51197934", "0.5116091", "0.5096827", "0.5096827", "0.50954473", "0.5080192", "0.5071627", "0.49912181", "0.49540645", "0.49477163", "0.49420917", "0.4941507", "0.49388...
0.0
-1
Computes FNV1 hash See
function hashKey(str) { // 32-bit FNV-1 offset basis // See http://isthe.com/chongo/tech/comp/fnv/#FNV-param var hash = 0x811C9DC5; for (var i = 0; i < str.length; ++i) { hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24); hash ^= str.charCodeAt(i); } return hash >>> 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hashKey(str) {\n\t // 32-bit FNV-1 offset basis\n\t // See http://isthe.com/chongo/tech/comp/fnv/#FNV-param\n\t var hash = 0x811C9DC5;\n\t\n\t for (var i = 0; i < str.length; ++i) {\n\t hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);\n\t hash ^= str....
[ "0.7136497", "0.71040124", "0.6813118", "0.67335576", "0.6677014", "0.6659612", "0.6623413", "0.65920854", "0.6578311", "0.6577741", "0.65515757", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538", "0.6550538",...
0.6784726
5
eslintdisable nomultispaces, keyspacing, indent, camelcase, spacebeforeblocks, eqeqeq, bracestyle / eslintdisable spaceinfixops, spacebeforefunctionparen, arraybracketspacing, objectcurlyspacing / eslintdisable nonestedternary, maxparams, defaultcase, noelsereturn, noempty / eslintdisable noparamreassign, novar, blockscopedvar \ The code in this file, although written from scratch, is influenced by the TrueType parser/encoder in PDFKit (a CoffeeScript library for producing PDF files). PDFKit is (c) Devon Govett 2014 and released under the MIT License. \
function hasOwnProperty$1(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "adjust(reportArgs) {\n const { node, ruleError, ruleId } = reportArgs;\n const errorPrefix = `[${ruleId}]` || \"\";\n const padding = ruleError;\n /*\n FIXME: It is old and un-document way\n new RuleError(\"message\", index);\n */\n let _backwardCompatible...
[ "0.55065036", "0.5220469", "0.49711904", "0.49711904", "0.49008587", "0.48100296", "0.47325402", "0.46987206", "0.4695464", "0.4693643", "0.46882334", "0.46882334", "0.46793717", "0.46793717", "0.46726853", "0.46256745", "0.46242654", "0.46170425", "0.46170425", "0.46162334", ...
0.0
-1
var WE_HAVE_INSTRUCTIONS = 0x0100;
function CompoundGlyph(data) { this.raw = data; var ids = this.glyphIds = []; var offsets = this.idOffsets = []; while (true) { // eslint-disable-line no-constant-condition var flags = data.readShort(); offsets.push(data.offset()); ids.push(data.readShort()); if (!(flags & MORE_COMPONENTS)) { break; } data.skip(flags & ARG_1_AND_2_ARE_WORDS ? 4 : 2); if (flags & WE_HAVE_A_TWO_BY_TWO) { data.skip(8); } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) { data.skip(4); } else if (flags & WE_HAVE_A_SCALE) { data.skip(2); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Instruction() {\r\n}", "function InstructionState() { }", "function InstructionState() {}", "function InstructionState() {}", "function branch(instruction) {\n \"use strict\";\n CPU.registerVal[7] = (CPU.registerVal[7] + ((instruction & 0x80 ? instruction | 0xff00 : instruction & 0xff) << 1)...
[ "0.6216346", "0.60383075", "0.5912171", "0.5912171", "0.5794394", "0.5737801", "0.56347513", "0.55287755", "0.55096716", "0.54990965", "0.53762245", "0.5360167", "0.53586483", "0.5341367", "0.5341367", "0.5338728", "0.5293022", "0.5263305", "0.5255219", "0.52489305", "0.52457...
0.0
-1
[ PDF basic objects ]
function PDFValue(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PdfCollection(){//\n}", "function PdfDocumentTemplate(){//\n}", "function PdfFunction(dictionary){//Field\n/**\n * Internal variable to store dictionary.\n * @private\n */this.mDictionary=null;/**\n * Local variable to store the dictionary properties.\n * @priva...
[ "0.6970244", "0.67371017", "0.636111", "0.61517125", "0.61318153", "0.6119398", "0.609121", "0.60734177", "0.60572594", "0.60448736", "0.6032751", "0.5974804", "0.597314", "0.5971647", "0.5970059", "0.5967593", "0.59260446", "0.585176", "0.5822176", "0.58155864", "0.5803213",...
0.6669559
4
PDFRawImage will be used for images with transparency (PNG)
function PDFRawImage(width, height, rgb, alpha) { this.asStream = function(pdf) { var mask = new PDFStream(alpha, { Type : _("XObject"), Subtype : _("Image"), Width : width, Height : height, BitsPerComponent : 8, ColorSpace : _("DeviceGray") }, true); var stream = new PDFStream(rgb, { Type : _("XObject"), Subtype : _("Image"), Width : width, Height : height, BitsPerComponent : 8, ColorSpace : _("DeviceRGB"), SMask : pdf.attach(mask) }, true); stream._resourceName = _("I" + (++RESOURCE_COUNTER)); return stream; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createBackingImage(ctx, svg, uuid) {\n // clear canvas\n ctx.fillStyle = '#fff';\n ctx.fillRect(0, 0, 431, 241);\n\n // add backing image + qr text\n ctx.fillStyle = '#000'\n ctx.font = \"20px Overpass Mono\";\n ctx.drawImage(svg, 0, 0);\n ctx.font = \"20px Overpass Mono\";\n ctx.fillText(uuid.su...
[ "0.5632318", "0.55745983", "0.55403644", "0.5522701", "0.55181754", "0.5459202", "0.5350073", "0.53228235", "0.5311465", "0.5306489", "0.5288707", "0.5285182", "0.5280097", "0.5270298", "0.52659255", "0.5263393", "0.5256633", "0.52504617", "0.5242451", "0.5211805", "0.5187245...
0.74021757
2
XXX: to test: cloneNodes function: drawing document containing canvas with page breaking drawing document with named radio s (should not clear selection) IE9/IE10 don't support el.dataset; do they copy user data? repeating table headers/footers on page breaking forceBreak, keepTogether avoidLinks / [ local vars ]
function slice$1$1(thing) { return Array.prototype.slice.call(thing); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepareMyDataTables() {\r\n var countriesTable = \"//b[text()='Mis votos por país']/ancestor::*[position()=5]\".findNode();\r\n var votesTable = \"//b[text()='Mis votos por valor']/ancestor::*[position()=5]\".findNode();\r\n var genTable = \"//b[text()='Mis votos por géner...
[ "0.5686319", "0.54724795", "0.5464799", "0.5462179", "0.54421043", "0.5374023", "0.53189564", "0.5247129", "0.52441007", "0.52203876", "0.52170014", "0.5213313", "0.5202698", "0.51976407", "0.51976407", "0.51709276", "0.5169864", "0.5154836", "0.5128067", "0.512344", "0.50751...
0.0
-1
Create a drawing.Path for a rounded rectangle. Receives the bounding box and the borderradiuses in CSS order (topleft, topright, bottomright, bottomleft). The radiuses must be objects containing x (horiz. radius) and y (vertical radius).
function roundBox(box, rTL0, rTR0, rBR0, rBL0) { var tmp = adjustBorderRadiusForBox(box, rTL0, rTR0, rBR0, rBL0); var rTL = tmp.tl; var rTR = tmp.tr; var rBR = tmp.br; var rBL = tmp.bl; var path = new Path({ fill: null, stroke: null }); path.moveTo(box.left, box.top + rTL.y); if (rTL.x) { addArcToPath(path, box.left + rTL.x, box.top + rTL.y, { startAngle: -180, endAngle: -90, radiusX: rTL.x, radiusY: rTL.y }); } path.lineTo(box.right - rTR.x, box.top); if (rTR.x) { addArcToPath(path, box.right - rTR.x, box.top + rTR.y, { startAngle: -90, endAngle: 0, radiusX: rTR.x, radiusY: rTR.y }); } path.lineTo(box.right, box.bottom - rBR.y); if (rBR.x) { addArcToPath(path, box.right - rBR.x, box.bottom - rBR.y, { startAngle: 0, endAngle: 90, radiusX: rBR.x, radiusY: rBR.y }); } path.lineTo(box.left + rBL.x, box.bottom); if (rBL.x) { addArcToPath(path, box.left + rBL.x, box.bottom - rBL.y, { startAngle: 90, endAngle: 180, radiusX: rBL.x, radiusY: rBL.y }); } return path.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _buildRoundRectPath(x, y, width, height, radius) {\r\n var w = width, h = height,\r\n r0 = radius[0], r1 = radius[1],\r\n r2 = radius[2], r3 = radius[3],\r\n w2 = (width / 2) | 0, h2 = (height / 2) | 0;\r\n\r\n r0 < 0 && (r0 = 0);\r\n r1 < 0 && (r1 = 0);\r\n r2 < 0 && (r2...
[ "0.74293697", "0.7353971", "0.7337654", "0.7261688", "0.7244709", "0.71202064", "0.71093607", "0.70745313", "0.7054942", "0.7036854", "0.7036854", "0.6980099", "0.69381267", "0.69330275", "0.69154555", "0.68909913", "0.6779745", "0.67643076", "0.6527992", "0.65261537", "0.650...
0.73552823
1
only utility functions after this line.
function adjustBoxes(boxes) { if (/^td$/i.test(element.tagName)) { var table = nodeInfo.table; if (table && getPropertyValue(table.style, "border-collapse") == "collapse") { var tableBorderLeft = getBorder(table.style, "left").width; var tableBorderTop = getBorder(table.style, "top").width; // check if we need to adjust if (tableBorderLeft === 0 && tableBorderTop === 0) { return boxes; // nope } var tableBox = table.element.getBoundingClientRect(); var firstCell = table.element.rows[0].cells[0]; var firstCellBox = firstCell.getBoundingClientRect(); if (firstCellBox.top == tableBox.top || firstCellBox.left == tableBox.left) { return slice$1$1(boxes).map(function(box){ return { left : box.left + tableBorderLeft, top : box.top + tableBorderTop, right : box.right + tableBorderLeft, bottom : box.bottom + tableBorderTop, height : box.height, width : box.width }; }); } } } return boxes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "private public function m246() {}", "function Util() {}", "function Utils() {}", "function Utils() {}", "function _____SHARED_functions_____(){}", "static private internal function m121() {}", "function Utils(){}", "s...
[ "0.7063697", "0.6988501", "0.69618195", "0.6846959", "0.6825858", "0.6825858", "0.68105537", "0.6724413", "0.67141694", "0.67009723", "0.6695921", "0.66807383", "0.6678922", "0.66064036", "0.65313923", "0.65292424", "0.65274596", "0.650087", "0.6492906", "0.64916086", "0.6411...
0.0
-1
this function will be called to draw each border. it draws starting at origin and the resulted path must be translated/rotated to be placed in the proper position. arguments are named as if it draws the top border: `len` the length of the edge `Wtop` the width of the edge (i.e. bordertopwidth) `Wleft` the width of the left edge (borderleftwidth) `Wright` the width of the right edge `rl` and `rl` the border radius on the left and right (objects containing x and y, for horiz/vertical radius) `transform` transformation to apply
function drawEdge(color, len, Wtop, Wleft, Wright, rl, rr, transform$$1) { if (Wtop <= 0) { return; } var path, edge = new Group(); setTransform$1(edge, transform$$1); group.append(edge); sanitizeRadius(rl); sanitizeRadius(rr); // draw main border. this is the area without the rounded corners path = new Path({ fill: { color: color }, stroke: null }); edge.append(path); path.moveTo(rl.x ? Math.max(rl.x, Wleft) : 0, 0) .lineTo(len - (rr.x ? Math.max(rr.x, Wright) : 0), 0) .lineTo(len - Math.max(rr.x, Wright), Wtop) .lineTo(Math.max(rl.x, Wleft), Wtop) .close(); if (rl.x) { drawRoundCorner(Wleft, rl, [ -1, 0, 0, 1, rl.x, 0 ]); } if (rr.x) { drawRoundCorner(Wright, rr, [ 1, 0, 0, 1, len - rr.x, 0 ]); } // draws one round corner, starting at origin (needs to be // translated/rotated to be placed properly). function drawRoundCorner(Wright, r, transform$$1) { var angle = Math.PI/2 * Wright / (Wright + Wtop); // not sanitizing this one, because negative values // are useful to fill the box correctly. var ri = { x: r.x - Wright, y: r.y - Wtop }; var path = new Path({ fill: { color: color }, stroke: null }).moveTo(0, 0); setTransform$1(path, transform$$1); addArcToPath(path, 0, r.y, { startAngle: -90, endAngle: -radiansToDegrees(angle), radiusX: r.x, radiusY: r.y }); if (ri.x > 0 && ri.y > 0) { path.lineTo(ri.x * Math.cos(angle), r.y - ri.y * Math.sin(angle)); addArcToPath(path, 0, r.y, { startAngle: -radiansToDegrees(angle), endAngle: -90, radiusX: ri.x, radiusY: ri.y, anticlockwise: true }); } else if (ri.x > 0) { path.lineTo(ri.x, Wtop) .lineTo(0, Wtop); } else { path.lineTo(ri.x, Wtop) .lineTo(ri.x, 0); } edge.append(path.close()); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawEdge(color, len, Wtop, Wleft, Wright, rl, rr, transform$$1) {\n\t if (Wtop <= 0) {\n\t return;\n\t }\n\t\n\t var path, edge = new Group();\n\t setTransform$1(edge, transform$$1);\n\t group.append(edge);\n\t\n\t sanitizeRadius(rl);\n\t sanitiz...
[ "0.6513412", "0.6510739", "0.6499747", "0.59647447", "0.5811284", "0.56876016", "0.56306905", "0.55659646", "0.5536552", "0.5490116", "0.5372757", "0.5345526", "0.53385264", "0.5336191", "0.5325127", "0.5324734", "0.53119314", "0.5295348", "0.528474", "0.5275812", "0.5275482"...
0.66363215
0
draws one round corner, starting at origin (needs to be translated/rotated to be placed properly).
function drawRoundCorner(Wright, r, transform$$1) { var angle = Math.PI/2 * Wright / (Wright + Wtop); // not sanitizing this one, because negative values // are useful to fill the box correctly. var ri = { x: r.x - Wright, y: r.y - Wtop }; var path = new Path({ fill: { color: color }, stroke: null }).moveTo(0, 0); setTransform$1(path, transform$$1); addArcToPath(path, 0, r.y, { startAngle: -90, endAngle: -radiansToDegrees(angle), radiusX: r.x, radiusY: r.y }); if (ri.x > 0 && ri.y > 0) { path.lineTo(ri.x * Math.cos(angle), r.y - ri.y * Math.sin(angle)); addArcToPath(path, 0, r.y, { startAngle: -radiansToDegrees(angle), endAngle: -90, radiusX: ri.x, radiusY: ri.y, anticlockwise: true }); } else if (ri.x > 0) { path.lineTo(ri.x, Wtop) .lineTo(0, Wtop); } else { path.lineTo(ri.x, Wtop) .lineTo(ri.x, 0); } edge.append(path.close()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawRoundCorner(Wright, r, transform$$1) {\n\t var angle = Math.PI/2 * Wright / (Wright + Wtop);\n\t\n\t // not sanitizing this one, because negative values\n\t // are useful to fill the box correctly.\n\t var ri = {\n\t x: r.x - Wright,\n\t ...
[ "0.675623", "0.6561048", "0.655816", "0.64326656", "0.62747943", "0.59803766", "0.5978996", "0.59567374", "0.59404546", "0.59313476", "0.5874697", "0.58654714", "0.58475703", "0.58325833", "0.58288527", "0.58106905", "0.580036", "0.5795021", "0.57820404", "0.57631683", "0.576...
0.67354244
1
XXX: backgroundrepeat could be implemented more efficiently as a fill pattern (at least for PDF output, probably SVG too).
function rewX() { while (rect.origin.x > box.left) { rect.origin.x -= img_width; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderBg() {\n var split_color = 'rgba(155, 155, 155, 0.3)';\n\n // length per level (including splitter)\n var level_width = splitter_scale(2);\n\n // repeating the pattern img in this way\n //\n // ---||---||---|| .... ||---||---\n //\n var splitter_img = ['repeating-linear-gradi...
[ "0.6915264", "0.68557495", "0.668967", "0.6221924", "0.6205173", "0.6201222", "0.6125191", "0.6106349", "0.60944813", "0.60897344", "0.6070741", "0.60355896", "0.6028651", "0.5988276", "0.59862655", "0.59173256", "0.5912204", "0.58957994", "0.58955926", "0.58619356", "0.58585...
0.0
-1
draws a single border box
function drawOneBox(box, isFirst, isLast) { if (box.width === 0 || box.height === 0) { return; } drawBackground(box); var shouldDrawLeft = (left.width > 0 && ((isFirst && dir == "ltr") || (isLast && dir == "rtl"))); var shouldDrawRight = (right.width > 0 && ((isLast && dir == "ltr") || (isFirst && dir == "rtl"))); // The most general case is that the 4 borders have different widths and border // radiuses. The way that is handled is by drawing 3 Paths for each border: the // straight line, and two round corners which represent half of the entire rounded // corner. To simplify code those shapes are drawed at origin (by the drawEdge // function), then translated/rotated into the right position. // // However, this leads to poor results due to rounding in the simpler cases where // borders are straight lines. Therefore we handle a few such cases separately with // straight lines. C^wC^wC^w -- nope, scratch that. poor rendering was because of a bug // in Chrome (getClientRects() returns rounded integer values rather than exact floats. // web dev is still a ghetto.) // first, just in case there is no border... if (top.width === 0 && left.width === 0 && right.width === 0 && bottom.width === 0) { return; } // START paint borders // if all borders have equal colors... if (top.color == right.color && top.color == bottom.color && top.color == left.color) { // if same widths too, we can draw the whole border by stroking a single path. if (top.width == right.width && top.width == bottom.width && top.width == left.width) { if (shouldDrawLeft && shouldDrawRight) { // reduce box by half the border width, so we can draw it by stroking. box = innerBox(box, top.width/2); // adjust the border radiuses, again by top.width/2, and make the path element. var path = elementRoundBox(element, box, top.width/2); path.options.stroke = { color: top.color, width: top.width }; group.append(path); return; } } } // if border radiuses are zero and widths are at most one pixel, we can again use simple // paths. if (rTL0.x === 0 && rTR0.x === 0 && rBR0.x === 0 && rBL0.x === 0) { // alright, 1.9px will do as well. the difference in color blending should not be // noticeable. if (top.width < 2 && left.width < 2 && right.width < 2 && bottom.width < 2) { // top border if (top.width > 0) { group.append( new Path({ stroke: { width: top.width, color: top.color } }) .moveTo(box.left, box.top + top.width/2) .lineTo(box.right, box.top + top.width/2) ); } // bottom border if (bottom.width > 0) { group.append( new Path({ stroke: { width: bottom.width, color: bottom.color } }) .moveTo(box.left, box.bottom - bottom.width/2) .lineTo(box.right, box.bottom - bottom.width/2) ); } // left border if (shouldDrawLeft) { group.append( new Path({ stroke: { width: left.width, color: left.color } }) .moveTo(box.left + left.width/2, box.top) .lineTo(box.left + left.width/2, box.bottom) ); } // right border if (shouldDrawRight) { group.append( new Path({ stroke: { width: right.width, color: right.color } }) .moveTo(box.right - right.width/2, box.top) .lineTo(box.right - right.width/2, box.bottom) ); } return; } } // END paint borders var tmp = adjustBorderRadiusForBox(box, rTL0, rTR0, rBR0, rBL0); var rTL = tmp.tl; var rTR = tmp.tr; var rBR = tmp.br; var rBL = tmp.bl; // top border drawEdge(top.color, box.width, top.width, left.width, right.width, rTL, rTR, [ 1, 0, 0, 1, box.left, box.top ]); // bottom border drawEdge(bottom.color, box.width, bottom.width, right.width, left.width, rBR, rBL, [ -1, 0, 0, -1, box.right, box.bottom ]); // for left/right borders we need to invert the border-radiuses function inv(p) { return { x: p.y, y: p.x }; } // left border drawEdge(left.color, box.height, left.width, bottom.width, top.width, inv(rBL), inv(rTL), [ 0, -1, 1, 0, box.left, box.bottom ]); // right border drawEdge(right.color, box.height, right.width, top.width, bottom.width, inv(rTR), inv(rBR), [ 0, 1, -1, 0, box.right, box.top ]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBorder() {\n push();\n fill(22, 24, 39);\n noStroke();\n rect(0, 0, width, 20);\n rect(0, 0, 20, height);\n rect(0, height - 20, width, 20);\n rect(width - 20, 0, 20, height);\n pop();\n}", "function drawBorder() {\n ctx.beginPath()\n ctx.rect(0, 0, canvas.width, canvas.height)\n ct...
[ "0.8089808", "0.8083158", "0.80414605", "0.79925865", "0.7780704", "0.7461869", "0.7337283", "0.7321841", "0.7252831", "0.7046337", "0.7003682", "0.6993441", "0.69605553", "0.69517684", "0.6922734", "0.6914116", "0.687971", "0.68623435", "0.68433535", "0.67555535", "0.6741136...
0.6601907
24
for left/right borders we need to invert the borderradiuses
function inv(p) { return { x: p.y, y: p.x }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ignoreExteriorBorders(a, b) { return a !== b }", "function InvertBoxAlignment(align) {\n switch (align) {\n case BoxAlignment.TopLeft: return BoxAlignment.BottomRight;\n case BoxAlignment.TopCenter: return BoxAlignment.BottomCenter;\n case BoxAlignment.TopRight: return BoxAlignme...
[ "0.6199522", "0.60939384", "0.59845865", "0.59845865", "0.5945589", "0.5908621", "0.5850809", "0.58501405", "0.5791564", "0.57567346", "0.5729585", "0.5671248", "0.5645137", "0.56370413", "0.5623271", "0.56058705", "0.55842173", "0.5535575", "0.55333996", "0.55242187", "0.551...
0.0
-1
only function declarations after this line
function actuallyGetRangeBoundingRect(range) { // XXX: to be revised when this Chrome bug is fixed: // https://bugs.chromium.org/p/chromium/issues/detail?id=612459 if (browser$2.msie || browser$2.chrome) { // Workaround browser bugs: IE and Chrome would sometimes // return 0 or 1-width rectangles before or after the main // one. https://github.com/telerik/kendo/issues/4674 // Actually Chrome 50 got worse, since the rectangles can now have the width of a // full character, making it hard to tell whether it's a bogus rectangle or valid // selection location. The workaround is to ignore rectangles that fall on the // previous line. https://github.com/telerik/kendo/issues/5740 var rectangles = range.getClientRects(), box = { top : Infinity, right : -Infinity, bottom : -Infinity, left : Infinity }; for (var i = 0; i < rectangles.length; ++i) { var b = rectangles[i]; if (b.width <= 1 || b.bottom === prevLineBottom) { continue; // bogus rectangle } box.left = Math.min(b.left , box.left); box.top = Math.min(b.top , box.top); box.right = Math.max(b.right , box.right); box.bottom = Math.max(b.bottom , box.bottom); } box.width = box.right - box.left; box.height = box.bottom - box.top; return box; } return range.getBoundingClientRect(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function functionDeclaration() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion (){}", "function Func_s() {\n}", "function fn() {\n\t\t }", "FunctionDeclaration() {\n pushContext();\n }", "function foo() {\r\n}", "fun...
[ "0.7303349", "0.70421624", "0.70421624", "0.70421624", "0.70089674", "0.6971537", "0.6931452", "0.68676233", "0.68095535", "0.67973053", "0.67893684", "0.6753347", "0.67524326", "0.6748414", "0.67467153", "0.6729944", "0.6729198", "0.6726719", "0.6718109", "0.66935766", "0.66...
0.0
-1
Render a chunk of text, typically one line (but for justified text we render each word as a separate Text object, because spacing is variable). Returns true when it finished the current node. After each chunk it updates `start` to just after the last rendered character.
function doChunk() { var origStart = start; var box, pos = text.substr(start).search(/\S/); start += pos; if (pos < 0 || start >= end) { return true; } // Select a single character to determine the height of a line of text. The box.bottom // will be essential for us to figure out where the next line begins. range.setStart(node, start); range.setEnd(node, start + 1); box = actuallyGetRangeBoundingRect(range); // for justified text we must split at each space, because space has variable width. var found = false; if (isJustified || columnCount > 1) { pos = text.substr(start).search(/\s/); if (pos >= 0) { // we can only split there if it's on the same line, otherwise we'll fall back // to the default mechanism (see findEOL below). range.setEnd(node, start + pos); var r = actuallyGetRangeBoundingRect(range); if (r.bottom == box.bottom) { box = r; found = true; start += pos; } } } if (!found) { // This code does three things: (1) it selects one line of text in `range`, (2) it // leaves the bounding rect of that line in `box` and (3) it returns the position // just after the EOL. We know where the line starts (`start`) but we don't know // where it ends. To figure this out, we select a piece of text and look at the // bottom of the bounding box. If it changes, we have more than one line selected // and should retry with a smaller selection. // // To speed things up, we first try to select all text in the node (`start` -> // `end`). If there's more than one line there, then select only half of it. And // so on. When we find a value for `end` that fits in one line, we try increasing // it (also in halves) until we get to the next line. The algorithm stops when the // right side of the bounding box does not change. // // One more thing to note is that everything happens in a single Text DOM node. // There's no other tags inside it, therefore the left/top coordinates of the // bounding box will not change. pos = (function findEOL(min, eol, max){ range.setEnd(node, eol); var r = actuallyGetRangeBoundingRect(range); if (r.bottom != box.bottom && min < eol) { return findEOL(min, (min + eol) >> 1, eol); } else if (r.right != box.right) { box = r; if (eol < max) { return findEOL(eol, (eol + max) >> 1, max); } else { return eol; } } else { return eol; } })(start, Math.min(end, start + estimateLineLength), end); if (pos == start) { // if EOL is at the start, then no more text fits on this line. Skip the // remainder of this node entirely to avoid a stack overflow. return true; } start = pos; pos = range.toString().search(/\s+$/); if (pos === 0) { return false; // whitespace only; we should not get here. } if (pos > 0) { // eliminate trailing whitespace range.setEnd(node, range.startOffset + pos); box = actuallyGetRangeBoundingRect(range); } } // another workaround for IE: if we rely on getBoundingClientRect() we'll overlap with the bullet for LI // elements. Calling getClientRects() and using the *first* rect appears to give us the correct location. // Note: not to be used in Chrome as it randomly returns a zero-width rectangle from the previous line. if (browser$2.msie) { box = range.getClientRects()[0]; } var str = range.toString(); if (!/^(?:pre|pre-wrap)$/i.test(whiteSpace)) { // node with non-significant space -- collapse whitespace. str = str.replace(/\s+/g, " "); } else if (/\t/.test(str)) { // with significant whitespace we need to do something about literal TAB characters. // There's no TAB glyph in a font so they would be rendered in PDF as an empty box, // and the whole text will stretch to fill the original width. The core PDF lib // does not have sufficient context to deal with it. // calculate the starting column here, since we initially discarded any whitespace. var cc = 0; for (pos = origStart; pos < range.startOffset; ++pos) { var code = text.charCodeAt(pos); if (code == 9) { // when we meet a TAB we must round up to the next tab stop. // in all browsers TABs seem to be 8 characters. cc += 8 - cc % 8; } else if (code == 10 || code == 13) { // just in case we meet a newline we must restart. cc = 0; } else { // ordinary character --> advance one column cc++; } } // based on starting column, replace any TAB characters in the string we actually // have to display with spaces so that they align to columns multiple of 8. while ((pos = str.search("\t")) >= 0) { var indent = " ".substr(0, 8 - (cc + pos) % 8); str = str.substr(0, pos) + indent + str.substr(pos + 1); } } if (!found) { prevLineBottom = box.bottom; } drawText(str, box); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doChunk() {\n\t var origStart = start;\n\t var box, pos = text.substr(start).search(/\\S/);\n\t start += pos;\n\t if (pos < 0 || start >= end) {\n\t return true;\n\t }\n\t\n\t // Select a single character to determine the height of a line of text. The ...
[ "0.6969217", "0.6950737", "0.6950737", "0.56351066", "0.53861266", "0.5178221", "0.50660217", "0.50660217", "0.50660217", "0.5014446", "0.49684566", "0.4959582", "0.49537566", "0.49520916", "0.4951169", "0.4951169", "0.49511284", "0.4915442", "0.48931527", "0.48482028", "0.48...
0.6950737
3
Created by sunyfc on 2019/8/13.
function GaugeCharts(props) { const options = { title: { show: true, text: '', x: 'center', y: '8%', textStyle: { color: '#fff', fontWeight: 'normal', fontSize: 18, align: 'center' }, }, tooltip: { formatter: "{a} <br/>{b} : {c}%" }, series: [{ type: props.type, // center: ['50%', '25%'], // 默认全局居中 radius: '55%', axisLine: { show: false, lineStyle: { // 属性lineStyle控制线条样式 color: [ [0.8, '#0193cf'], [1, 'rgba(1, 147, 207, 0.3)'] ], width: 18 } }, splitLine: { show: false }, axisTick: { show: false }, axisLabel: { show: false }, pointer: { show: false, length: '0', width: '0' }, detail: { formatter: '{value}%', offsetCenter: [0, '5%'] }, data: [{ value: 80, name: '', }], }] }; options.title.text = props.options.name; options.series[0].data[0].name = props.options.total; options.series[0].data[0].value = props.options.finished != null ? props.options.finished : 0; const onChartReady = function(chart) { chart.hideLoading(); } return ( <ReactEcharts onChartReady={onChartReady} option={options} /> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient final protected internal function m174() {}", "static transient fina...
[ "0.6516459", "0.63121784", "0.6102085", "0.59360474", "0.58573085", "0.58548605", "0.5845073", "0.5767411", "0.57308793", "0.5705896", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455", "0.5646455"...
0.0
-1
Sets the new scale for an element, as if it was zoomed into `clientX, clientY` point
function zoomTo(svgElement, clientX, clientY, scaleMultiplier) { var transform = getTransform(svgElement) var parent = svgElement.ownerSVGElement var parentCTM = parent.getScreenCTM() // we have consistent scale on both X and Y, thus we can use just one attribute: var scale = transform.matrix.a * scaleMultiplier var x = clientX * parentCTM.a - parentCTM.e var y = clientY * parentCTM.a - parentCTM.f svgElement.setAttribute( 'transform', 'matrix(' + [ scale, transform.matrix.b, transform.matrix.c, scale, x - scaleMultiplier * (x - transform.matrix.e), y - scaleMultiplier * (y - transform.matrix.f) ].join(' ') + ')' ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleScale(e) {\n var origins = getTransformOrigin(el);\n var parts = getTransform(el);\n var oldScale = +parts[0];\n if ((e.deltaY < 0 && oldScale >= maxScale)\n || (e.deltaY > 0 && oldScale <= minScale)) {\n return;\n }\n var deltScale = e...
[ "0.6927653", "0.6753072", "0.67261064", "0.6724211", "0.66250086", "0.6616712", "0.65875936", "0.64995337", "0.64986014", "0.64969003", "0.6494306", "0.6492286", "0.6492286", "0.6492286", "0.6490745", "0.64666325", "0.6465926", "0.6432087", "0.642981", "0.64108974", "0.638030...
0.7178966
1
Indres script end / Ramunes script start / Ramunes script end / Neringos script start
function renderBlogs (data) { let HTML = ''; if ( !Array.isArray (data) ) { return console.error('ERROR: negaliu sugeneruoti sekcijos, del blogo formato duomenu.'); } if ( data.length === 0 ) { return console.error('ERROR: negaliu sugeneruoti sekcijos del tuscio saraso.'); } for ( let i=0; i<data.length; i++ ) { const blogiukai = data[i]; HTML += `<div class= "blokai"> <a href ="#" class = "photo"> <img id = "foto" src="./img/Blog/${blogiukai.img}" alt="User photo"> </a> <p class="date"> ${blogiukai.date.day} ${blogiukai.date.month} ${blogiukai.date.years} ${blogiukai.date.design} </p> <div class="textas"> <a href="#"> <h3>${blogiukai.description}</h3> </a> <p>${blogiukai.text}</p> </div> <a class = 'nuoroda' href ="#"> <p>${blogiukai.link}</p> </a> </div>`; } return document.querySelector('#Blogs > .row').innerHTML = HTML; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startScript(){\n // Update when script starts.\n updateProductInfo();\n updateLocalInfo();\n // Wait for the product analysis to be set.\n setTimeout(setRecyclability, 1000);\n}", "start() {// [3]\n }", "function run_all_scripts_data()\n\n{\n \n \n runDemo_test();\n runDemo_ti...
[ "0.62841713", "0.61161125", "0.5892592", "0.5870402", "0.5856756", "0.585203", "0.5846115", "0.5843271", "0.58382046", "0.5819533", "0.57647043", "0.57263005", "0.5677514", "0.56731236", "0.56632805", "0.56541497", "0.5648352", "0.561219", "0.5585653", "0.5573863", "0.5541234...
0.0
-1
Terminates a running minion by clearing the runtime environment.
terminate() { this.running = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "quit() {\n if (this.process) {\n this.process.kill('SIGTERM');\n this.process = null;\n }\n }", "destroy() {\n this._executeOnSandbox(['destroy']);\n }", "destroy() {\n if (this._destroyed) {\n throw new Error('The platform has already been destroyed!');\n }\n ...
[ "0.67075956", "0.6350238", "0.6341548", "0.6341548", "0.6341548", "0.6341548", "0.6341548", "0.6337807", "0.62507355", "0.6230941", "0.62019503", "0.61855614", "0.6076103", "0.6055888", "0.59928095", "0.5985211", "0.5900145", "0.58770514", "0.5852623", "0.58497715", "0.584934...
0.58672726
18
Change straight quotes to curly and double hyphens to emdashes.
function smarten(a) { a = a.replace(/(^|[-\u2014\s(\["])'/g, "$1\u2018"); // opening singles a = a.replace(/'/g, "\u2019"); // closing singles & apostrophes a = a.replace(/(^|[-\u2014/\[(\u2018\s])"/g, "$1\u201c"); // opening doubles a = a.replace(/"/g, "\u201d"); // closing doubles a = a.replace(/--/g, "\u2014"); // em-dashes return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set DoubleQuote(value) {}", "get DoubleQuote() {}", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }", "function esc(v) { return \"\\\"\" + v.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\") + \"\\\"\"; }", "function esc(v) { return...
[ "0.6364124", "0.61465424", "0.59933156", "0.59933156", "0.59933156", "0.59933156", "0.59755725", "0.59755725", "0.59755725", "0.59755725", "0.5947093", "0.5922883", "0.5891615", "0.58870107", "0.5840751", "0.5743681", "0.5730794", "0.5681684", "0.566637", "0.5646332", "0.5641...
0.6669284
0
load chores into LocalStorage
function loadChores() { // variables xmlhttp = new XMLHttpRequest(); // open file xmlhttp.open("GET", "chores.json", true); // load file xmlhttp.onreadystatechange = function() { if(this.readyState == 4 && this.status == 200) { localStorage.setItem("chores", this.responseText); } }; // Display information xmlhttp.send(); // alert("Chores are Loaded"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadStorage() {\n const keys = Object.keys(localStorage);\n let i = keys.length;\n console.log(\"i: \", i);\n\n while ( i-- ) {\n coffees.push( JSON.parse( localStorage.getItem(keys[i]) ) );\n }\n}", "recoverCities () {\n this.cities = localStorage.cities ? JSON.parse(localSto...
[ "0.68361264", "0.66902554", "0.6642855", "0.66163015", "0.6611945", "0.6519928", "0.6511504", "0.6479145", "0.6470647", "0.6388519", "0.6384916", "0.6359506", "0.63435835", "0.63420326", "0.63181853", "0.63162166", "0.63079053", "0.6304848", "0.6296067", "0.6287656", "0.62872...
0.64690405
9
const flowerlist = useRecoilValue(flowerslist);
function handelButton(){ flowerslist1.push(items) setflowerslist(flowerslist1) console.log(flowerslist1) alert('add to table') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ShowList() {\n const getShow = useSetRecoilState(getShowState)\n\n const OutputShow = React.lazy(() => import('./OutputShow'))\n\n useEffect(() => {\n fetch('api/getShow')\n .then((res) => res.json())\n // .then((res) => console.log(res))\n .then((res) => getShow(res))...
[ "0.6025111", "0.56249017", "0.5335458", "0.52373224", "0.52227116", "0.5131838", "0.5051956", "0.50271887", "0.5026866", "0.5024671", "0.501905", "0.50107515", "0.5007374", "0.49693254", "0.49689522", "0.49528143", "0.4927001", "0.4914637", "0.49127465", "0.4902211", "0.48975...
0.0
-1
eslintdisableline import/noextraneousdependencies Helper for the scramble tests
function anagramsOfEachOther(s, t) { return s.split('').sort().join('') === t.split('').sort().join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffle() {\n // TODO\n }", "static scramble (scramble) {\n var cube = new Cube()\n cube.scramble(scramble)\n return cube\n }", "function scramble() { //MESMA COISA QUE\n divs.forEach(element => { // randomize(\"azul\");\n randomize(element); /...
[ "0.5873555", "0.57653606", "0.5695816", "0.5681749", "0.554614", "0.55092996", "0.54720044", "0.5438601", "0.5397099", "0.5368222", "0.53207564", "0.5319951", "0.5317675", "0.526003", "0.5252872", "0.52429086", "0.5149221", "0.514473", "0.51421326", "0.5141126", "0.5137067", ...
0.0
-1
Helper for testing the callbacky problems
function generatorToArray(generator, ...args) { const result = []; generator(...args, x => result.push(x)); return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mockCallBack() {\n}", "function callback(){}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function callback() {}", "function failureCB(){}", "callbackWrapper() {\n if (this.error == \"obstruction_error\") {\n t...
[ "0.7554925", "0.71121264", "0.7046418", "0.7046418", "0.7046418", "0.7046418", "0.7046418", "0.6757549", "0.6663355", "0.6637826", "0.6622398", "0.65776217", "0.6453793", "0.642021", "0.64077985", "0.64077985", "0.6363035", "0.6354978", "0.63368267", "0.6325988", "0.62628", ...
0.0
-1
this starts as soon as we enable select mode for an element.
startDraggingAnchors(element) { const mousedown = (mouse, anchor) => { this.scalable = true; this.mouse = mouse; if (element.type === "line") { const P1 = element.bounding.P1; const P2 = element.bounding.P2; this.bound = { x1: P1.x + this.props.x, y1: P1.y + this.props.y, x2: P2.x + this.props.x, y2: P2.y + this.props.y, diffX: Math.abs(P1.x - P2.x), diffY: Math.abs(P1.y - P2.y), }; this.initialBounds = { diffX: this.bound.diffX / this.previousScaleX, diffY: this.bound.diffY / this.previousScaleY, }; const diffX = Math.abs(P1.x - P2.x) / 2; const diffY = Math.abs(P1.y - P2.y) / 2; const clickedPoint = [P1, P2][anchor - 1]; const otherPoint = [P2, P1][anchor - 1]; const isClickedPointBiggerX = clickedPoint.x > otherPoint.x; const isClickedPointBiggerY = clickedPoint.y > otherPoint.y; this.isClickedPointBiggerX = isClickedPointBiggerX; this.isClickedPointBiggerY = isClickedPointBiggerY; this.anchorTransition = { x: isClickedPointBiggerX ? -diffX : diffX, y: isClickedPointBiggerY ? -diffY : diffY, }; const initialHalfDiffX = this.initialBounds.diffX / 2; const initialHalfDiffY = this.initialBounds.diffY / 2; const { x1, y1, x2, y2 } = element.props; this.anchorTransitionPos = { x1: x1 + (isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX), y1: y1 + (isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY), x2: x2 + (isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX), y2: y2 + (isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY), x: isClickedPointBiggerX ? initialHalfDiffX : -initialHalfDiffX, y: isClickedPointBiggerY ? initialHalfDiffY : -initialHalfDiffY, }; } else { // NOT line elements this.bound = { x: element.bounding.minX + this.props.x, y: element.bounding.minY + this.props.y, width: Math.abs(element.bounding.maxX) + Math.abs(element.bounding.minX), height: Math.abs(element.bounding.maxY) + Math.abs(element.bounding.minY), }; this.initialBounds = { width: this.bound.width / this.previousScaleX, height: this.bound.height / this.previousScaleY, }; const halfWidth = this.bound.width / 2; const halfHeight = this.bound.height / 2; const initialHalfWidth = this.initialBounds.width / 2; const initialHalfHeight = this.initialBounds.height / 2; this.anchorTransition = { x: anchor % 2 ? -halfWidth : halfWidth, y: Math.floor(anchor / 3) ? halfHeight : -halfHeight, }; if (element.type === "polygon") { const newPoints = element.props.points && element.props.points .split(" ") .map((point) => { const [xx, yy] = point.split(","); return { x: parseFloat(xx) + (anchor % 2 ? initialHalfWidth : -initialHalfWidth), y: parseFloat(yy) + (Math.floor(anchor / 3) ? -initialHalfHeight : initialHalfHeight), }; }) .reduce((sum, { x, y }) => `${sum} ${x},${y}`, "") .trim(); this.anchorTransitionPos = { points: newPoints, x: anchor % 2 ? initialHalfWidth : -initialHalfWidth, y: Math.floor(anchor / 3) ? -initialHalfHeight : initialHalfHeight, }; } else { this.anchorTransitionPos = { x: anchor % 2 ? initialHalfWidth : -initialHalfWidth, y: Math.floor(anchor / 3) ? -initialHalfHeight : initialHalfHeight, }; } } }; const mouseup = () => { this.scalable = false; this.previousScaleX = this.props.scaleX; this.previousScaleY = this.props.scaleY; this.props.x = this.props.x + this.anchorTransition.x + this.anchorTransitionPos.x * this.props.scaleX; this.props.y = this.props.y + this.anchorTransition.y + this.anchorTransitionPos.y * this.props.scaleY; if (element.type === "polygon") { const newPoints = element.props.points && element.props.points .split(" ") .map((point) => { const [xx, yy] = point.split(","); return { x: parseFloat(xx), y: parseFloat(yy) }; }) .reduce((sum, { x, y }) => `${sum} ${x},${y}`, "") .trim(); this.anchorTransitionPos.points = newPoints; this.anchorTransitionPos.x = 0; this.anchorTransitionPos.y = 0; } else if (element.type === "line") { const { x1, y1, x2, y2 } = element.props; this.anchorTransitionPos.x1 = x1; this.anchorTransitionPos.y1 = y1; this.anchorTransitionPos.x2 = x2; this.anchorTransitionPos.y2 = y2; this.anchorTransitionPos.x = 0; this.anchorTransitionPos.y = 0; } else { this.anchorTransitionPos.x = 0; this.anchorTransitionPos.y = 0; } this.anchorTransition.x = 0; this.anchorTransition.y = 0; element.updateMouseTransformation(this); }; const mousemove = (mouse, anchor) => { if (this.scalable) { if (element.type === "line") { const diffX = mouse.x - [this.bound.x1, this.bound.x2][anchor - 1]; const diffY = mouse.y - [this.bound.y1, this.bound.y2][anchor - 1]; const scaleX = this.previousScaleX - (this.isClickedPointBiggerX ? -diffX : diffX) / this.initialBounds.diffX; const scaleY = this.previousScaleY - (this.isClickedPointBiggerY ? -diffY : diffY) / this.initialBounds.diffY; this.mouse = mouse; this.props = { scaleX, scaleY, x: this.props.x || this.bound.x + this.bound.width / 2, y: this.props.y || this.bound.y + this.bound.height / 2, rotate: 0, }; } else { const width = anchor % 2 ? this.bound.width : 0; const height = Math.floor(anchor / 3) ? 0 : this.bound.height; const diffX = mouse.x - (this.bound.x + width); const diffY = mouse.y - (this.bound.y + height); const scaleX = this.previousScaleX - (anchor % 2 ? diffX * -1 : diffX) / this.initialBounds.width; const scaleY = this.previousScaleY - (Math.floor(anchor / 3) ? diffY : diffY * -1) / this.initialBounds.height; const { x1, y1, x2, y2 } = this.bound; this.mouse = mouse; this.props = { scaleX, scaleY, x: this.props.x || Math.min(x1, x2) + Math.abs(x1 - x2) / 2, y: this.props.y || Math.min(y1, y2) + Math.abs(y1 - y2) / 2, rotate: 0, }; } element.updateMouseTransformation(this); } }; // these handlers start as soon as we click on of the anchors. this.scalingHandlers = { mousedown, mousemove, mouseup }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "select() {\n\t\tthis.element.select();\n\t}", "select() {\n\t\tthis.element.select();\n\t}", "function enableSelect(el) {\n\tel.style.userSelect = 'auto'\n\tel.style.webkitUserSelect = 'auto'\n\tel.style.mozUserSelect = 'auto'\n\tel.dataset.selectionEnabled = 'true'\n}", "_selectStartHandler(event) {\n ...
[ "0.67938954", "0.67938954", "0.67908406", "0.6522755", "0.6423425", "0.63674194", "0.6342703", "0.6262833", "0.6230192", "0.6185748", "0.618272", "0.6180401", "0.6180401", "0.61661613", "0.6161057", "0.6161057", "0.6161057", "0.6161057", "0.6153461", "0.6142208", "0.6100281",...
0.0
-1
TODO: clean up scaling:
endDraggingAnchors() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "scaleTo() {}", "static Scale() {}", "function Scale () {}", "getMetresToInternal() {\nreturn this.scaleFromMetres;\n}", "createScales () {\n }", "get scaled() { return this._scaled; }", "get scaled() { return this._scaled; }", "scale() {\n return this.small ? \"15\" : \"23\";\n }", "scale(...
[ "0.67371076", "0.67245215", "0.6682624", "0.6645283", "0.663687", "0.64220315", "0.64220315", "0.63232934", "0.63232934", "0.6152327", "0.61441904", "0.6096154", "0.605533", "0.60369307", "0.6030578", "0.60292166", "0.60241395", "0.599889", "0.5962395", "0.59471345", "0.59138...
0.0
-1
1. Create a function that displays prototypal inheritance
function mobilePhone(brand, colour, size){ this.brand = brand; this.colour = colour; this.size = size; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showInfo() {\n /*\n 'super' is a access to the parent prototype methods store\n OR call parent class method using super.methodName()\n super.showInfo();\n\n AND add additional behavior to the created method\n console.log('add new feature to the extended class method');\n */\n supe...
[ "0.6690306", "0.65935063", "0.639504", "0.61783904", "0.61162525", "0.60633934", "0.5986542", "0.59048814", "0.5844965", "0.58354205", "0.57956815", "0.5788614", "0.57652503", "0.57528925", "0.5737088", "0.5725007", "0.56776214", "0.56613135", "0.5658738", "0.5658738", "0.565...
0.0
-1
4. Given the following paragraph, create a JavaScript function that changes all mentions of strawberry to banana and strawberries to bananas: Strawberries are a popular part of spring and summer diets throughout America. Mouths water from coast to coast each spring, when small white blossoms start to appear on strawberry bushes. They announce the impending arrival of the ruby red berries that so many people crave. Ripe strawberries taste sweet and have only a slight hint of tartness. They are also one of the healthiest fruits around. There are countless recipes for the luscious red berry, but many people prefer to eat them fresh and unaccompanied.
function fix(){ var str1 = document.getElementById("change").innerHTML; var rep1 = str1.replace(/strawberries/gi, " bananas ").replace(/strawberry/gi,"banana"); document.getElementById("change").innerHTML = rep1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeText (paragraph) {\n newParagraph1 = paragraph.replace(/strawberry|Strawberry/g, \"banana\");\n newParagraph2 = newParagraph1.replace(/strawberries|Strawberries/g, \"bananas\");\n\n//4. Given the following paragraph, create a JavaScript function that changes all mentions of strawberry to banana an...
[ "0.7893564", "0.57919014", "0.5789116", "0.5770695", "0.57548857", "0.574268", "0.57339996", "0.5731686", "0.56369615", "0.56113905", "0.56010365", "0.5585164", "0.5568321", "0.5528364", "0.55187684", "0.54835", "0.5469108", "0.5468998", "0.5438238", "0.5432335", "0.5407746",...
0.51995707
55
7. Create a simple function that logs the date.
function newDate(){ let today = new Date(); console.log(today); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function logDate(){\n console.log(new Date());\n}", "function date(){\n return ;\n }", "function printDate(dateNow) {\n console.log('2 ' + dateNow);\n}", "function dateLog(){\r\n var date = new Date();\r\n\r\n console.log(date);\r\n}", "function logDate() {\n var today = new Date();\n\n c...
[ "0.7739109", "0.75472105", "0.75136626", "0.75098664", "0.74774015", "0.73670197", "0.71763986", "0.71706134", "0.71352917", "0.7126907", "0.70490813", "0.69481224", "0.69198745", "0.6902046", "0.68882585", "0.68118703", "0.6770123", "0.6748255", "0.6695659", "0.66846585", "0...
0.6267525
72
display(): called once per frame, whenever OpenGL decides it's time to redraw.
function to_radians(angle_in_degrees) { return angle_in_degrees * Math.PI / 180; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n //now *= 0.001; // convert to seconds\n //const deltaTime = now - then;\n //then = now;\n\t\n\tif (editing) {\n\t\tcurrFrame = updateCtrl(currFrame);\n\t}\n\t\n\tdrawNewFrame(gl);\n\tif (playing) {\n\t\tupdateTime();\n\t\tcurrFrame = interp(time);\n\t}\n\t//drawSceneTexture(gl, prog...
[ "0.75057644", "0.7407149", "0.7292175", "0.7292175", "0.72503763", "0.72299933", "0.7211852", "0.7205096", "0.715796", "0.70999867", "0.70894194", "0.7087946", "0.70630103", "0.7037035", "0.702177", "0.7020022", "0.7003876", "0.7002477", "0.6973806", "0.6944036", "0.69080615"...
0.0
-1
Bee Class holds all of the attributes for bee creation
function Bee() { this.BEE_FLIGHT_RADIUS = 12; this.BEE_FLIGHT_Y_MOVEMENT = 3; this.MAX_WING_ANGLE = 45; this.MAX_LEG_ANGLE = 30; // dimensions for head this.HEAD_MATERIAL = new Material (vec4 (.2, 0, .6, 1), 1, 1, 1, 40); // default blue this.HEAD_RADIUS = 1/2; // dimensions for thorax (rectangular prism) this.THORAX_MATERIAL = new Material( vec4( .3, .3, .3, 1 ), 1, 1, .5, 20 ); // default grey this.THORAX_X = 2; this.THORAX_Y = 1; this.THORAX_Z = 1; // dimensions for abdomen (ellipse sphere) this.ABDOMEN_MATERIAL = new Material (vec4 (.5, .5, 0, 1), 1, 1, 1, 40); // default yellow this.ABDOMEN_X = 2; this.ABDOMEN_Y = 1; this.ABDOMEN_Z = 1; // dimensions for leg segment (rectangular prism) this.LEG_MATERIAL = new Material( vec4( .3, .3, .3, 1 ), 1, 1, .5, 20 ); // default grey this.LEG_X = 0.2; this.LEG_Y = 1; this.LEG_Z = 0.2; // dimensions for the wing (rectangular prism) this.WING_MATERIAL = new Material( vec4( .3, .3, .3, 1 ), 1, 1, .5, 20 ); // default grey this.WING_X = 1; this.WING_Y = 0.2; this.WING_Z = 4; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function beeModel() {\n //variables\n this.name = 'Bee';\n this.cost = 0;\n this.gender = 'Female';\n this.canAddHoney = false;\n this.canAddTerritory = false;\n this.canAddHealth = false;\n this.eggRate = 0;\n this.honeyRate = 0;\n this.territoryRate = 0;\n this.healthRate = 0;\n this.domT...
[ "0.7167673", "0.64679414", "0.6144913", "0.6066607", "0.6034691", "0.60186803", "0.5857203", "0.57693285", "0.57670736", "0.5692938", "0.568638", "0.5660569", "0.56382376", "0.56249976", "0.56211907", "0.5620175", "0.55744046", "0.55572325", "0.55141705", "0.550414", "0.54738...
0.69761163
1
Flower Class holds all of the attributes for flower creation
function Flower() { // controls the swaying angle of flower this.MAX_STEM_ANGLE = 1; // dimensions for flower this.FLOWER_MATERIAL = new Material (vec4 (.5, .5, 0, 1), 1, 1, 1, 40); // default yellow this.FLOWER_RADIUS = 1; this.PETAL_MATERIAL = new Material (vec4 (.4, 0, 0, 1), 1, 1, 1, 40); this.NUM_FLOWER_PETALS = 24; this.PETAL_X = 0.5; this.PETAL_Y = 0.2; this.PETAL_Z = 4; // dimensions for one stem segment this.STEM_MATERIAL = new Material (vec4 (0.333333, 0.419608, 0.184314, 1), 1, 1, 1, 40); // default olive greenPlastic this.NUMBER_OF_STEM_SEGS = 24; this.STEM_SEG_X = 0.5; this.STEM_SEG_Y = 1; this.STEM_SEG_Z = 0.5; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BasicFlower(){\n\n\t// size l represented by basic styles\n\tthis.flowerSizes = {\n\t\tcssClassS : 'flower__small',\n\t\tcssClassM : 'flower__medium',\n\t\tcssClassXl : 'flower__xlarge',\n\t}\n\n\tthis.flower = createFlower();\n\n\tfunction createFlower(){\n\t\tlet flower = document.createElement('div');\...
[ "0.72126305", "0.66222924", "0.6212252", "0.6195043", "0.61527044", "0.6082194", "0.6082194", "0.59906095", "0.5868412", "0.5865271", "0.58624303", "0.58521134", "0.583644", "0.58287424", "0.5785014", "0.5783557", "0.5757908", "0.5753696", "0.575099", "0.57299167", "0.5691207...
0.74513304
0
Ground Class holds all of the attributes for ground creation
function Ground() { // dimensions of ground plane this.GROUND_MATERIAL = new Material (vec4( 0.503922, 0.803922, 0.26078, 1), 1, 1, 1, 10); this.GROUND_X = 150; this.GROUND_Y = 0.1; this.GROUND_Z = 150; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "CreateGround() {\n const bd = new b2.BodyDef();\n const ground = this.m_world.CreateBody(bd);\n const shape = new b2.ChainShape();\n const bottomLeft = new b2.Vec2(), topRight = new b2.Vec2();\n Fracker.GetExtents(bottom...
[ "0.70413995", "0.6795256", "0.674617", "0.66538596", "0.6613165", "0.6528328", "0.64832896", "0.63935137", "0.6314495", "0.62776244", "0.62315524", "0.6207531", "0.6206279", "0.61950487", "0.61429745", "0.6123748", "0.6074315", "0.6069648", "0.60649043", "0.60197884", "0.6017...
0.7486694
0
Interfaces: utf8 = utf16to8(utf16); utf16 = utf16to8(utf8);
function utf16to8(str) { if (str.match(/^[\x00-\x7f]*$/) != null) { return str; } var out, i, j, len, c, c2; out = []; len = str.length; for (i = 0, j = 0; i < len; i++, j++) { c = str.charCodeAt(i); if (c <= 0x7f) { out[j] = str.charAt(i); } else if (c <= 0x7ff) { out[j] = String.fromCharCode(0xc0 | (c >>> 6), 0x80 | (c & 0x3f)); } else if (c < 0xd800 || c > 0xdfff) { out[j] = String.fromCharCode(0xe0 | (c >>> 12), 0x80 | ((c >>> 6) & 0x3f), 0x80 | (c & 0x3f)); } else { if (++i < len) { c2 = str.charCodeAt(i); if (c <= 0xdbff && 0xdc00 <= c2 && c2 <= 0xdfff) { c = ((c & 0x03ff) << 10 | (c2 & 0x03ff)) + 0x010000; if (0x010000 <= c && c <= 0x10ffff) { out[j] = String.fromCharCode(0xf0 | ((c >>> 18) & 0x3f), 0x80 | ((c >>> 12) & 0x3f), 0x80 | ((c >>> 6) & 0x3f), 0x80 | (c & 0x3f)); } else { out[j] = '?'; } } else { i--; out[j] = '?'; } } else { i--; out[j] = '?'; } } } return out.join(''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Utf16BeEncoding()\r\n{\r\n // note: false means big-endian.\r\n var myUtf16EncodingBase = new Utf16EncodingBase(false);\r\n \r\n this.stringFromBytes = function(dynamicDataView, beginIdx, size)\r\n {\r\n return myUtf16EncodingBase.stringFromBytes(dynamicDataView, beginIdx, size);\r\n...
[ "0.7393821", "0.7270583", "0.7055033", "0.66526073", "0.64706486", "0.63793415", "0.6350469", "0.62929094", "0.62923", "0.6285934", "0.6285934", "0.6274399", "0.6270515", "0.625805", "0.6241539", "0.62309146", "0.62309146", "0.62309146", "0.62309146", "0.62309146", "0.6230914...
0.7310141
1
base_url for the images of the request that came back
function Row({title, fetchUrl, isLargeRow}) { // De-structured props that were sent to this React Functional Componenet const [movies, setMovies] = useState([]); const [trailerUrl, setTrailerUrl] = useState(""); useEffect( // useEffect is a hook that runs based on a condition or varable update. It hooks to the dependencies (variable/state/condition) and whenever that dependency updates it refires everything in it () => { async function fetchData() { // Using an asynchronous function (used when requesting to external api) in the useEffect() because request can take different amount of time to respond const request = await axios.get(fetchUrl); // Wait for the url https://api.themoviedb.org/3/fetchUrl to respond/comeback and then assign it to the request setMovies(request.data.results); // Setting movies to the Movies that came back return request } console.log(fetchData()); }, [fetchUrl] // in this bracket we provide the condition that needs to be true or variable (that came from outside of useEffect() and is used inside) that needs to be updated, to run this code (if left empty it runs once the page loads) ); const opts = { height: "390", // Height be 390px width: "100%", // Weight be 100% of the Screen playerVars: { autoplay: 1, // Autoplay once }, }; const handleClick = (movie) => { if (trailerUrl) { // If trailerUrl is available that means it has been played setTrailerUrl(''); // Set it to empty to stop the trailer } else { movieTrailer(movie?.name || "") // movieTrailer is a module of react-youtube, what it does is, it takes the movie name and find the youtube trailer of the movie .then( (url) => { // Pass in the full Url of the movie trailer const urlParams = new URLSearchParams(new URL(url).search); setTrailerUrl(urlParams.get("v")); // Pulling out the v part of the Url } ) .catch( (error) => console.log(error), ); } }; return ( <div className="row"> <h2>{title}</h2> <div className="row__posters"> { movies.map( // map/loop through all the elements in movies movie => ( // for current element in movies (aliased to movie) run this function <img key={movie.id} // Use the key (that tells react to update/render only that thing thats updated) onClick={() => handleClick(movie)} className={`row__poster ${isLargeRow && "row__posterLarge"}`} // row__posters for the container and if isLargeRow then row__posterLarge as well src={`${base_url}${isLargeRow ? movie.poster_path : movie.backdrop_path}`} // Render the image of the current element of movies if isLargeRow using base_url movie.poster_path else base_url movie.backdrop_path alt={movie.name} /> ) ) } </div> {trailerUrl && <YouTube videoId={trailerUrl} opts={opts} />} </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getImageBaseUrl (url, config, item) {\n var baseUrl = ''\n if (item.use_file_server) {\n baseUrl = config.file_server\n }\n return baseUrl\n}", "function getRequestBaseURL() {\n\n var url;\n\n if (useProxy) {\n url = proxyURL;\n } else if (oauth && oauth.instance_url) {\n ...
[ "0.63712305", "0.62358034", "0.6197885", "0.61516106", "0.61170876", "0.61170876", "0.61043704", "0.60859287", "0.60618174", "0.5991056", "0.5935767", "0.59352976", "0.5921203", "0.59049004", "0.59002054", "0.5880453", "0.58041775", "0.58041036", "0.5787503", "0.578732", "0.5...
0.0
-1
Constructor helper set up the Babylon.js scene and basic components
function initScene(self, canvas, opts) { // init internal properties self._engine = new Engine(canvas, opts.antiAlias, { preserveDrawingBuffer: opts.preserveDrawingBuffer, }) self._scene = new Scene(self._engine) var scene = self._scene // remove built-in listeners scene.detachControl() // octree setup self._octree = new Octree($ => {}) self._octree.blocks = [] scene._selectionOctree = self._octree // camera, and empty mesh to hold it, and one to accumulate rotations self._cameraHolder = new Mesh('camHolder', scene) self._camera = new FreeCamera('camera', new Vector3(0, 0, 0), scene) self._camera.parent = self._cameraHolder self._camera.minZ = .01 self._cameraHolder.visibility = false // plane obscuring the camera - for overlaying an effect on the whole view self._camScreen = Mesh.CreatePlane('camScreen', 10, scene) self.addMeshToScene(self._camScreen) self._camScreen.position.z = .1 self._camScreen.parent = self._camera self._camScreenMat = self.makeStandardMaterial('camscreenmat') self._camScreen.material = self._camScreenMat self._camScreen.setEnabled(false) self._camLocBlock = 0 // apply some defaults var lightVec = new Vector3(0.1, 1, 0.3) self._light = new HemisphericLight('light', lightVec, scene) function arrToColor(a) { return new Color3(a[0], a[1], a[2]) } scene.clearColor = arrToColor(opts.clearColor) scene.ambientColor = arrToColor(opts.ambientColor) self._light.diffuse = arrToColor(opts.lightDiffuse) self._light.specular = arrToColor(opts.lightSpecular) self._light.groundColor = arrToColor(opts.groundLightColor) // make a default flat material (used or clone by terrain, etc) self.flatMaterial = self.makeStandardMaterial('flatmat') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor()\n {\n // calling the super to inniciate this class as a scene\n super();\n }", "constructor(){\n super()\n this.importantObject = new BABYLON.Scene(this.context.engine)\n this.setInitialProps()\n this.contextAdditions.scene = this.importantObject\n }", "init()\n ...
[ "0.7595957", "0.7532946", "0.72695017", "0.7185019", "0.7029061", "0.7001182", "0.6912657", "0.6874877", "0.6865021", "0.67735046", "0.67464465", "0.67230743", "0.6708954", "0.6704832", "0.66961014", "0.6672226", "0.66598064", "0.66545796", "0.66163605", "0.659153", "0.654298...
0.0
-1
runs once per tick move any dynamic meshes to correct chunk octree
function updateDynamicMeshOctrees(self) { for (var i = 0; i < self._dynamicMeshes.length; i++) { var mesh = self._dynamicMeshes[i] if (mesh._isDisposed) continue // shouldn't be possible var pos = mesh.position var prev = mesh._currentNoaChunk || null var next = self.noa.world._getChunkByCoords(pos.x, pos.y, pos.z) || null if (prev === next) continue // mesh has moved chunks since last update // remove from previous location... if (prev && prev.octreeBlock) { removeUnorderedListItem(prev.octreeBlock.entries, mesh) } else { removeUnorderedListItem(self._octree.dynamicContent, mesh) } // ... and add to new location if (next && next.octreeBlock) { next.octreeBlock.entries.push(mesh) } else { self._octree.dynamicContent.push(mesh) } mesh._currentNoaChunk = next } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tickPhysics()\n{\n n_recalculateTorques(rootNode);\n n_applyTorques(rootNode);\n n_updatePositions(rootNode);\n}", "updateMeshes () {\r\n const availableMeshes = this.world.getAvailableMeshes(this.player.position)\r\n const objectsToAdd = availableMeshes.filter(mesh => !this.currentMeshes.inclu...
[ "0.66243577", "0.63371557", "0.6323728", "0.62447864", "0.62447864", "0.6239522", "0.6137942", "0.6137942", "0.6041333", "0.6006749", "0.5939085", "0.5874244", "0.5845505", "0.58395785", "0.582584", "0.582316", "0.5796315", "0.5791467", "0.57906073", "0.57839364", "0.5782277"...
0.75015557
0
INTERNALS updates camera position/rotation to match settings from noa.camera
function updateCameraForRender(self) { var cam = self.noa.camera var tgt = cam.getTargetPosition() self._cameraHolder.position.copyFromFloats(tgt[0], tgt[1], tgt[2]) self._cameraHolder.rotation.x = cam.pitch self._cameraHolder.rotation.y = cam.heading self._camera.position.z = -cam.currentZoom // applies screen effect when camera is inside a transparent voxel var id = self.noa.getBlock(self.noa.camera.getPosition()) checkCameraEffect(self, id) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_initCameraSettings(){\n this._camera.position.x = this._config.position[0];\n this._camera.position.y = this._config.position[1];\n this._camera.position.z = this._config.position[2];\n this._camera.up.x = this._config.up[ 0 ];\n this._camera.up.y = this._config.up[ 1 ];\n this._camera.up.z = th...
[ "0.7824725", "0.7665472", "0.7517335", "0.7185717", "0.71760285", "0.7170476", "0.71586794", "0.71461743", "0.7145885", "0.71249896", "0.7051952", "0.70329726", "0.7020236", "0.70186234", "0.7012899", "0.7010298", "0.70090634", "0.6997693", "0.69353616", "0.69337523", "0.6907...
0.70245755
12
If camera's current location block id has alpha color (e.g. water), apply/remove an effect
function checkCameraEffect(self, id) { if (id === self._camLocBlock) return if (id === 0) { self._camScreen.setEnabled(false) } else { var matId = self.noa.registry.getBlockFaceMaterial(id, 0) if (matId) { var matData = self.noa.registry.getMaterialData(matId) var col = matData.color var alpha = matData.alpha if (col && alpha && alpha < 1) { self._camScreenMat.diffuseColor.set(0, 0, 0) self._camScreenMat.ambientColor.set(col[0], col[1], col[2]) self._camScreenMat.alpha = alpha self._camScreen.setEnabled(true) } } } self._camLocBlock = id }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setAlphaAt(layerID, alpha) {\n this.compositeEffect.getLayerAt(layerID).alpha = alpha\n }", "function currentColor() {\n if(timeBlock < currentTime) {\n \n \n \n }\n}", "function changeColor()\n{\n if (this.style.backgroundColor === 'rgb(255, 255, 255)' || flag === ...
[ "0.58621484", "0.5848601", "0.58363485", "0.580018", "0.5714294", "0.57138485", "0.56716233", "0.56299466", "0.5619025", "0.5610608", "0.56007105", "0.5596775", "0.55777013", "0.557615", "0.5548642", "0.55468994", "0.5541848", "0.5540143", "0.5535363", "0.552314", "0.5512634"...
0.7216677
0
make or get a mesh for highlighting active voxel
function getHighlightMesh(rendering) { var m = rendering._highlightMesh if (!m) { var mesh = Mesh.CreatePlane("highlight", 1.0, rendering._scene) var hlm = rendering.makeStandardMaterial('highlightMat') hlm.backFaceCulling = false hlm.emissiveColor = new Color3(1, 1, 1) hlm.alpha = 0.2 mesh.material = hlm m = rendering._highlightMesh = mesh // outline var s = 0.5 var lines = Mesh.CreateLines("hightlightLines", [ new Vector3(s, s, 0), new Vector3(s, -s, 0), new Vector3(-s, -s, 0), new Vector3(-s, s, 0), new Vector3(s, s, 0) ], rendering._scene) lines.color = new Color3(1, 1, 1) lines.parent = mesh rendering.addMeshToScene(m) rendering.addMeshToScene(lines) } return m }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__activeMesh(material) {}", "getSelectedMesh() {\n let count = 0;\n let mesh = null;\n for (var id in this.selected) {\n count += 1;\n mesh = this.meshes[id];\n }\n if (count > 1) {\n console.warn('More than one mesh selected.');\n }\n return mesh;\n }", "function createHig...
[ "0.71434814", "0.69437164", "0.63697714", "0.62844807", "0.6216099", "0.6126608", "0.6061576", "0.6049705", "0.60433966", "0.5972196", "0.5897153", "0.5892323", "0.58269393", "0.58142346", "0.58129287", "0.5803306", "0.57523775", "0.5732843", "0.57255626", "0.5722446", "0.570...
0.6308747
3
[2] 3 [5, 7, 4, 6, 9] Create array of elements smaller and greater than the pivot Break down and then merge
function quickSort(inputArr) { console.log('quickSort input', inputArr.slice()); if (inputArr.length < 2) { return inputArr; } const pivot = inputArr.pop(); let smaller = [], greater = []; inputArr.forEach((elem) => { if (elem > pivot) { greater.push(elem); } else { smaller.push(elem); } }); console.log('Pivot: ', pivot, 'smaller: ', smaller.slice(), 'greater: ', greater.slice()); // Recursive call smaller = quickSort(smaller); greater = quickSort(greater); // Merge return [...smaller, pivot, ...greater]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pivot(arr, start = 0, end = arr.length - 1) {\n // Swap function\n function swap(arr, i, j) {\n let temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n // grab 1st element as pivot value\n let pivot = arr[start];\n // tracks how many elements are < than pivot => track...
[ "0.64883727", "0.64736754", "0.6469357", "0.6362267", "0.6337999", "0.6327258", "0.63093686", "0.6282017", "0.6259968", "0.622221", "0.61903036", "0.6178583", "0.6174522", "0.6169964", "0.6160621", "0.61451834", "0.61411065", "0.61086506", "0.6090103", "0.6075561", "0.6070131...
0.63570356
4
Abre resultado da filtragem
function abreListaIndicadores(indicadores) { $(indicadores) .next('.lista-indicadores-container') .addClass('ativo'); $(btn_filtro_indicadores) .attr('tabindex', '-1'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "filtrarSugerencias(resultado, busqueda){\n \n //filtrar con .filter\n const filtro = resultado.filter(filtro => filtro.calle.indexOf(busqueda) !== -1);\n console.log(filtro);\n \n //mostrar los pines\n this.mostrarPines(filtro);\n }", "function filtrarAuto() {\...
[ "0.6998278", "0.67248404", "0.65607834", "0.6467706", "0.64507365", "0.6434162", "0.63794935", "0.63789624", "0.63555574", "0.6319165", "0.6175534", "0.61509204", "0.61399126", "0.611543", "0.61024296", "0.60850686", "0.60338557", "0.6002048", "0.599001", "0.599001", "0.59893...
0.0
-1
Fecha resultado da filtragem
function fechaListaIndicadores(indicadores) { $(indicadores) .next('.lista-indicadores-container') .removeClass('ativo') .children('.lista-indicadores') .empty(); $(btn_filtro_indicadores) .removeAttr('tabindex'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filtrarAuto() {\r\n // Funcion de alto nivel. Una funcion que toma a otra funcion.\r\n const resultado = autos.filter(filtrarMarca).filter(filtrarYear).filter(filtrarMinimo).filter(filtrarMaximo).filter(filtrarPuertas).filter(filtrarTransmision).filter(filtrarColor);\r\n // console.log(resultado)...
[ "0.5991251", "0.59326315", "0.59326315", "0.59326315", "0.59326315", "0.5906246", "0.5860982", "0.5843113", "0.5690067", "0.56797504", "0.5673793", "0.56210744", "0.5591792", "0.5561028", "0.55420977", "0.55355066", "0.55355066", "0.5521131", "0.5499053", "0.54881775", "0.547...
0.0
-1
Eventos para o filtro de Indicadores.
function iniciarFiltroIndicadores() { //Se o item j? estiver selecionado (tela de update), efetua as devidas a??es. if ( $('input[name="_indicadores_id"]').val() !== '' ) selecionadoIndicadores(); //Bot?o de filtrar $('.btn-filtro-indicadores').on({ click: function() { if ( !$(_indicadores_id).val() ) filtrarIndicadores(); }, focusout: function() { if(tempo_focus) clearTimeout(tempo_focus); tempo_focus = setTimeout(function() { if ( !$('input[name="_indicadores_id"]').val() && $('.lista-indicadores').is(':empty') ) { $('#indicadores-descricao').val(''); } if ( !$('input[name="_indicadores_id"]').val() && !$('.lista-indicadores ul li a').is(':focus') && $('#indicadores-descricao').val() ) { $('#indicadores-descricao').val(''); fechaListaIndicadores(input_group); } if ( !$('input[name="_indicadores_id"]').val() && !$('.lista-indicadores ul li a').is(':focus') && !$('#indicadores-descricao').val() ) { fechaListaIndicadores(input_group); } }, 200); } }); //Campo de filtro $('#indicadores-descricao').on({ keydown: function(e) { //Eventos ap?s a escolha de um item if ( $(this).is('[readonly]') ) { //Deletar teclando 'Backspace' ou 'Delete' if ( (e.keyCode === 8) || (e.keyCode === 46) ) { $('.btn-apagar-filtro-indicadores').click(); } } else { //Pesquisar com 'Enter' if (e.keyCode === 13) { filtrarIndicadores(); } } }, focusout: function() { //verificar quando o campo deve ser zerado if(tempo_focus) clearTimeout(tempo_focus); tempo_focus = setTimeout(function() { if ( !$('input[name="_indicadores_id"]').val() && $('.lista-indicadores').is(':empty') && !$('.btn-filtro-indicadores').is(':focus') ) { $('#indicadores-descricao').val(''); } }, 200); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleEventFiltering() {\n this.events = this.filterByType(this.replicaSetEvents.events, this.eventType);\n this.events = this.filterBySource(this.events, this.eventSource);\n }", "function handleFilterList() {\n if (startDate === \"\" || endDate === \"\") {\n notify(\n \"warning\",\n ...
[ "0.63003135", "0.6253646", "0.6243953", "0.608406", "0.60441786", "0.6011637", "0.59893626", "0.5984248", "0.5945106", "0.58831203", "0.5812188", "0.5811994", "0.579895", "0.5793439", "0.57808", "0.5780231", "0.57760215", "0.5732845", "0.5726112", "0.5717813", "0.57172835", ...
0.6693178
0
make a fresh copy of an object or array
function deepCopy (x) { return JSON.parse(JSON.stringify(x)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clone(obj) {\n if (!isObject(obj)) return obj;\n return isArray(obj) ? obj.slice() : extend({}, obj);\n }", "function clone(obj) {\n if (!isObject(obj)) return obj;\n return isArray(obj) ? obj.slice() : extend({}, obj);\n }", "function clone(obj) {\n if (!isObject(obj)) return obj;\n ...
[ "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.6933735", "0.69168586", "0.68900794", "0.6811888", "0.68106335", "0.6805959", "0.676283", "0.6758909", "0.6745126", "0.6717553", "0.6650435", "0.66476035", "0.66360277",...
0.6394065
45
block of click events for each table cell. Adds the corresponding symbol and checks each move to see if a player has won
function clickEvent1() { addSymbol(cell1); winCheck(); return; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function giveCellsClick() {\n if(turn)\n {\n player = whitePlayer;\n }\n else\n {\n player = blackPlayer;\n }\n cells.forEach(cell => {\n cell.addEventListener('click', () =>\n { \n i = cell.closest('tr').rowIndex;\n j = cell.cellIndex;\n ...
[ "0.76455855", "0.7324436", "0.70538723", "0.7045615", "0.70277196", "0.7023921", "0.6970261", "0.695731", "0.69046265", "0.69023615", "0.6891554", "0.68329585", "0.68190676", "0.6813883", "0.68125707", "0.6807821", "0.6763115", "0.675758", "0.6746881", "0.67278737", "0.671645...
0.67151225
21
adds an X or an O depending on the turn, increments move counter
function addSymbol(cellNumber) { if (player1Turn == true && cellNumber.innerHTML == ' ') { log("Player 2(O)'s turn."); cellNumber.innerHTML = 'X'; player1Turn = false; moveCount++; } else if (player1Turn == false && cellNumber.innerHTML == ' ') { cellNumber.innerHTML = 'O'; player1Turn = true; moveCount++; log("Player 1(X)'s turn."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function switchTurn() {\n if (turn === \"X\") {\n turn = \"O\";\n } else {\n turn = \"X\";\n }\n turnCounter++;\n tracker(); \n }", "function takeTurns() {\n self.gameBoard.turn++;\n if (self.gameBoard.turn % 2 === 0) {\n return \"o\";...
[ "0.7215678", "0.71712494", "0.7046357", "0.6844048", "0.6816583", "0.67739564", "0.67278343", "0.6703048", "0.65930027", "0.6584088", "0.65628225", "0.65582013", "0.648677", "0.64723134", "0.6470136", "0.6461923", "0.64557064", "0.6449944", "0.6440343", "0.64352024", "0.64338...
0.63563526
27
function will check to see if any player has won
function winCheck() { //win conditions: 3 vertical, 3 horizontal, or 3 diagonal if ((cell1.innerHTML == 'X' && cell2.innerHTML == 'X' && cell3.innerHTML == 'X') || (cell4.innerHTML == 'X' && cell5.innerHTML =='X' && cell6.innerHTML == 'X') || (cell7.innerHTML == 'X' && cell8.innerHTML == 'X' && cell9.innerHTML == 'X') || (cell1.innerHTML == 'X' && cell4.innerHTML == 'X' && cell7.innerHTML == 'X') || (cell2.innerHTML == 'X' && cell5.innerHTML == 'X' && cell8.innerHTML == 'X') || (cell3.innerHTML == 'X' && cell6.innerHTML == 'X' && cell9.innerHTML == 'X') || (cell1.innerHTML == 'X' && cell5.innerHTML == 'X' && cell9.innerHTML == 'X') || (cell3.innerHTML == 'X' && cell5.innerHTML == 'X' && cell7.innerHTML == 'X')) { //displays the message to the victor log("Congratulations, player 1(X) has won. Please refresh the page to start again."); document.getElementById('game-board').style.pointerEvents = 'none'; return; } else if ((cell1.innerHTML == 'O' && cell2.innerHTML == 'O' && cell3.innerHTML == 'O') || (cell4.innerHTML == 'O' && cell5.innerHTML =='O' && cell6.innerHTML == 'O') || (cell7.innerHTML == 'O' && cell8.innerHTML == 'O' && cell9.innerHTML == 'O') || (cell1.innerHTML == 'O' && cell4.innerHTML == 'O' && cell7.innerHTML == 'O') || (cell2.innerHTML == 'O' && cell5.innerHTML == 'O' && cell8.innerHTML == 'O') || (cell3.innerHTML == 'O' && cell6.innerHTML == 'O' && cell9.innerHTML == 'O') || (cell1.innerHTML == 'O' && cell5.innerHTML == 'O' && cell9.innerHTML == 'O') || (cell3.innerHTML == 'O' && cell5.innerHTML == 'O' && cell7.innerHTML == 'O')) { //disables each table cell click event document.getElementById('game-board').style.pointerEvents = 'none'; log("Congratulations, player 2(O) has won. Please refresh the page to start again."); return; //if there is a tie, will display this message } else if (moveCount >= 9) { log("Tie, please refresh the page."); document.getElementById('game-board').style.pointerEvents = 'none'; return; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "gameWon() {\n if (this._gameBoard[0] == this._currentPlayer && this._gameBoard[1] == this._currentPlayer && this._gameBoard[2] == this._currentPlayer ||\n this._gameBoard[3] == this._currentPlayer && this._gameBoard[4] == this._currentPlayer && this._gameBoard[5] == this._currentPlayer ||\n ...
[ "0.7896453", "0.77696073", "0.7668806", "0.7639125", "0.75647557", "0.7528861", "0.74773705", "0.7421024", "0.7410971", "0.7381376", "0.73744047", "0.7334845", "0.7277225", "0.7267802", "0.7253861", "0.724782", "0.72320795", "0.7224461", "0.7215089", "0.71916425", "0.7177788"...
0.0
-1
function to display messages in the gameLog div
function log(message) { var moveLog = document.getElementById('move-log'); moveLog.innerHTML += message + "</br>"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gameLog (message) {\n\t$(\"#log\").prepend(\"<li>\" + message + \"</li>\");\n}", "function LogEvents(){ \r\n if (GM_getValue('autoLog', '') != \"checked\" || document.body.innerHTML.indexOf('message_body') == -1)\r\n return;\r\n var boxes = document.getElementById(SCRIPT.ap...
[ "0.77474916", "0.73445505", "0.72678447", "0.70938706", "0.6969536", "0.6925564", "0.68476725", "0.68365055", "0.6811787", "0.6684833", "0.6655773", "0.6635421", "0.66245496", "0.6605244", "0.6603267", "0.65783674", "0.6576853", "0.655867", "0.65533525", "0.6551463", "0.65439...
0.6980795
4
When a user logs in from the homepage form
function logUser () { if (document.forms['loginForm']['login'].value == '') { alert('lease type your login !') return false } if (document.forms['loginForm']['password'].value == '') { alert('Please type your password !') return false } // All the fields are filled, we can submit the login request $.post('Model/connectionChecker.php', { login: document.forms['loginForm']['login'].value, password: document.forms['loginForm']['password'].value }, function (data) { /* if ( data == "ok" ) { alert ( "L'inscription s'est correctement déroulée, vous pouvez vous connecter !"); } */ if (data == '') { return true } else { // Wrong password return false } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detectLogin()\n {\n $.when(api.whoami()).done(function(user)\n {\n // update the UI to reflect the currently logged in user.\n topnav.update(user.firstName + ' ' + user.lastName);\n }).fail(function()\n {\n ...
[ "0.7202152", "0.7129833", "0.7068952", "0.7062797", "0.70404035", "0.7027874", "0.69719744", "0.69571495", "0.6914612", "0.69096166", "0.68920976", "0.6881327", "0.6870623", "0.6854794", "0.68519634", "0.68439484", "0.6837652", "0.6811812", "0.68021876", "0.6792002", "0.67843...
0.0
-1
UTIL Gets all the elements for a certain class
function getByClass (className) { if (document.getElementsByClassName) { var elements = document.getElementsByClassName(className) } else { var elements = Array() for (var i = 0; i < document.all.length; i++) { var elementClass = document.all(i).className.split(/\s/) for (var r = 0; r < elementClass.length; r++) { if (elementClass[r] == className) { elements.push(document.all(i)) }; }; }; }; if (elements.length > 0) { return elements } else { return false }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function byClass( className ){ return document.getElementsByClassName( className ); }", "function getElementsByClass(elementsClass) {\n return document.querySelectorAll(elementsClass);\n }", "function elementsByClassName(className) {\n return document.getElementsByClassName(className);\n}", "function ...
[ "0.80010575", "0.7755788", "0.7754091", "0.75761557", "0.7481361", "0.7349983", "0.7305123", "0.7297526", "0.7296644", "0.7291132", "0.7270046", "0.725691", "0.72393996", "0.72287285", "0.7214329", "0.720988", "0.7199686", "0.71874744", "0.7176551", "0.71697724", "0.7161065",...
0.73681676
5
return the id of the user
findId(username) { if(username ==="You") { return this.props.currentUser.id } else { const friends = this.props.friends; for(var user_key in friends) { let user = friends[user_key]; if(user.username === username) { return user.id; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getId() {\n return this.user ? this.user[this.config.identifierKey] : null;\n }", "function getUserId() {\n return _userInformation.UserId;\n }", "function userId({id}) {\n return id;\n}", "function userId({id}) {\n return id;\n}", "get userId(){\n\t\treturn this._user.user_id...
[ "0.77910626", "0.7635136", "0.75485003", "0.75485003", "0.74524045", "0.7440141", "0.7279969", "0.7254119", "0.7224587", "0.7212083", "0.71680486", "0.71669596", "0.71669596", "0.71669596", "0.71669596", "0.7160054", "0.71228135", "0.7111737", "0.7101852", "0.7094557", "0.708...
0.6398801
74
this function not used by jQueryMobile or Intel App Framework
function activate_page(sel, have_state) { var $dn = $(sel); var is_vis = $dn.is(":visible"); if (!is_vis) { $dn.parents("body").find(".upage").addClass("hidden"); $dn.removeClass("hidden"); if (!have_state) { window.history.pushState({ upage: sel }, sel, document.location.origin + document.location.pathname + sel); } } $(document).trigger("pageChange"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function phonegapOnline()\r\n {\r\n }", "function phonegapOnline()\r\n {\r\n }", "function phonegapOnline()\r\n {\r\n }", "function phonegapOnline()\r\n {\r\n }", "function loadMobileBrowserDetection() {\n /**\n * jQuery.browser.mobile (http://dete...
[ "0.6080273", "0.6080273", "0.6080273", "0.6080273", "0.5912709", "0.5880315", "0.58766276", "0.5863459", "0.58476806", "0.5805323", "0.5803416", "0.5741522", "0.5732604", "0.56358045", "0.56358045", "0.56358045", "0.56332994", "0.555015", "0.55408025", "0.55369693", "0.552825...
0.0
-1
former method of LexClient:
function fetch_experiment(url) { var what_it_is = simplified_domain_from_url(url) + " " + extract_file_name(url); var fetch_promise = fetch(url); console.log("FETCH", what_it_is, "START"); fetch_promise.catch(function (error_message) { console.warn("FETCH", what_it_is, "ERROR", error_message); }); var num_lines = 0; var last_line = null; var liner = new LinesFromBytes(function (line) { num_lines++; last_line = line; }); fetch_promise.then(function (response) { console.log("FETCH", what_it_is, "RESPONSE", response.status, response.type); if (response.ok) { var total = 0; var reader = response.body.getReader(); return reader.read().then(incremental_download); function incremental_download(result) { if (result.done) { console.log("FETCH", what_it_is, "DONE", total, "bytes", num_lines, "lines"); } else { console.log("FETCH", what_it_is, "CHUNK", result.value.length, "bytes", num_lines, "lines"); total += result.value.length; liner.bytes_in(result.value); return reader.read().then(incremental_download); } } } else { console.warn("FETCH", what_it_is, "NOT OK", response.status); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendToLex(message) {\n \t//console.log('sendToLex')\n \t//console.log(message)\n let params = {\n botAlias: '$LATEST',\n botName: botName,\n inputText: message,\n userId: lexUserId,\n }\n /*lexRunTime.postText(params, (err, data) => {\n ...
[ "0.608113", "0.5355992", "0.5256174", "0.5150276", "0.5128564", "0.50751454", "0.5038279", "0.50177276", "0.5013195", "0.4989822", "0.49791586", "0.4942698", "0.49366078", "0.49209943", "0.49192244", "0.4916544", "0.4887669", "0.48658225", "0.4859139", "0.48174238", "0.477037...
0.0
-1
once the GET request against the auth api endpoint has finished, we are prepared. if there was an error during the request resolve w/o setting the current user. if however, the api responded with a 500 of storts, reject w/ error.
function loaded(err, response, {status}) { if(status >= 500) return reject(new Error("BAD_API_STATUS")); if(err || !response || response.status !== "SUCCESS") return resolve(false); let [user] = response.results; let {admin} = response.meta; session = shallow({}, {user}); session.is_admin = admin === true; resolve(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static authenticate() {\n return (req, res, next) => {\n const { provider, accessToken } = this._getCredentials(req);\n\n this._callProvider({ provider, accessToken })\n .then(({ clientId, userId }) => {\n req.auth_user_id = userId;\n req.auth_provider = provider;\n r...
[ "0.6339423", "0.632466", "0.6274982", "0.627372", "0.6206913", "0.61640507", "0.6096932", "0.608418", "0.6020662", "0.599294", "0.5950829", "0.59418046", "0.5935516", "0.59177613", "0.5908299", "0.58503157", "0.5810108", "0.579378", "0.5765374", "0.5765121", "0.5765121", "0...
0.0
-1
Warning: Printing unwanted or illformatted data to output will cause the test cases to fail
function moduloSort(a, k) { var len = a.length, i, j, stop; for (i=0; i < len; i++){ for (j=0, stop=len-i; j < stop; j++){ if (a[j]%k > a[j+1]%k){ swap(a, j, j+1); } } } return a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function report(origin, ok) {\n const extend = 20;\n if ( ok.every( elem => elem) ) {\n write(\" \"+ padLeft(ok.length, 3) +\" tests in \" + padRight(origin, extend) + \" ok.\");\n return;\n }\n let reportLine = \" Failing tests in \" + padRight(origin, extend);\n bar(reportLine.len...
[ "0.613448", "0.5926323", "0.5866004", "0.5816334", "0.57519406", "0.5588906", "0.5571334", "0.55517614", "0.553333", "0.5530866", "0.5502174", "0.54777163", "0.544297", "0.5430346", "0.541875", "0.5372137", "0.53708345", "0.536713", "0.53586674", "0.53549534", "0.53244984", ...
0.0
-1
Only render this page if it's actually visible.
_shouldRender(props, changedProps, old) { return props.active; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onBecameVisible() {\n\n // Start rendering if needed\n if (!this.isRendering) {\n this.isRendering = true\n this.render()\n }\n\n }", "function isVisible() {\n\t\t\treturn visible;\n\t\t}", "function isVisibleOnScreen()/*:Boolean*/ {\n var result/*:Boolean*/ = t...
[ "0.6997493", "0.6387009", "0.62914586", "0.62690675", "0.62549603", "0.62549603", "0.62255096", "0.6223737", "0.6152243", "0.6117296", "0.6098235", "0.60618997", "0.5992482", "0.5989832", "0.59805316", "0.59797865", "0.59797865", "0.5940749", "0.5864613", "0.58621603", "0.585...
0.0
-1
the sum of 20 of a number will be displayed
function checkFood(food){ var food = ["chicken", "beef", "fish", "lamb", "veal"]; //The first term starts with 0 if(food == food[0] || food == food[1] || food == food[2] || food == food[3] || food == food [4]){ alert("You are considered as meat"); }else{ alert("You may or may not be considered as meat"); //if chicken, beef, fish, lamb or veal is entered, then a popup will appaer with "You are considered as meat" //if something else is entered, then a popup will appear saying "you may or may not be considered as meat" } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSum(total, num) {\n return total + num;\n }", "function displaySum(num){\r\n console.log(num);}", "function getSum(total, num) {\n return total + num;\n }", "function getSum(total, num) {\n return total + Math.round(num);\n }", "function getSum(total, num) {\n ...
[ "0.6915184", "0.6898525", "0.68791085", "0.6809096", "0.6748442", "0.67266977", "0.66966945", "0.66966945", "0.6684336", "0.6635243", "0.6635243", "0.6613867", "0.6573232", "0.6559579", "0.65122974", "0.6462856", "0.646181", "0.64425147", "0.64373904", "0.64173406", "0.638635...
0.0
-1
Funktion um die 10 Besten Score Daten anzuzeigen
async function showScore() { let form = new FormData(document.forms[0]); //let url: string = "http://localhost:8100"; let url = "https://gissose2021mr.herokuapp.com"; //--> motzt wegen any nicht mehr //tslint:disable-next-line let query = new URLSearchParams(form); url = url + "/anzeigenScore" + "?" + query.toString(); let response = await fetch(url); let ausgabe = await response.json(); //Alle Score Daten sortieren (von kurzer nach langer Spieldauer) ausgabe.sort((a, b) => a.zeit - b.zeit); // Sorteren der DB nach Zeit https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/sort for (let i = 0; i < 10; i++) { //Array durchgehen und 10 besten anzeigen nameCollection[i].innerText = "Name: " + ausgabe[i].spielername; timeCollection[i].innerText = "Dauer: " + (ausgabe[i].zeit / 1000).toString() + " Sekunden"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test_score_entered_top_five_consistent(scores) {\n for (let i = 0; i < scores.length; i++) {\n scores[i]['cdr.eionet.europa.eu'].score = 1500;\n }\n return scores;\n}", "calculateScoreOld() {\n let cardValues = this.cards.map(({ value }) => value).sort((a, b) => b - a);\n return ca...
[ "0.6829383", "0.6802295", "0.67555296", "0.6698806", "0.6631819", "0.659472", "0.655819", "0.6497988", "0.6488072", "0.6445154", "0.64426655", "0.64037937", "0.6384531", "0.63842684", "0.6362945", "0.6345716", "0.63341206", "0.6332377", "0.62854046", "0.6284908", "0.62798446"...
0.0
-1
Utility method that sends a request to the API
function SendAPIRequest(options, site_domain, method, parameters, success_callback, error_callback) { // Begin by constructing the URL that will be used for the request var url = ((options['secure'] == 'true')?'https://':'http://') + 'api.stackexchange.com/2.0' + method; // Add the API key and site to the list of parameters parameters['key'] = options['key']; parameters['site'] = site_domain; parameters['filter'] = options['filter']; // Lastly, make the request $.ajax({ 'url': url, 'data': parameters, 'dataType': 'jsonp', 'success': function(data) { // If an error message was supplied, then invoke the error callback if(typeof data['error_message'] != 'undefined') error_callback(data['error_message']); else success_callback(data['items']); }}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sendRequest(api, path, options) {\n options.headers = options.headers || {};\n if (this.token) {\n options.headers[\"Authoriztion\"] = `Bearer ${ this.token }`;\n }\n\n return api.request(path, options);\n }", "function sendRequest({url, method = 'GET', headers, body = null}) {\n // let...
[ "0.71764135", "0.70871586", "0.68246", "0.6791623", "0.6722926", "0.6661318", "0.66352254", "0.6595548", "0.655237", "0.65508527", "0.6511344", "0.65057313", "0.6503868", "0.6445585", "0.6444437", "0.63840336", "0.6366027", "0.6315445", "0.6271979", "0.6258616", "0.6254051", ...
0.6234554
23
Generates the HTML for question tags
function GenerateTagHTML(tags) { var html = '<div class="tags">'; // Generate the html for each of the tags and return it $.each(tags, function(key, tag) { html += '<span>' + tag + '</span>' }); return html + '</div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createQuestionsHTML() {\n\treturn QUESTIONS[currentQuestionIndex].answers\n\t\t.map((question, index) => {\n\t\t\treturn `\n\t\t\t\t<div class=\"answer\">\n <input type=\"radio\" name=\"answer\" value=\"${index}\" id=\"option${index}\" class=\"pr-2\"/>\n\t\t\t\t\t<label for=\"option${in...
[ "0.73374116", "0.7195546", "0.71780646", "0.71407944", "0.70907515", "0.6990433", "0.69378537", "0.69312364", "0.69072294", "0.68855107", "0.6855375", "0.68023115", "0.678461", "0.673368", "0.67044425", "0.66636056", "0.6656264", "0.6650055", "0.6641787", "0.66067755", "0.659...
0.0
-1
Generates the HTML for a user profile
function GenerateProfileHTML(user) { if(typeof user['link'] != 'undefined') return '<a href="' + user['link'] + '" class="user-link">by ' + user['display_name'] + '</a>'; else return '<span class="user-link">' + user['display_name'] + '</span>' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function output_user_profile(res, login, userInfo, userInterests, userFriends, peopleWithSameInterests) {\n\tres.render('profile.jade',\n\t\t { title: \"Profile for User with login \" + login,\n\t\t\t userInfo: userInfo,\n\t\t\t userInterests: userInterests,\n\t\t\t userFriends: userFriends,\n\t\t\t peopleWithSa...
[ "0.75059193", "0.7350002", "0.7340478", "0.725944", "0.7104964", "0.69974136", "0.6963821", "0.69281244", "0.6910094", "0.6898787", "0.67968345", "0.67879885", "0.67773235", "0.67619056", "0.66910547", "0.66604096", "0.662208", "0.66174966", "0.6601753", "0.6594279", "0.65588...
0.78647846
0
Generates the HTML for an answer
function GenerateAnswerHTML(options, answer) { var content = ''; if(options['votes'] == 'true') content += '<div class="hr" /><a href="' + answer['link'] + '" target="_blank" class="heading answer-count">' + answer['score'] + ' votes' + (answer['is_accepted']?' - <span class="accepted">Accepted</span>':'') + '</a>'; content += GenerateProfileHTML(answer['owner']) + answer['body']; return content; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateHtml() {\n $(\"#instruction\").html('Select the right answers and click Submit');\n $(\"#score\").html(\"\");\n for (i = 0; i < triviaDatabase.length; i++) {\n var newQuestion = $(\"<h2>\").append(triviaDatabase[i].question);\n $(\"#allQuestions\").append...
[ "0.74989074", "0.7023817", "0.68999875", "0.68755084", "0.6849847", "0.6837036", "0.683609", "0.68310374", "0.6823454", "0.67912704", "0.6783779", "0.6772609", "0.67647177", "0.6763939", "0.67504144", "0.67454016", "0.6709869", "0.6702773", "0.6700059", "0.6697529", "0.667088...
0.7679076
0
Processes the answers to a question, returning the HTML for the answers
function ProcessAnswers(options, data) { // Unfortunately we need to manually sort the answers because the API does not do this for us and then // convert the answers into a map where the key becomes the answer's ID var sorted_answers = data['answers'].sort(function (a, b) { return b['score'] - a['score']; }); var answer_key = {}; $.each(sorted_answers, function(key, value) { answer_key[value['answer_id']] = value; }); // Add different answers to the output list depending on the 'answers' option var output_answers = []; if(options['answers'] == 'all') output_answers = sorted_answers; else if(options['answers'] == 'accepted') { if(typeof data['accepted_answer_id'] != 'undefined' && typeof answer_key[data['accepted_answer_id']] != 'undefined') output_answers.push(answer_key[data['accepted_answer_id']]); else output_answers.push(sorted_answers[0]); } else { var id_list = options['answers'].split(','); $.each(id_list, function(key, value) { if(typeof answer_key[value] != 'undefined') output_answers.push(answer_key[value]); }); } // Concatenate the output to the question var html = ''; if(output_answers.length) $.each(output_answers, function(key, value) { html += GenerateAnswerHTML(options, value); }); else html += '<div class="hr" /><p class="tip">No answers matched the specified criteria.</p>'; return html; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showQuizTemplate(correctAnswers, question, questionNumber) {\n// question per my function nextQuestion() is from the questionList array of objects\n\treturn `\n\t<form title=\"American Government Quiz\"> <h2 id=\"question\">${question.text}</h2>\n <fieldset role=\"radiogroup\">\n <legend>Select ...
[ "0.6973838", "0.6918255", "0.6884803", "0.688155", "0.68615085", "0.68143135", "0.67644507", "0.6753648", "0.67509836", "0.67452663", "0.6738506", "0.67295504", "0.6701158", "0.66990095", "0.66983205", "0.6680145", "0.66799057", "0.6675865", "0.66687196", "0.6658865", "0.6637...
0.6962763
1
Processes a list of questions for a particular site
function ProcessQuestionList(question_list, api_data) { // First, convert the data into a map [question ID] => [API data] var questions = {}; $.each(api_data, function(key, question) { questions[question['question_id']] = question; }); // Now go through each instance in question list, generating the HTML for it $.each(question_list, function(key, instance) { // Find the right API data for the instance and generate it var instance_data = questions[instance['id']]; var element = $(instance['element']); // Set the element's style element.addClass('stacktack-container'); element.css('width', instance['width'] + ((instance['width'].toString().match(/^\d+$/) !== null)?'px':'')); // Generate the contents var contents = '<div class="branding">Stack<span>Tack</span></div>'; contents += '<a href="' + instance_data['link'] + '" target="_blank" class="heading">' + instance_data['title'] + '</a>'; // Display the question if requested if(instance['question'] == 'true') { contents += GenerateProfileHTML(instance_data['owner']) + '<div class="hr" />' + instance_data['body']; // Display tags if requested if(instance['tags'] == 'true') contents += GenerateTagHTML(instance_data['tags']); } // Display answers if the user requests them if(instance['answers'] != 'none') { if(typeof instance_data['answers'] != 'undefined') contents += ProcessAnswers(instance, instance_data); else contents += '<div class="hr" /><p class="tip">This question does not have any answers.</p>'; } element.html(contents); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupQuestions() {\n // swap the div on display\n document.getElementById(\"introduction\").style.display = \"none\";\n document.getElementById(\"questions\").style.display = \"block\";\n // get the page elements\n questionHeading = document.getElementById(\"question_heading\");\n questi...
[ "0.6087599", "0.60601276", "0.6002623", "0.599546", "0.5988311", "0.5872708", "0.582767", "0.58103687", "0.57809484", "0.57569563", "0.5686904", "0.5642264", "0.5620857", "0.560039", "0.55774873", "0.5534916", "0.55207205", "0.5466782", "0.546408", "0.5447002", "0.54176056", ...
0.63155174
0
Stop after a while
function onSendComplete() { console.log('Send complete'); clearInterval(_sendInterval); setDeepSleep(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_stopLoop() { this._isRunning = false; }", "function stopLoop() {\n\tisrunnning = false;\n\tconsole.log('stop loop');\n}", "function loop() {\r\n // if (is_loop) {\r\n setTimeout(manage_loop, manager.interval);\r\n // is_loop = false;\r\n // }\r\n ...
[ "0.7332024", "0.71378267", "0.6936268", "0.69128525", "0.6784826", "0.6769857", "0.67466915", "0.6695698", "0.6670581", "0.666242", "0.6657702", "0.66493213", "0.6631552", "0.6552129", "0.65334845", "0.64964837", "0.6467134", "0.6448428", "0.6439139", "0.64184666", "0.6405437...
0.0
-1
Send HTTP stuff to Smartthings NB Smartthings DeviceId must match the Espr mac address
function onSendInterval() { let content = JSON.stringify({A0: analogRead(A0)}); console.log('Send: ' + content); var options = { host: SMARTTHINGS_HOST, port: SMARTTHINGS_PORT, path:'/', method:'POST', headers: { "Content-Type":"application/json", "Content-Length":content.length } }; http.request(options, (res) => { let allData = ""; res.on('data', function(data) { allData += data; }); res.on('close', function(data) { console.log("Closed: " + allData); }); }).end(content); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send (token, deviceId, payload, cb) {\n\trequest.post({\n\t\turl,\n\t\tbody: Buffer.concat([new Buffer(deviceId, 'hex'), payload]),\n\t\theaders: {\n\t\t\t'Content-Type': 'application/octet-stream',\n\t\t\t'Authorization': 'Token ' + token,\n\t\t},\n\t}, (err, httpResponse, body) => {\n\t\tif (err) return...
[ "0.65093046", "0.5866066", "0.5809934", "0.5690394", "0.5654687", "0.5649896", "0.5643227", "0.5637111", "0.558117", "0.55596036", "0.5558379", "0.5536465", "0.5534726", "0.5492972", "0.5424704", "0.5419951", "0.53728145", "0.5313915", "0.5309679", "0.52717656", "0.5270198", ...
0.54461336
14
const store = createStore(rootReducer)
function RegisterAccounts(){ return( <Stack.Navigator> <Stack.Screen options={{headerShown: false}} name="LoggedOut" component={LoggedOut} /> <Stack.Screen options={{headerShown: false}} name="EmailRegister" component={EmailRegister} /> <Stack.Screen options={{headerShown: false}} name="PhoneRegister" component={PhoneRegister} /> </Stack.Navigator> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function configureStore() {\n return createStore(rootReducer);\n}", "function createMyStore(){\n return createStore(rootReducer, applyMiddleware(ReduxThunk.default));\n}", "function configureStore() {\n\t return createStore(rootReducer)\n\t /*\n return createStore(\n //combineReducers(rootReducer)...
[ "0.8317841", "0.8116821", "0.7765486", "0.7524881", "0.7458956", "0.7405301", "0.7405301", "0.73844343", "0.7351755", "0.731951", "0.7318923", "0.73110765", "0.72698", "0.7129357", "0.7101402", "0.70940346", "0.70916444", "0.70606905", "0.70353764", "0.70155793", "0.6992395",...
0.0
-1
row: 0 first row, 1 second row, etc..
function colorForRow(row) { if (row == 0) { return 'brick_blue.png' } else if (row == 1) { return 'brick_green.png' } else if (row == 2) { return 'brick_red.png' } else if (row == 3) { return 'brick_purple.png' } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function row () {\n // TODO: also register row number during parsing\n return undefined;\n }", "function getRow(i) {\n return Math.ceil((i+1)/3);\n}", "function row(M,i) {\n return M[i];\n}", "function re(idx) {return {row: Math.floor(idx/elesPerRow), ele: idx%elesPerRow}}", "function ge...
[ "0.7329863", "0.7323106", "0.7261508", "0.71376526", "0.7016345", "0.69466805", "0.69088405", "0.68837297", "0.6840412", "0.68402535", "0.6763098", "0.67613834", "0.6751277", "0.6750424", "0.6739171", "0.6722238", "0.6673986", "0.65579444", "0.6555644", "0.6534063", "0.652556...
0.0
-1
Generate a random number, odd goes to the left even goes to the right 1 for the left, 1 for the right
function leftOrRight() { random = Math.floor(Math.random() * 10) if (random % 2 == 0) { return 1 } else { return -1 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomNumber() {\r\n\tvar n = Math.round(Math.random() * 2 + 2);\r\n\tif (n !== 1) {\r\n\t\tn = n - n % 2;\r\n\t} else {\r\n\t\tn = n + n % 2;\r\n\t}\r\n\treturn n;\r\n}", "function getRandomInt() {\r\n return Math.floor(Math.random() * 2)\r\n }", "function getRamdom0_1() {\n var random = Math.fl...
[ "0.7182977", "0.71080846", "0.70146334", "0.6957639", "0.6837845", "0.67743313", "0.6759685", "0.67589605", "0.6746578", "0.67362314", "0.6668971", "0.66381127", "0.6614286", "0.6609744", "0.66034836", "0.65852904", "0.6581735", "0.65784013", "0.6567241", "0.6566158", "0.6565...
0.7583175
0
The type of channel to send notifications on.
get type () { return this._type; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getChannelType(channelId) {\n if (this.toUserId(channelId) === channelId) {\n return undefined;\n }\n if (this._options.camYou) {\n if (channelId > constants.CAMCHAN.ID_START && channelId < constants.CAMCHAN.ID_END) {\n return constants.ChannelType.FreeChat...
[ "0.593527", "0.5762123", "0.5749022", "0.5712485", "0.54879415", "0.5445453", "0.54449886", "0.5421214", "0.539308", "0.5291805", "0.52879965", "0.5275655", "0.5268181", "0.523844", "0.5221353", "0.5215419", "0.52140075", "0.5197035", "0.5147546", "0.5139234", "0.5120275", ...
0.0
-1
The uri that describes the actual endpoint to send messages to.
get endpoint () { return this._endpoint; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "uri() {\n let query = this.query || {};\n const schema = this.opts.secure ? \"wss\" : \"ws\";\n let port = \"\";\n // avoid port if default for schema\n if (this.opts.port &&\n ((\"wss\" === schema && Number(this.opts.port) !== 443) ||\n (\"ws\" === sche...
[ "0.7199144", "0.71666974", "0.7145559", "0.71075475", "0.70060927", "0.70060927", "0.695344", "0.68763137", "0.68613213", "0.65951943", "0.65323263", "0.6522583", "0.6522583", "0.6522583", "0.6493079", "0.64847744", "0.6472241", "0.62405056", "0.62351495", "0.62351495", "0.62...
0.6235694
18
The mime type to send the payload in either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.
get payload () { return this._payload; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "innerMimeType(key) {\n let t = (this.base || this.remote).output_type;\n if (\n (t === \"stream\" && key === \"text\") ||\n (t === \"error\" && key === \"traceback\")\n ) {\n // TODO: 'application/vnd.jupyter.console-text'?\n return \"text/plain\";\n } else if (\n (t === \"exec...
[ "0.61349744", "0.5860191", "0.57361877", "0.5587105", "0.54970354", "0.54912066", "0.5360698", "0.53151035", "0.52274036", "0.5224201", "0.5205045", "0.51577455", "0.5120889", "0.5111938", "0.5059745", "0.5040635", "0.50219643", "0.50219643", "0.50219643", "0.50071406", "0.50...
0.45440236
64
Additional headers / information to send as part of the notification.
get header () { return this._header; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "header(key, value) {\n this.nodeMailerMessage.headers = this.nodeMailerMessage.headers || [];\n this.nodeMailerMessage.headers.push({ [key]: value });\n return this;\n }", "async setExtraHTTPHeaders(params) {\n return await new Promise((resolve, reject) => {\n this.dbg.s...
[ "0.6413635", "0.60729814", "0.6042822", "0.59953004", "0.5932374", "0.580283", "0.5798545", "0.5769556", "0.5698413", "0.5659176", "0.56531656", "0.5647311", "0.5629643", "0.56202465", "0.5603069", "0.55993915", "0.55860627", "0.55844337", "0.5567633", "0.55557626", "0.553317...
0.0
-1
========================= Round helper ===========================
function round(a) { return Math.floor(a); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundme(val) {\n return val;\n }", "function roundNum(num){\n return Math.round(num * 10) / 10;\n }", "function round(num){\n return Math.round(num*10) / 10;\n }", "function round(a) {\n\t return Math.floor(a);\n\...
[ "0.7574562", "0.7482291", "0.72907186", "0.7162847", "0.71150434", "0.709964", "0.70926815", "0.70853204", "0.7011744", "0.7006621", "0.69999087", "0.6954671", "0.69532067", "0.69532067", "0.69532067", "0.69507176", "0.6933777", "0.69329786", "0.691809", "0.69132185", "0.6902...
0.6858229
41
========================= Handle Touches ===========================
function findElementInEvent(e, selector) { var el = $(e.target); if (!el.is(selector)) { if (typeof selector === 'string') { el = el.parents(selector); } else if (selector.nodeType) { var found; el.parents().each(function (index, _el) { if (_el === selector) found = selector; }); if (!found) return undefined; else return selector; } } if (el.length === 0) { return undefined; } return el[0]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleEvent(owner, event, events) {\n if (event.type == \"damage\" && [\"MH Swing\", \"OH Swing\", \"Heroic Strike\"].includes(event.ability)) {\n if (this.stacks > 0) {\n events.push({\n \"type\": \"buff lost\",\n \"timesta...
[ "0.55417675", "0.5410051", "0.5410051", "0.53242296", "0.5281857", "0.52732295", "0.52013457", "0.5198924", "0.51918936", "0.51918936", "0.51717275", "0.5167854", "0.5156248", "0.51039267", "0.50229514", "0.497549", "0.49743208", "0.49698853", "0.49546045", "0.49512893", "0.4...
0.0
-1
========================= Keyboard Control ===========================
function handleKeyboard(e) { if (e.originalEvent) e = e.originalEvent; //jquery fix var kc = e.keyCode || e.charCode; // Directions locks if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) { return false; } if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) { return false; } if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { return; } if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { return; } if (kc === 37 || kc === 39 || kc === 38 || kc === 40) { var inView = false; //Check that swiper should be inside of visible area of window if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) { return; } var windowScroll = { left: window.pageXOffset, top: window.pageYOffset }; var windowWidth = window.innerWidth; var windowHeight = window.innerHeight; var swiperOffset = s.container.offset(); if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft; var swiperCoord = [ [swiperOffset.left, swiperOffset.top], [swiperOffset.left + s.width, swiperOffset.top], [swiperOffset.left, swiperOffset.top + s.height], [swiperOffset.left + s.width, swiperOffset.top + s.height] ]; for (var i = 0; i < swiperCoord.length; i++) { var point = swiperCoord[i]; if ( point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight ) { inView = true; } } if (!inView) return; } if (s.isHorizontal()) { if (kc === 37 || kc === 39) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext(); if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev(); } else { if (kc === 38 || kc === 40) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; } if (kc === 40) s.slideNext(); if (kc === 38) s.slidePrev(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set Keyboard(value) {}", "get Keyboard() {}", "function keyDown(event) {\r\n keyboard[event.keyCode] = true;\r\n}", "function onKeyDown(event) {\n}", "function keyDown(event){\n\tkeyboard[event.keyCode] = true;\n}", "HandleKeyDown(event) {}", "keyDown(_keycode) {}", "handleKeyDown (event) {\n }",...
[ "0.7816887", "0.77568746", "0.76242185", "0.759405", "0.7507061", "0.75021684", "0.745536", "0.73876923", "0.7317036", "0.7245953", "0.7211961", "0.7210927", "0.7210927", "0.7202353", "0.7196523", "0.7172098", "0.7148117", "0.71439517", "0.7142435", "0.71418256", "0.7137834",...
0.0
-1
Mouse wheel (and 2finger trackpad) support on the web sucks. It is complicated, thus this doc is long and (hopefully) detailed enough to answer your questions. If you need to react to the mouse wheel in a predictable way, this code is like your bestest friend. hugs As of today, there are 4 DOM event types you can listen to: 'wheel' Chrome(31+), FF(17+), IE(9+) 'mousewheel' Chrome, IE(6+), Opera, Safari 'MozMousePixelScroll' FF(3.5 only!) (20102013) don't bother! 'DOMMouseScroll' FF(0.9.7+) since 2003 So what to do? The is the best: normalizeWheel.getEventType(); In your event callback, use this code to get sane interpretation of the deltas. This code will return an object with properties: spinX normalized spin speed (use for zoom) x plane spinY " y plane pixelX normalized distance (to pixels) x plane pixelY " y plane Wheel values are provided by the browser assuming you are using the wheel to scroll a web page by a number of lines or pixels (or pages). Values can vary significantly on different platforms and browsers, forgetting that you can scroll at different speeds. Some devices (like trackpads) emit more events at smaller increments with fine granularity, and some emit massive jumps with linear speed or acceleration. This code does its best to normalize the deltas for you: spin is trying to normalize how far the wheel was spun (or trackpad dragged). This is super useful for zoom support where you want to throw away the chunky scroll steps on the PC and make those equal to the slow and smooth tiny steps on the Mac. Key data: This code tries to resolve a single slow step on a wheel to 1. pixel is normalizing the desired scroll delta in pixel units. You'll get the crazy differences between browsers, but at least it'll be in pixels! positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This should translate to positive value zooming IN, negative zooming OUT. This matches the newer 'wheel' event. Why are there spinX, spinY (or pixels)? spinX is a 2finger side drag on the trackpad, and a shift + wheel turn with a mouse. It results in sidescrolling in the browser by default. spinY is what you expect it's the classic axis of a mouse wheel. I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and probably is by browsers in conjunction with fancy 3D controllers .. but you know. Implementation info: Examples of 'wheel' event if you scroll slowly (down) by one step with an average mouse: OS X + Chrome (mouse) 4 pixel delta (wheelDelta 120) OS X + Safari (mouse) N/A pixel delta (wheelDelta 12) OS X + Firefox (mouse) 0.1 line delta (wheelDelta N/A) Win8 + Chrome (mouse) 100 pixel delta (wheelDelta 120) Win8 + Firefox (mouse) 3 line delta (wheelDelta 120) On the trackpad: OS X + Chrome (trackpad) 2 pixel delta (wheelDelta 6) OS X + Firefox (trackpad) 1 pixel delta (wheelDelta N/A) On other/older browsers.. it's more complicated as there can be multiple and also missing delta values. The 'wheel' event is more standard: The basics is that it includes a unit, deltaMode (pixels, lines, pages), and deltaX, deltaY and deltaZ. Some browsers provide other values to maintain backward compatibility with older events. Those other values help us better normalize spin speed. Example of what the browsers provide: | event.wheelDelta | event.detail ++ Safari v5/OS X | 120 | 0 Safari v5/Win7 | 120 | 0 Chrome v17/OS X | 120 | 0 Chrome v17/Win7 | 120 | 0 IE9/Win7 | 120 | undefined Firefox v4/OS X | undefined | 1 Firefox v4/Win7 | undefined | 3
function normalizeWheel( /*object*/ event ) /*object*/ { // Reasonable defaults var PIXEL_STEP = 10; var LINE_HEIGHT = 40; var PAGE_HEIGHT = 800; var sX = 0, sY = 0, // spinX, spinY pX = 0, pY = 0; // pixelX, pixelY // Legacy if( 'detail' in event ) { sY = event.detail; } if( 'wheelDelta' in event ) { sY = -event.wheelDelta / 120; } if( 'wheelDeltaY' in event ) { sY = -event.wheelDeltaY / 120; } if( 'wheelDeltaX' in event ) { sX = -event.wheelDeltaX / 120; } // side scrolling on FF with DOMMouseScroll if( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { sX = sY; sY = 0; } pX = sX * PIXEL_STEP; pY = sY * PIXEL_STEP; if( 'deltaY' in event ) { pY = event.deltaY; } if( 'deltaX' in event ) { pX = event.deltaX; } if( (pX || pY) && event.deltaMode ) { if( event.deltaMode === 1 ) { // delta in LINE units pX *= LINE_HEIGHT; pY *= LINE_HEIGHT; } else { // delta in PAGE units pX *= PAGE_HEIGHT; pY *= PAGE_HEIGHT; } } // Fall-back if spin cannot be determined if( pX && !sX ) { sX = (pX < 1) ? -1 : 1; } if( pY && !sY ) { sY = (pY < 1) ? -1 : 1; } return { spinX: sX, spinY: sY, pixelX: pX, pixelY: pY }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function wheel(event) {\n var delta = 0;\n if (!event) /* For IE. */\n event = window.event;\n\n console.log('event.wheelDelta:' + event.wheelDelta);\n\n if (event.wheelDelta) { /* IE/Opera. */\n // delta = event.wheelDelta / ...
[ "0.74452955", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7408591", "0.7360421", "0.7360421", "0.73285323", "0.7291883", "0.72836906", "0.72627944", "0.72465014"...
0.72615826
27
========================= Events/Callbacks/Plugins Emitter ===========================
function normalizeEventName (eventName) { if (eventName.indexOf('on') !== 0) { if (eventName[0] !== eventName[0].toUpperCase()) { eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1); } else { eventName = 'on' + eventName; } } return eventName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventEmitter(){}// Shortcuts to improve speed and size", "onOutput () {}", "ConnectEvents() {\n\n }", "static publish() {\r\n ViewportService.subscribers.forEach(el => {el.callback();});\r\n }", "function Emitter() {\r\n\t\tthis.callbacks = {};\r\n\t}", "static get pluginConfig() {\n r...
[ "0.680366", "0.6661354", "0.6524453", "0.64523554", "0.64231074", "0.6401294", "0.6355968", "0.6318918", "0.6318918", "0.6318918", "0.6318918", "0.6295011", "0.6291837", "0.62738883", "0.6242549", "0.61998135", "0.6179143", "0.6176447", "0.6171244", "0.6171244", "0.6105581", ...
0.0
-1
=========================== Add .swiper plugin from Dom libraries ===========================
function addLibraryPlugin(lib) { lib.fn.swiper = function (params) { var firstInstance; lib(this).each(function () { var s = new Swiper(this, params); if (!firstInstance) firstInstance = s; }); return firstInstance; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addLibraryPlugin(lib) {\n\t lib.fn.swiper = function (params) {\n\t var firstInstance;\n\t lib(this).each(function () {\n\t var s = new Swiper(this, params);\n\t if (!firstInstance) firstInstance = s;\n\t });\n\t return firstInstance;\n\t ...
[ "0.79071856", "0.7788451", "0.7753094", "0.7753094", "0.76806664", "0.76806664", "0.76806664", "0.6915237", "0.68095684", "0.6780382", "0.66027266", "0.6402631", "0.6396208", "0.6373701", "0.6365636", "0.63205117", "0.63018805", "0.62549335", "0.62549335", "0.6237065", "0.621...
0.76628435
20
Remove a specific element from the array
clearValidationErr(elm) { this.setState((prevState) => { let newArr = []; //Add all elements from the prev array to the new one that has a different element for (let err of prevState.errors) { if (elm !== err.elm) { newArr.push(err); } } return { errors: newArr }; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function remove(array,element){\n return array.filter(e =>e !== element)\n}", "static removeFromArray(array, element) {\n\t\tconst index = array.indexOf(element);\n\t\tarray.splice(index, 1);\n\t}", "function remove(array, elem) {\n\t var i = array.indexOf(elem);\n\t if (i !== -1) {\n\t array.s...
[ "0.7950646", "0.7888535", "0.785494", "0.78454226", "0.7805453", "0.77819175", "0.7775757", "0.7771273", "0.7747383", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.7737073", "0.77336013", "0.77158993", ...
0.0
-1
Update Username, password, and email on change event
onUsernameChange(e) { this.setState({ username: e.target.value }); //We want to clear the error when ever the user type something new this.clearValidationErr("username"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateUser(ev) {\n\t\t// TODO: add admin functionality and functions in authServise or adminServise\n\t\tev.preventDefault();\n\t\tlet updateUserForm = $('#updateUserForm');\n\t\tlet usernameInput = updateUserForm.find('input[name=\"usernameNew\"]');\n\t\tlet passInput = updateUserForm.find('input[name=\"...
[ "0.7049049", "0.68698245", "0.68276334", "0.6824728", "0.67939526", "0.6711458", "0.6705002", "0.66463774", "0.6620854", "0.65755105", "0.65048915", "0.64941716", "0.6491178", "0.64752096", "0.6472584", "0.6472432", "0.64687777", "0.64494866", "0.64399165", "0.6415807", "0.64...
0.0
-1
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 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. / metodo principale che genera il file xml
function createInstance(param) { //<DatiFatturaHeader> var xbrlDatiFatturaHeader = createInstance_DatiFatturaHeader(param); var xbrlContent = ''; if (param.blocco == "DTE") xbrlContent = createInstance_DTE(param); else if (param.blocco == "DTR") xbrlContent = createInstance_DTR(param); //<DatiFattura> root element xbrlContent = xbrlDatiFatturaHeader + xbrlContent; var attrsNamespaces = {}; attrsNamespaces["versione"] = "DAT20"; for (var j in param.namespaces) { var prefix = param.namespaces[j]['prefix']; var namespace = param.namespaces[j]['namespace']; if (prefix.length > 0) attrsNamespaces[prefix] = namespace; } for (var j in param.schemaRefs) { var schema = param.schemaRefs[j]; if (schema.length > 0) { if (!attrsNamespaces["xsi:schemaLocation"]) attrsNamespaces["xsi:schemaLocation"] = ""; else if (attrsNamespaces["xsi:schemaLocation"].length>0) attrsNamespaces["xsi:schemaLocation"] += " "; attrsNamespaces["xsi:schemaLocation"] = attrsNamespaces["xsi:schemaLocation"] + schema; } } xbrlContent = xml_createElement("ns2:DatiFattura", xbrlContent, attrsNamespaces); //Output var results = []; results.push("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"); results.push(xbrlContent); return results.join (''); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeXmlFileHead()\r\n{ \r\n var string = \"\";\r\n string += \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\"\r\n string += \"<root>\\n\"\r\n writeString (string)\r\n}", "function writeXmlFileHead()\r\n{ \r\n var string = \"\";\r\n string += \"<?xml version=\\\"1.0\\\" en...
[ "0.64828223", "0.64828223", "0.64421576", "0.6151626", "0.6039792", "0.586277", "0.5733433", "0.57023036", "0.56643206", "0.56106687", "0.5572768", "0.5566464", "0.5564782", "0.5537526", "0.55187654", "0.55080014", "0.55027914", "0.54890335", "0.5485538", "0.5480646", "0.5437...
0.6032036
5
Blocco 2.1 e 3.1 Occorrenze:
function createInstance_Blocco1(param) { var tag = '' if (param.blocco == 'DTE') tag = 'CedentePrestatoreDTE'; else if (param.blocco == 'DTR') tag = 'CessionarioCommittenteDTR'; if (tag.length<=0) return; var msgContext = '<' + tag + '>'; //2.1.1 <IdentificativiFiscali> var xbrlContent = xml_createElementWithValidation("IdPaese", param.datiContribuente.nazione,1,'2',msgContext); xbrlContent += xml_createElementWithValidation("IdCodice", param.datiContribuente.partitaIva,1,'1...28',msgContext); xbrlContent = xml_createElementWithValidation("IdFiscaleIVA",xbrlContent,1); xbrlContent += xml_createElementWithValidation("CodiceFiscale", param.datiContribuente.codiceFiscale,0,'11...16',msgContext); xbrlContent = xml_createElementWithValidation("IdentificativiFiscali",xbrlContent,1); //2.1.2 <AltriDatiIdentificativi> var xbrlContent2 = ''; if (param.datiContribuente.tipoContribuente == 1) { xbrlContent2 = xml_createElementWithValidation("Denominazione", xml_escapeString(param.datiContribuente.societa),0,'1...80',msgContext); } else { xbrlContent2 = xml_createElementWithValidation("Nome", xml_escapeString(param.datiContribuente.nome),0,'1...60',msgContext); xbrlContent2 += xml_createElementWithValidation("Cognome", xml_escapeString(param.datiContribuente.cognome),0,'1...60',msgContext); } var xbrlContent3 = xml_createElementWithValidation("Indirizzo", xml_escapeString(param.datiContribuente.indirizzo),1,'1...60',msgContext); xbrlContent3 += xml_createElementWithValidation("NumeroCivico", xml_escapeString(param.datiContribuente.ncivico),0,'1...8',msgContext); xbrlContent3 += xml_createElementWithValidation("CAP", xml_escapeString(param.datiContribuente.cap),1,'5',msgContext); xbrlContent3 += xml_createElementWithValidation("Comune", xml_escapeString(param.datiContribuente.comune),1,'1...60',msgContext); xbrlContent3 += xml_createElementWithValidation("Provincia", param.datiContribuente.provincia,0,'2',msgContext); xbrlContent3 += xml_createElementWithValidation("Nazione", param.datiContribuente.nazione,1,'2',msgContext); xbrlContent2 += xml_createElementWithValidation("Sede", xbrlContent3,1); xbrlContent += xml_createElementWithValidation("AltriDatiIdentificativi",xbrlContent2,1); xbrlContent = xml_createElementWithValidation(tag,xbrlContent,1); return xbrlContent; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cocina(){}", "function constroiEventos(){}", "bouton_centrage_pos() {}", "fetchCuisines() {\n return this._getIndexRange('cuisine');\n }", "transient private internal function m185() {}", "function Copcar(){}", "function Co(t,e){0}", "function Cnds() {}", "private public function m246() {}", ...
[ "0.5775774", "0.564699", "0.5584293", "0.55479026", "0.54073966", "0.53450215", "0.53359485", "0.5334379", "0.5311781", "0.5289047", "0.52330065", "0.5223862", "0.5201788", "0.52009743", "0.51729506", "0.51524776", "0.5146285", "0.514294", "0.5108738", "0.50918025", "0.508245...
0.4860965
70