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
Logout user to db
async logout(req, res) { try { // console.log("Hello"); const currentUser = req.user.id; console.log("Current User = ", currentUser); // console.log(req.user); // const user = await userModel.findById(currentUser); const user = await sequelize.query( `SELECT * FROM "user" WHERE Id='${currentUser}'`, ); // console.log(user) if (user.length !== 0) { user.token = null; // await user.save(); await sequelize.query(`UPDATE "user" SET token=${user.token}`); return res.send("Thank you visit again"); } else { throw Error("Please Login first"); } } catch (err) { return res.send({ msg: err.msg }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "logout() {\n _handleUserLogout();\n userDb.logout(this.user);\n this.userId = null;\n }", "function logout() {\n var user = $stamplay.User().Model;\n user.logout();\n }", "logout() { Backend.auth.logout(); }", "doLogout() {\n this.user = null;\n }", "logout() {\...
[ "0.84915847", "0.83125484", "0.7911084", "0.7909532", "0.7856018", "0.77770144", "0.77166724", "0.7583284", "0.7579947", "0.7565246", "0.7555801", "0.75535446", "0.75429374", "0.75406486", "0.7533462", "0.7525072", "0.7507471", "0.75051874", "0.74745995", "0.74734306", "0.747...
0.7167798
69
Return the number of letters of the longest word
function countMaxLetters(arr) { let maxCount = 0 for (word of arr) { if (word.length > maxCount) { maxCount = word.length } } return maxCount }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longestWord(sen) {}", "function findLongestWordLength(str) {\n let arr = str.split(' ');\n let longestWordCount = 0; \n for (let i = 0; i < arr.length; i++) {\n let letterCount = arr[i].length;\n if (letterCount > longestWordCount) {\n longestWordCount = letterCount;\n ...
[ "0.8564614", "0.8308133", "0.81195366", "0.8062265", "0.80450237", "0.8039002", "0.8036529", "0.8020933", "0.80086875", "0.8000622", "0.7999504", "0.7997454", "0.7988468", "0.796877", "0.7968203", "0.7965833", "0.79570377", "0.795621", "0.7953558", "0.79530823", "0.79529667",...
0.0
-1
Output the frame to the console
function makeFrame(arr) { let borderWidth = countMaxLetters(arr) + 4; // Make top border topBorder = '' for (let i = borderWidth; i > 0; i--) { topBorder += '*' } console.log(topBorder) // Make middle borders for (word of arr) { let middleBorder = '* ' + word // Add spaces if the length of the border is less than the borderWidth for (; middleBorder.length < borderWidth - 2;) { middleBorder += ' ' } middleBorder += ' *' console.log(middleBorder) } // Make bottom border let bottomBorder = '' for (let i = borderWidth; i > 0; i--) { bottomBorder += '*' } console.log(bottomBorder) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function frameConsoleListener (message) {\n console.log('frame:', message.data)\n}", "function consoleLogFrames() {\n console.log(\"consoleLogFrames()\");\n frames.forEach(frame => {\n console.log(\"frame:\", frame);\n });\n }", "drawFrame() {\n const term = this._terminal,\n ...
[ "0.736046", "0.7294354", "0.71238273", "0.7092929", "0.6713339", "0.668371", "0.66681486", "0.63698465", "0.62586266", "0.62450475", "0.61698484", "0.6151097", "0.6104736", "0.609078", "0.6030327", "0.59334594", "0.5915864", "0.5904062", "0.58770734", "0.5840642", "0.58146685...
0.0
-1
This is an async function that will run the task in synchronous succession to ensure all calls are resolved this function will await multiple functions
async function runTask() { while (isRunning) { let result = await getTask(); await submitTask(result); postData(); await new Promise(resolve => setTimeout(resolve, 2000)) .catch(error =>console.log(error.message)); if (!isRunning) { break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function executeHardAsync() {\n const r1 = await fetchUrlData(apis[0]);\n const r2 = await fetchUrlData(apis[1]);\n}", "async function executeTasks() {\n for (const task of autoTasks) {\n await executeTask(task);\n }\n }", "async function asyncPromiseAll() {\n //PLACE YOUR ...
[ "0.67336273", "0.6714969", "0.66731167", "0.66301775", "0.65760773", "0.6546365", "0.65360326", "0.6470068", "0.646884", "0.64657193", "0.6456139", "0.6450517", "0.64408326", "0.6422546", "0.6387878", "0.6316789", "0.6313531", "0.63122416", "0.63047755", "0.6298999", "0.62904...
0.0
-1
50 FPS dla 20 milis
sendPlayerPosition() { const player = this.players.get(this.myPlayerName); // this.lastAngle = player.angle; // // this.setDeceleratingTimeout(()=> { // const player: Player = this.players.get(this.myPlayerName); // this.requestCache.addRequest(++this.counterRequest, player.x, player.y); // if(this.arrayWithAdditionalData.length < 2000) { // this.arrayWithAdditionalData.push(new AdditionalObject(5555,this.additionalData)); // } // // this.websocketService.sendPosition({ // "nickname": this.myPlayerName, // "positionX": player.x, // "positionY": player.y, // "score": player.score, // "stepDirection": this.getDirection(), // "version": this.counterRequest, // "requestTimestamp": new Date().getTime(), // // "additionalData": this.arrayWithAdditionalData // }); // // }, 1, 10000); this.lastX = player.x; this.lastY = player.y; this.lastAngle = player.angle; const dataProvider = Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["interval"])(1000); const subscriptionDataProvider = dataProvider.subscribe(() => { for (let i = 0; i < 10; i++) { this.arrayWithAdditionalData.push(new _communication_simulation_data_AdditionalObject__WEBPACK_IMPORTED_MODULE_8__["AdditionalObject"](5555, this.additionalData)); } if (this.arrayWithAdditionalData.length > 300) { subscriptionDataProvider.unsubscribe(); } }); this.positionSender = Object(rxjs__WEBPACK_IMPORTED_MODULE_3__["interval"])(20); this.positionSenderSubscription = this.positionSender.subscribe(() => { const player = this.players.get(this.myPlayerName); if ((this.lastX !== player.x) || (this.lastY !== player.y) || (this.lastAngle !== player.angle)) { this.lastX = player.x; this.lastY = player.y; this.lastAngle = player.angle; this.requestCache.addRequest(++this.counterRequest, player.x, player.y); this.websocketService.sendPosition({ "nickname": this.myPlayerName, "positionX": player.x, "positionY": player.y, "score": player.score, "stepDirection": this.getDirection(), "version": this.counterRequest, "requestTimestamp": new Date().getTime(), "additionalData": this.arrayWithAdditionalData }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FPS() {\n\t\tresize();\n\t\ttimeouts();\n\t\t(CS.tab === 'game' && S && S.firstTick && CS.enableGraphics) && R.drawCanvas();\n\t\t$timeout(FPS, Math.round(1000/CS.FPS));\n\t}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 100...
[ "0.7572863", "0.71874315", "0.7010846", "0.6964547", "0.6928189", "0.68858063", "0.6867111", "0.6853093", "0.68528295", "0.6820719", "0.67642415", "0.67642415", "0.67642415", "0.6708033", "0.66997045", "0.66997045", "0.669287", "0.6682535", "0.6677085", "0.6666229", "0.666616...
0.0
-1
call the constructor method
constructor(props) { //Call the constrictor of Super class i.e The Component super(props); //maintain the state required for this component this.state = { orders: "", filteredorders: "", orderStatusModal: false, idOrders: "", deliveryMode: "", status: "", currentPage: 1, itemsPerPage: 3, }; this.editOrderStatusHandler = this.editOrderStatusHandler.bind(this); this.statusChangeHandler = this.statusChangeHandler.bind(this); this.submitStatus = this.submitStatus.bind(this); this.onChange=this.onChange.bind(this); this.handleClick = this.handleClick.bind(this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _construct()\n\t\t{;\n\t\t}", "function _ctor() {\n\t}", "constructur() {}", "function Constructor() {\n // All construction is actually done in the init method\n if ( this.initialize )\n this.initialize.apply(this, arguments);\n }", "function Constructor() {}", "function Con...
[ "0.80362153", "0.79341316", "0.78611135", "0.7843023", "0.78206825", "0.78206825", "0.78206825", "0.76931036", "0.7557418", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7528882", "0.7507304", "0.74755096", "0.7461952", "0.7433301", "0.74325...
0.0
-1
if this returns!=null, need to go back and reprocess
function resolveMovements(dir){ var moved=true; while(moved){ moved=false; for (var i=0;i<level.dat.length;i++) { var movementMask = level.movementMask[i]; if (movementMask!=0) { moved = repositionEntitiesAtCell(i) || moved; } } } var doUndo=false; for (var i=0;i<level.movementMask.length;i++) { var cellMask = level.dat[i]; var movementMask = level.movementMask[i]; if (movementMask!==0) { var rigidMovementAppliedMask = level.rigidMovementAppliedMask[i]; var movementMask_restricted = rigidMovementAppliedMask&movementMask; if (movementMask_restricted!==0) { //find what layer was restricted for (var j=0;j<6;j++) { var layerSection = parseInt("11111",2)&(movementMask_restricted>>(5*j)); if (layerSection!==0) { //this is our layer! var rigidGroupIndexMask = level.rigidGroupIndexMask[i]; var rigidGroupIndex = parseInt("11111",2)&(rigidGroupIndexMask>>(5*j)); rigidGroupIndex--;//group indices start at zero, but are incremented for storing in the bitfield var groupIndex = state.rigidGroupIndex_to_GroupIndex[rigidGroupIndex]; level.bannedGroup[groupIndex]=true; //backtrackTarget = rigidBackups[rigidGroupIndex]; doUndo=true; break; } } } for (var j=0;j<state.sfx_MovementFailureMasks.length;j++) { var o = state.sfx_MovementFailureMasks[j]; var objectMask = o.objectMask; if ((objectMask&cellMask)!==0) { var directionMask = o.directionMask; if ((movementMask&directionMask)!==0 && seedsToPlay_CantMove.indexOf(o.seed)===-1) { seedsToPlay_CantMove.push(o.seed); } } } } level.movementMask[i]=0; level.rigidGroupIndexMask[i]=0; level.rigidMovementAppliedMask[i]=0; } return doUndo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "process(){\n return null;\n }", "function reflowContent() {\n\t\t\t}", "function skip() {\n return null;\n }", "Rewind() {}", "_postProcessing() {\n // None yet...\n }", "_onProcessReplaceableContent() {}", "if (/*ret DOES NOT contain any hint on the result (lock is cr...
[ "0.65821373", "0.5725703", "0.5591418", "0.5571777", "0.5411897", "0.5408327", "0.53868663", "0.53556263", "0.52832", "0.52642417", "0.51549935", "0.51361966", "0.51334184", "0.5128336", "0.5123329", "0.5109923", "0.51048267", "0.50990194", "0.5075524", "0.5074784", "0.506458...
0.0
-1
Look for '.stories' in __stories__ folders in src
function loadStories() { require('../src/components/__stories__/welcome'); // Load welcom page first req.keys().forEach(filename => req(filename)); // get all stories from context }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStories({ pkg, dir = \"components\" }) {\n const dirName = `packages/${dir}`\n const scope = pkg ? [pkg] : fs.readdirSync(dirName)\n return scope\n .map((pkg) => `${dirName}/${pkg}/stories`)\n .filter((storyDir) => fs.existsSync(storyDir))\n .map((storyDir) => `../${storyDir}/*.stories.tsx`...
[ "0.73268574", "0.72863346", "0.724253", "0.70414096", "0.69892466", "0.6905347", "0.6499714", "0.5854654", "0.5812476", "0.5608716", "0.54625857", "0.543285", "0.53899676", "0.53851503", "0.5384343", "0.5267367", "0.5193101", "0.51910317", "0.51756597", "0.51421094", "0.51415...
0.63767487
7
options can be: Local options: lineRegex: defaults to /[\n\r]/. Better know what your doing if you change it. Parent options: decodeStrings: If you want strings to be buffered (Default: true) highWaterMark: Memory for internal buffer of stream (Default: 16kb) objectMode: Streams convert your data into binary, you can opt out of by setting this to true (Default: false)
constructor(options) { super(options); this._lineRegex = (is.notNil(options) && is.notNil(options.lineRegex)) ? options.lineRegex : DEFAULT_LINE_REGEX; this._last = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(options) {\n this.context = options.context;\n this.dryRun = options.dryRun;\n this.logger = options.logger;\n this.encoding = options.encoding || 'utf-8';\n }", "function Source(obj, options) {\n Readable.call(this, options);\n this.obj = obj;\n this.arrLen = this.arrInd = 0;\n...
[ "0.598805", "0.5458345", "0.53923386", "0.53203326", "0.5241645", "0.5241645", "0.5212115", "0.51200736", "0.51083565", "0.51083565", "0.50362635", "0.5031804", "0.50278515", "0.5024184", "0.5013628", "0.5013628", "0.50017864", "0.50017864", "0.50017864", "0.50017864", "0.500...
0.63171875
0
Base pairs are a pair of AT and CG. pairElement("ATCGA") should return [["A","T"],["T","A"],["C","G"],["G","C"],["A","T"]]. pairElement("TTGAG") should return [["T","A"],["T","A"],["G","C"],["A","T"],["G","C"]]. pairElement("CTCTA") should return [["C","G"],["T","A"],["C","G"],["T","A"],["A","T"]]. split("") the str to turn into an array create a for loop for the newly created array create the switch() statement for each iterated element. case "A" : ["A", "T"]; break; case "C" : newArr.push(["C", "G"]); break; return newArr;
function pairElement(str) { let arr = str.split(""); let newArr = []; let len = arr.length; for (let i = 0; i < len; i++) { switch(arr[i]) { case 'A': newArr.push(['A', 'T']); break; case 'T': newArr.push(['T', 'A']); break; case 'C': newArr.push(['C', 'G']); break; case 'G': newArr.push(['G','C']); break; } } return newArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pairElement(str) {\n let at = ['A','T'];\n let ta = ['T','A'];\n let gc = ['G','C'];\n let cg = ['C','G'];\n let returnArr = [];\n let arr = str.split(\"\");\n \n arr.map(k => {\n if(k === \"A\") {\n returnArr.push(at);\n } else if(k === \"T\") {\n returnArr.push(ta);\n } else i...
[ "0.8297701", "0.82293373", "0.820291", "0.8188886", "0.8101683", "0.7922902", "0.7810319", "0.7804721", "0.77858955", "0.77729666", "0.77284795", "0.7638515", "0.7618238", "0.7614296", "0.75772583", "0.7571956", "0.7476376", "0.74648416", "0.739352", "0.7204998", "0.719899", ...
0.83368564
0
const allTotals = orderTotals.reduce(tallyTotal, 0); console.log(allTotals);
function inventoryReducer(totals, item){ // totals[item.type] ? totals[item.type]+= 1 : totals[item.type] = 1; totals[item.type] = totals[item.type] + 1 || 1; return totals; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "calculateTotals(data) {\n let calculate = (acc, current) => acc + current;\n let total = data.reduce(calculate);\n return total;\n }", "function branchestotal() {\n let arraytotal = [];\n\n for (let i = 0; i < hours.length; i++) {\n let sum = Seattle.salesbyhour[i] + Tokyo.salesbyhour[i] + Dubai.s...
[ "0.7326449", "0.6930972", "0.69220483", "0.6861372", "0.682198", "0.68217546", "0.6781276", "0.67359465", "0.673043", "0.6714041", "0.6685003", "0.66444325", "0.6633071", "0.6631445", "0.66283816", "0.6615619", "0.6598131", "0.6589962", "0.6586849", "0.6558342", "0.65088177",...
0.0
-1
takes a JSON or YAML string, returns YAML string
function load(string) { var jsonError, yamlError; if (!angular.isString(string)) { throw new Error('load function only accepts a string'); } // Try figuring out if it's a JSON string try { JSON.parse(string); } catch (error) { jsonError = error; } // if it's a JSON string, convert it to YAML string and return it if (!jsonError) { return jsyaml.dump(JSON.parse(string)); } // Try parsing the string as a YAML string and capture the error try { jsyaml.load(string); } catch (error) { yamlError = error; } // If there was no error in parsing the string as a YAML string // return the original string if (!yamlError) { return string; } // If it was neither JSON or YAML, throw an error throw new Error('load function called with an invalid string'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function yamlString2JsonObject (data) {\n // 1. Render YAML template\n // nunjucks.configure({ autoescape: false });\n // const contents = nunjucks.renderString(template, params);\n // 2. Convert YAML text to JSON Object\n return yaml.load(data);\n}", "function yaml(hljs) {\n var LITERALS = 'true fal...
[ "0.7436097", "0.63431114", "0.62323123", "0.6145358", "0.6144687", "0.6144687", "0.6138018", "0.5777885", "0.5621768", "0.5467203", "0.54542303", "0.538984", "0.52895117", "0.523634", "0.52218056", "0.5184282", "0.5152882", "0.5137597", "0.5083414", "0.50124794", "0.50003785"...
0.7127248
1
calcule de la moyenne des notes de l'eleve avec les coefficients
static moyenneNote(tableauNotes,idStagiaire = -1) { // sommes des notes*coef // sommes des coef let sommeNoteCoef = 0 let sommeCoef = 0 tableauNotes.forEach(function(element) { if (element.id === idStagiaire || idStagiaire === -1) { sommeNoteCoef += element.note * element.coef sommeCoef += element.coef } }); if (sommeCoef != 0 && tableauNotes.length !=0) { return sommeNoteCoef /sommeCoef } else { return -1 } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "pow22523(z) {\r\n const t0 = new FieldElement();\r\n const t1 = new FieldElement();\r\n const t2 = new FieldElement();\r\n let i;\r\n t0.square(z);\r\n // for (i = 1; i < 1; i++) {\r\n // t0.square(t0);\r\n // }\r\n t1.square(t0);\r\n for (i...
[ "0.6165908", "0.59032685", "0.5873705", "0.5796195", "0.57925344", "0.5783441", "0.57514644", "0.5713553", "0.5702795", "0.56911266", "0.5604644", "0.55746", "0.55706394", "0.55626744", "0.554239", "0.5528351", "0.5527571", "0.55149704", "0.5494513", "0.5465213", "0.5457862",...
0.6571702
0
Method to load a random card (callable from any component)
loadRandomCard(currentCardId, a) { //document.getElementById(card.id).title = "test test test"; document.getElementById("frontface").style.display = "block"; //card.testest(); // Remove current card so we don't randomly select it const cards = this.get('cards').filter(card => card.id !== currentCardId) const card = cards[Math.floor(Math.random() * cards.length)] this.set({ currentCard: card.id, }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newRndCard() {\n $.getJSON('https://api.scryfall.com/cards/random?q=-type%3Aland+legal%3Alegacy+not%3Atoken+not%3Asplit+not%3Atransform', function (data) {\n saveCard(data);\n })\n }", "function newRandomCard() {\n currentCard = getRandomCard(cardList);\n // ignore transfor...
[ "0.6958431", "0.6816011", "0.6625624", "0.6609234", "0.6605706", "0.6546299", "0.6516402", "0.6473475", "0.6454191", "0.641102", "0.63849986", "0.6367232", "0.63656986", "0.6342588", "0.63051146", "0.62916833", "0.62818265", "0.62649316", "0.62610537", "0.62522215", "0.623763...
0.7514743
0
Method to load a StaticActivity (callable from any component) PhilD
loadStaticActivity(e) { var myClick = document.getElementById('filterText'); myClick.value = e; myClick.addEventListener('change',function(){ this.store.set({ filter: e }) }); myClick.dispatchEvent(new Event('change')); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function activity() {\n dynamicActivity();\n }", "function dynamicActivity() {\n regularActivityMonitor();\n }", "static load() {\n\t\t\treturn loader().then(ResolvedComponent => {\n\t\t\t\tComponent = ResolvedComponent.default || ResolvedComponent\n\t\t\t})\...
[ "0.63854283", "0.56858885", "0.5656677", "0.5606952", "0.5475662", "0.5402945", "0.5345644", "0.5342511", "0.52068734", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.51373327", "0.50948447", "0.50776845", "0.5030943", "0.5029737", "0.49863693", "0.4...
0.0
-1
Method to stop video ac
stopVideo() { var myVideoac = document.getElementById("embedVideo-ac"); var myVideo = document.getElementById("embedVideo"); if(myVideoac) { $(myVideoac).attr("src", $(myVideoac).attr("src")); } if(myVideo) { $(myVideo).attr("src", $(myVideo).attr("src")); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stopVideo() {\r\n player.pauseVideo();\r\n }", "function stopVideo() {\n\tplayer.stopVideo();\n}", "function stopVideo() {\n player.stopVideo();\n clearInterval(videoProgress);\n }", "function stopVideo() {\n // Reset the time to zero\n video.currentTime = 0;\n video.paus...
[ "0.8309867", "0.8251166", "0.8140124", "0.779453", "0.7769203", "0.77488244", "0.7713133", "0.77080923", "0.76743215", "0.7667609", "0.7615451", "0.7608679", "0.760148", "0.7533969", "0.7527587", "0.7527587", "0.7525821", "0.7505799", "0.748565", "0.7287064", "0.72867334", ...
0.7148558
26
This function should say whether the answer it is given is very positive positive negative very negative This function should expect to be called with any value which was returned by the shakeBall function.
function checkAnswer(answer, answerSelection) { //Write your code in here // if the "veryPositive" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "very positive" if (possibleAnswers.veryPositive.includes(answer, [answerSelection])) { return "very positive"; } // if the "positive" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "positive" else if (possibleAnswers.positive.includes(answer, [answerSelection])) { return "positive"; } // if the "negative" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "negative" else if (possibleAnswers.negative.includes(answer, [answerSelection])) { return "negative"; } // if the "veryNegative" values in the possibleAnswers object include the string assigned to "answer" at the index specified by "answerSelection", then return "very negative" else if (possibleAnswers.veryNegative.includes(answer, [answerSelection])) { return "very negative"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isTie(score) { return score == -1000; }", "function negativeAmount() {\n if (userGuess / secretNumber === 1){\n setFeedback(\"You win\");\n finish = true;\n } else if ((userGuess - secretNumber) > 60.5){\n setFeedback(\"Wow! You are freezing!\");\n }...
[ "0.65202147", "0.6217987", "0.61282986", "0.601345", "0.59856915", "0.5980099", "0.59718966", "0.5828195", "0.5761094", "0.5758021", "0.5742971", "0.5707891", "0.56992435", "0.5698446", "0.5668073", "0.5651108", "0.559075", "0.55286837", "0.5524491", "0.5518122", "0.5507059",...
0.0
-1
change these to appropriate shape and predict to matMul for projection
function predict(x, y, z) { return tf.tidy(() => { return a.mul(x) .add(b.mul(y)) .add(c.mul(z)); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function predict(xs){\n //y = mx + b\n return xs.mul(m).add(b);\n }", "predict(rawImage) {\n const out = ms.tf.tidy(() => {\n const x = ms.tf.tensor4d(rawImage, [1, 64, 64, 1]);\n let h = ms.tf.conv2d(x, this.conv1Kernel, 2, 'valid');\n h = ms.tf.add(h, this.conv1Bias);\n ...
[ "0.56783444", "0.5544139", "0.54726607", "0.53894836", "0.526348", "0.52022594", "0.512696", "0.512696", "0.5119257", "0.5116782", "0.5102403", "0.5036253", "0.50329655", "0.5013155", "0.49926764", "0.49902257", "0.49791205", "0.49791205", "0.49761164", "0.49726117", "0.49680...
0.49377775
22
getStorage will test to see if the requested storage type is available, if it is not, it will try sessionStorage, and if that is also not available, it will fallback to InMemoryStorage.
function getStorage(type) { try { // Get the desired storage from the window and test it out. const storage = window[type]; testStorageAccess(storage); // Storage test was successful! Return it. return storage; } catch (err) { // When third party cookies are disabled, session storage is readable/ // writable, but localStorage is not. Try to get the sessionStorage to use. if (type !== 'sessionStorage') { console.warn('Could not access', type, 'trying sessionStorage', err); return getStorage('sessionStorage'); } console.warn( 'Could not access sessionStorage falling back to InMemoryStorage', err ); } // No acceptable storage could be found, returning the InMemoryStorage. return new InMemoryStorage(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _getStorageImpl() {\n\tif (_storageImpl) {\n\t\treturn _storageImpl;\n\t}\n\n\t_impls.some(function(impl) {\n\t\tif (impl.isAvailable()) {\n\t\t\tvar ctor = impl.StorageInterface;\n\t\t\t_storageImpl = new ctor();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\treturn _storageImpl;\n}", "getSt...
[ "0.73001933", "0.7217747", "0.7106509", "0.708953", "0.7034303", "0.70313287", "0.6801023", "0.6793784", "0.67905945", "0.6764917", "0.67363673", "0.67202085", "0.66941226", "0.66817075", "0.6681604", "0.6681604", "0.6677933", "0.6471737", "0.6456842", "0.6394462", "0.6381311...
0.80599177
0
import Welcome from './components/Welcome.js'; import logo from './logo.svg'; import './App.scss';
function App() { return ( <div> <Header /> <BrowserRouter> <Switch> <Route exact path="/" render={(routeProps) => <Login {...routeProps}/>}/> <Route exact path="/signup" render={(routeProps) => <SignUp {...routeProps}/>}/> {/* <Route exact path="/homepage" render={(routeProps) => <Welcome {...routeProps}/>}/> */} </Switch> </BrowserRouter> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function App() {\n return (\n <div className=\"App\">\n <header className=\"App-header\">\n {/* <img src={logo} className=\"App-logo\" alt=\"logo\" /> */}\n <p>\n Edit <code>src/App.js</code> and save to reload.\n </p>\n <a\n className=\"App-link\"\n ...
[ "0.6224062", "0.61821735", "0.61363786", "0.59900844", "0.5947303", "0.59075284", "0.5870664", "0.58633506", "0.5859991", "0.58150065", "0.58050996", "0.57918704", "0.57840955", "0.5723755", "0.5713401", "0.57089853", "0.57041204", "0.56953216", "0.5669719", "0.56651413", "0....
0.0
-1
========================== Route Handlers ============================
function getLocation (request, response) { const queryFromInput = request.query.city; client.query(`SELECT * FROM locations WHERE search_query = '${queryFromInput}'`) .then (theCityData => { if(theCityData.rowCount === 1){ console.log('Retrieved result from db'); response.send(theCityData.rows[0]); } else { const dynamicURL = `https://us1.locationiq.com/v1/search.php?key=${GEOCODE_API_KEY}&q=${queryFromInput}&format=json`; superagent.get(dynamicURL) .then(resultData => { const resultArrayFromBody = resultData.body; const insertString = 'INSERT INTO locations (search_query, formatted_query, latitude, longitude) VALUES ($1, $2, $3, $4)'; const valueArray = [queryFromInput, resultArrayFromBody[0].display_name, resultArrayFromBody[0].lat,resultArrayFromBody[0].lon]; client.query(insertString, valueArray) .then( () => { console.log('Added location to db'); response.send(new Location(resultArrayFromBody, queryFromInput)); }); }); } }) .catch(error => { console.log(error); response.status(500).send(error.message); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_handleRoute(e) {\n this.log.logApi('_handleRoute', e);\n var _hash = location.hash.replace(/^#\\/|\\/$/gi, '/');\n var parser = document.createElement('a');\n parser.href = _hash;\n var _routeObj = null;\n var res = {};\n var req = {\n hostname: parser.hostname,\n host: parser.host,...
[ "0.73137426", "0.7291649", "0.72706354", "0.7260056", "0.7000022", "0.6909446", "0.69084156", "0.68842363", "0.6829947", "0.6821414", "0.6810019", "0.67251444", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.67245466", "0.6716181", "0.67028487", "0.6...
0.0
-1
=================== Misc. Functions =====================
function Location(jsonObject, query) { this.search_query = query; this.formatted_query = jsonObject[0].display_name; this.latitude = jsonObject[0].lat; this.longitude = jsonObject[0].lon; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient protected internal function m189() {}", "static final private internal function m106() {}", "transient private protected internal ...
[ "0.6945316", "0.67050767", "0.65102595", "0.64728105", "0.6239555", "0.6215942", "0.61588246", "0.6157968", "0.611046", "0.6045635", "0.5958986", "0.5958986", "0.591287", "0.59122753", "0.5872593", "0.58559895", "0.578994", "0.5784584", "0.57767916", "0.57570446", "0.57476676...
0.0
-1
This method is specifically for reading JSON files in a Tree
function readJsonInTree(host, path) { if (!host.exists(path)) { throw new Error(`Cannot find ${path}`); } const contents = stripJsonComments(host.read(path).toString('utf-8')); try { return JSON.parse(contents); } catch (e) { throw new Error(`Cannot parse ${path}: ${e.message}`); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loadJson() {\n return readFile(this.jsonPath, { encoding: 'utf8' }).then((jsonText) => {\n this.jsonText = jsonText;\n return (this.jsonData = JSON.parse(jsonText));\n });\n }", "static fromJson(js) {\n function recursive(jsnode, name, parent) {\n let node...
[ "0.6572153", "0.65009516", "0.6308541", "0.61559", "0.61420316", "0.61404717", "0.61236334", "0.6120686", "0.6035825", "0.602176", "0.60080594", "0.5985651", "0.59769535", "0.5930707", "0.5927374", "0.5911211", "0.5899703", "0.5881785", "0.5860038", "0.5838828", "0.5835717", ...
0.62460554
3
Method for utilizing the project graph in schematics
function getProjectGraphFromHost(host) { return project_graph_1.onlyWorkspaceProjects(getFullProjectGraphFromHost(host)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function computeSceneGraph() {\n\n //\n // Define Scene Graph\n //\n roomPositionNode = new Node();\n\n tablePositionNode = new Node();\n tablePositionNode.localMatrix = utils.MakeTranslateMatrix(-650, -715, -250.0); // Relative position to room\n\n shelfPositionNode = new Node();\n shelf...
[ "0.58125246", "0.56811225", "0.56728053", "0.56534463", "0.55981594", "0.55971426", "0.5461426", "0.539384", "0.53327006", "0.53272164", "0.5322658", "0.5303184", "0.52290756", "0.5226979", "0.5222293", "0.52115154", "0.520223", "0.5190522", "0.518624", "0.51758665", "0.51744...
0.49671343
52
This method is specifically for updating JSON in a Tree
function updateJsonInTree(path, callback) { return (host, context) => { if (!host.exists(path)) { host.create(path, fileutils_1.serializeJson(callback({}, context))); return host; } host.overwrite(path, fileutils_1.serializeJson(callback(readJsonInTree(host, path), context))); return host; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "UpdateTree()\n {\n\n }", "updateTree(row) {\n // ******* TODO: PART VII *******\n \n }", "function updateJSON(obj) {\n\n console.log(obj)\n //console.log(obj.entree);\n\n xmlFileToJs('Books.xml', function (err, result) {\n if (err) throw (err);\n\n // idCopied = obj.id; //...
[ "0.7194053", "0.66663104", "0.66515094", "0.653263", "0.6475373", "0.6427735", "0.63766587", "0.6362755", "0.6271311", "0.62364334", "0.6094231", "0.6068669", "0.6024248", "0.59884435", "0.59781176", "0.5940478", "0.593712", "0.5928882", "0.59274966", "0.59117675", "0.5909425...
0.66559654
2
verifies whether the given packageJson dependencies require an update given the deps & devDeps passed in
function requiresAddingOfPackages(packageJsonFile, deps, devDeps) { let needsDepsUpdate = false; let needsDevDepsUpdate = false; packageJsonFile.dependencies = packageJsonFile.dependencies || {}; packageJsonFile.devDependencies = packageJsonFile.devDependencies || {}; if (Object.keys(deps).length > 0) { needsDepsUpdate = Object.keys(deps).some((entry) => !packageJsonFile.dependencies[entry]); } if (Object.keys(devDeps).length > 0) { needsDevDepsUpdate = Object.keys(devDeps).some((entry) => !packageJsonFile.devDependencies[entry]); } return needsDepsUpdate || needsDevDepsUpdate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function determineDependents({\n releases,\n packagesByName,\n dependencyGraph,\n preInfo,\n config\n}) {\n let updated = false; // NOTE this is intended to be called recursively\n\n let pkgsToSearch = [...releases.values()];\n\n while (pkgsToSearch.length > 0) {\n // nextRelease is our dependency, thin...
[ "0.639414", "0.6271797", "0.6222505", "0.6055485", "0.6050687", "0.5780931", "0.57698435", "0.5756768", "0.5727764", "0.5701409", "0.5691746", "0.56767374", "0.5662534", "0.56625015", "0.5588799", "0.55429953", "0.5493228", "0.5476981", "0.5446969", "0.5441043", "0.5437413", ...
0.79547036
0
Updates the package.json given the passed deps and/or devDeps. Only updates if the packages are not yet present
function addDepsToPackageJson(deps, devDeps, addInstall = true) { return (host, context) => { const currentPackageJson = readJsonInTree(host, 'package.json'); if (requiresAddingOfPackages(currentPackageJson, deps, devDeps)) { return schematics_1.chain([ updateJsonInTree('package.json', (json, context) => { json.dependencies = Object.assign(Object.assign(Object.assign({}, (json.dependencies || {})), deps), (json.dependencies || {})); json.devDependencies = Object.assign(Object.assign(Object.assign({}, (json.devDependencies || {})), devDeps), (json.devDependencies || {})); json.dependencies = sortObjectByKeys(json.dependencies); json.devDependencies = sortObjectByKeys(json.devDependencies); return json; }), add_install_task_1.addInstallTask({ skipInstall: !addInstall, }), ]); } else { return schematics_1.noop(); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function requiresAddingOfPackages(packageJsonFile, deps, devDeps) {\n let needsDepsUpdate = false;\n let needsDevDepsUpdate = false;\n packageJsonFile.dependencies = packageJsonFile.dependencies || {};\n packageJsonFile.devDependencies = packageJsonFile.devDependencies || {};\n if (Object.keys(deps)...
[ "0.73457325", "0.6911505", "0.65562487", "0.619107", "0.6153813", "0.6046005", "0.5957651", "0.5914926", "0.59013903", "0.5895902", "0.58865327", "0.5879123", "0.5726318", "0.569718", "0.56145304", "0.5594718", "0.55524945", "0.5523478", "0.5501209", "0.548553", "0.5478032", ...
0.74712354
0
Applies a template merge but skips for already existing entries
function applyWithSkipExisting(source, rules) { return (tree, _context) => { const rule = schematics_1.mergeWith(schematics_1.apply(source, [ ...rules, schematics_1.forEach((fileEntry) => { if (tree.exists(fileEntry.path)) { return null; } return fileEntry; }), ])); return rule(tree, _context); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function merge(template, importing, trim) {\n\t\tfor(var a in template){\n\t\t\tif(template.hasOwnProperty(a)){\n\t\t\t\tif(typeof template[a] === 'object'){\n\t\t\t\t\tif(importing.hasOwnProperty(a)) template[a] = merge(template[a], importing[a]);\n\t\t\t\t} else {\n\t\t\t\t\tif(importing.hasOwnProperty(a)){\n\t\...
[ "0.6655246", "0.61193633", "0.6110943", "0.5813038", "0.55150366", "0.54771286", "0.5454094", "0.5386252", "0.53108203", "0.5285453", "0.51440984", "0.51282567", "0.512309", "0.51094687", "0.50689054", "0.505966", "0.49993476", "0.49748415", "0.49550512", "0.49384743", "0.490...
0.0
-1
general function for Maze
function Maze(i,j){ this.i = i;//col number this.j = j;//row number this.walls = [true,true,true,true]; this.visited = false;// at the beginning all cells are not visited //play buttons this.moveUp = function (){ let top = grid[index(i,j-1)]; if(top && this.walls[0] !== true) { counter++; return top; } else { return current } } this.moveRight = function (){ let right = grid[index(i+1,j)]; if(right && this.walls[1] !== true) { counter++; return right; } else { return current } } this.moveDown = function (){ let bottom = grid[index(i,j +1)]; if(bottom && this.walls[2] !== true) { counter++; return bottom; } else { return current } } this.moveLeft = function (){ let left = grid[index(i-1,j)]; if(left && this.walls[3] !== true) { counter++; return left; } else { return current } } //check neighbors function this.checkNeighbors = function(){ const neighbors = []; let top = grid[index(i,j-1)]; let right = grid[index(i+1,j)]; let bottom = grid[index(i,j +1)]; let left = grid[index(i-1,j)]; if(top && !top.visited) { neighbors.push(top) } if(right && !right.visited) { neighbors.push(right) } if(bottom && !bottom.visited) { neighbors.push(bottom) } if(left && !left.visited) { neighbors.push(left) } if (neighbors.length > 0) { const random = Math.floor(Math.random() * neighbors.length); return neighbors[random] } else { return undefined } } //highligt the current cell this.highlight = function (){ const x = this.i*w; const y = this.j*w; // mtx.beginPath(); // mtx.fillStyle = "rgba(0,255,255,100)"; // mtx.fillRect(x+3, y+3, w-6, w-6); mtx.drawImage(playerImg, x, y, w, w); } //highlight the finish cell this.finishColor = function () { const x = this.i*w; const y = this.j*w; // mtx.beginPath(); // mtx.fillStyle = "green"; // mtx.fillRect(x+3, y+3, w-6, w-6); mtx.drawImage(finishImg, x, y, w, w); } //show wall for each side and show visited rectangle this.show = function() { const x = this.i*w; const y = this.j*w; mtx.strokeStyle = "#000000" if(this.walls[0]){ // top wall mtx.beginPath(); mtx.moveTo(x, y); mtx.lineTo(x+w, y); mtx.stroke(); } if(this.walls[1]){ // right wall mtx.beginPath(); mtx.moveTo(x+w, y); mtx.lineTo(x+w, y+w); mtx.stroke(); } if(this.walls[2]){ // bottom wall mtx.beginPath(); mtx.moveTo(x+w, y+w); mtx.lineTo(x, y+w); mtx.stroke(); } if(this.walls[3]){ // left wall mtx.beginPath(); mtx.moveTo(x, y+w); mtx.lineTo(x, y); mtx.stroke(); } if(this.visited){ // draw a rectangle on visited cell mtx.beginPath(); mtx.fillStyle = "yellow"; mtx.fillRect(x, y, w, w); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initMaze(){}", "function createMaze(){\n const mazeCoords1 = \n [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 50, 53, 54, 55, 78, 51, 56,\n 58, 59, 60, 61, 63, 65, 66, 67, 68, 70, 71, 72, 73, 75,76, 81, 83, 84, 85,86, 88, 90,91, 92, 93, 95, 9...
[ "0.76066935", "0.7354995", "0.7127011", "0.6972833", "0.6931987", "0.6923433", "0.6872217", "0.68403685", "0.6839254", "0.66935384", "0.66702247", "0.6612621", "0.65969306", "0.65934485", "0.6585963", "0.65586257", "0.6558258", "0.65507925", "0.6536741", "0.6536082", "0.64988...
0.67638975
9
formula for check neighbors function
function index(i, j){ if(i < 0 || j < 0 || i > cols-1 || j > rows-1){ return -1; } return i + j * cols; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getNeighbors(i, j) {\n\t\tlet neighbors = 0;\n // This section checks above the cell\n //checks up left\n if (i-1 >= 0 && j-1 >= 0 && this.grid[i-1][j-1] > 0){\n neighbors++;\n }\n //checks up\n if (i-1 >= 0 && this.grid[i-1][j] > 0){\n neighbors++;\n }\n //checks up right\n ...
[ "0.6992609", "0.689685", "0.6895429", "0.6581897", "0.65636486", "0.65496486", "0.65411913", "0.65163827", "0.64936787", "0.6463766", "0.6424949", "0.6423989", "0.64076734", "0.6393453", "0.6385809", "0.63783205", "0.6364528", "0.63609326", "0.63589156", "0.63463277", "0.6345...
0.0
-1
setup function which will create cells in canvas
function setup(){ cols = Math.floor(width/w); rows = Math.floor(height/w); //for each column in each row create a cell for (let rn = 0; rn < rows; rn++){ for(let cn = 0; cn < cols; cn++){ const cell = new Maze(cn,rn); grid.push(cell); } current = grid[0]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {\n createCanvas(600, 600); //initiate a canvas with width and hegiht\n cols = floor(width / w); //defining columns = 300/20 = 15\n rows = floor(height / w); //defining row...
[ "0.7747093", "0.76394457", "0.7602361", "0.7556827", "0.7544321", "0.74835265", "0.74592876", "0.7452599", "0.7426448", "0.7397788", "0.73968375", "0.73597836", "0.73011374", "0.72466093", "0.7182325", "0.7156476", "0.7134719", "0.7129528", "0.7123863", "0.7112673", "0.710711...
0.0
-1
remove walls for visited cell
function removeWalls(a,b) { let x = a.i - b.i; if(x === 1){ a.walls[3] = false; b.walls[1] = false; } else if (x === -1) { a.walls[1] = false; b.walls[3] = false; } let y = a.j -b.j; if(y === 1){ a.walls[0] = false; b.walls[2] = false; } else if (y === -1) { a.walls[2] = false; b.walls[0] = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeWalls() {\n if (wallsAreRemoved) {\n return;\n }\n\n let leftSize = neighborSizes[corner_].left;\n let rightSize = neighborSizes[corner_].right;\n\n if (width_ != depth_) {\n shedWalls[cornerNeighbors[corner_].left]...
[ "0.7318625", "0.71253294", "0.70598537", "0.7024343", "0.69079334", "0.6897713", "0.6857468", "0.68298393", "0.6694814", "0.66589856", "0.6642677", "0.66212666", "0.6602228", "0.65807366", "0.6543212", "0.6521065", "0.65134346", "0.6428458", "0.6419398", "0.63995546", "0.6359...
0.68074995
8
function for playing game with arrow keys
function moveK(e) { // When top arrow is pressed if(e.isComposing || e.keyCode === 38) { current.show(); current = current.moveUp(); current.highlight(); if(current === finish){ finishGame(); } } // When right arrow is pressed else if (e.isComposing || e.keyCode === 39) { current.show(); current = current.moveRight(); current.highlight(); if(current === finish){ finishGame(); } } // When down arrow is pressed else if (e.isComposing || e.keyCode === 40) { current.show(); current = current.moveDown(); current.highlight(); if(current === finish){ finishGame(); } } // When left arrow is pressed else if (e.isComposing || e.keyCode === 37) { current.show(); current = current.moveLeft(); current.highlight(); if(current === finish){ finishGame(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pressArrowKeys (event) {\n // console.log(event.keyCode);\n if (!gameStarted || changingTurn) { \n return; \n }\n\n let isFightMode = canFight(currentPlayer, otherPlayer);\n console.log(\"isFightMode: \" + isFightMode);\n if (isFightMode) {\n fightMode(event.keyCode)\n }else{\n boardMode(e...
[ "0.8098633", "0.7753985", "0.77434087", "0.7593963", "0.75272375", "0.74864584", "0.7401027", "0.7370474", "0.7364861", "0.7364486", "0.7319837", "0.73161626", "0.7293669", "0.7289943", "0.7274823", "0.726557", "0.7264979", "0.7251032", "0.7239211", "0.7236777", "0.72364175",...
0.7140463
35
hacemos que caiga / Objeto Pieza y funciones
function Pieza(tetromino, color) { this.tetromino = tetromino; this.tetrominoN = 0; this.activeTetromino = this.tetromino[this.tetrominoN]; this.color = color; this.x = 3; this.y = -2; /* Coordenadas del cuadradro */ for (let r = 0; r < this.activeTetromino.length; r++) { for (let c = 0; c < this.activeTetromino.length; c++) { if (this.activeTetromino[r][c] == 1) { dibujarCuadrado(this.x + c,this.y + r, this.color); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(nombreObjeto, apellido,altura){\n //Atributos\n this.nombre = nombreObjeto\n this.apellido = apellido\n this.altura = altura\n }", "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una...
[ "0.659673", "0.63725376", "0.63395274", "0.62690043", "0.62068874", "0.61483926", "0.61455524", "0.6131831", "0.61301297", "0.6109071", "0.61087435", "0.6108083", "0.60952175", "0.6094972", "0.60909075", "0.60650957", "0.606131", "0.6060889", "0.6057851", "0.6055717", "0.6050...
0.0
-1
Automatizamos la caida de la pieza
function Tirar() { let ahora = Date.now(); let intervalo = ahora - tirar; if (intervalo > 500) { p.moverAbajo(); tirar = Date.now(); } if(gameOver == false) { requestAnimationFrame(Tirar); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "reiniciarConteo() {\n this.ultimo = 0;\n this.tickets = [];\n this.grabarArchivo();\n ...
[ "0.6317149", "0.6249964", "0.6069885", "0.59685194", "0.59417474", "0.58946717", "0.58690196", "0.5834735", "0.5822921", "0.58184886", "0.58173984", "0.5797686", "0.5792543", "0.5762617", "0.5691861", "0.56891483", "0.5682685", "0.56727475", "0.5669907", "0.56602633", "0.5649...
0.0
-1
When the application runs in the background
function handleBackground() { $('#statusDiv').text('status: in background '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onAppBackground() {\n\tappscore.print.start();\n\n \tappscore.print.stop();\n}", "appHasGoneToTheBackground() {\n console.log(\"App has gone to the background.\");\n database.close();\n }", "function runBackgroundTask(){\n setTimeout(function(){\n console.log(\"backgr...
[ "0.69980395", "0.67590755", "0.6653784", "0.65710723", "0.6444786", "0.6428241", "0.6419935", "0.6405048", "0.6303666", "0.6270641", "0.620489", "0.62013495", "0.61752766", "0.6114105", "0.60336375", "0.60259926", "0.60259926", "0.6003771", "0.5994139", "0.59903693", "0.59838...
0.5575683
53
When the application doesn't rub
function handleColdStart() { $('#statusDiv').text('status: in coldstart '); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ts_skip_or_boost()\n{\n// open_application(\"INRstarWindows\");\n\n ts_skip_or_boost_sorb_button_user_permissions();\n ts_skip_or_boost_sorb_button_dosing_method_validation();\n ts_skip_or_boost_sorb_button_review_period_validation();\n ts_skip_or_boost_sorb_button_self_test_validation();\n ts_skip_o...
[ "0.61176944", "0.5900901", "0.5820811", "0.5809142", "0.5799704", "0.57780474", "0.57692564", "0.5693567", "0.5692997", "0.5669804", "0.56598526", "0.5659485", "0.5654658", "0.56527585", "0.56492007", "0.5648123", "0.5645128", "0.5639765", "0.5618585", "0.56154007", "0.561078...
0.0
-1
this function is called after the login
function enterSys() { UserInfo.UserId = document.getElementById('userNum').value; // ajax function that registers the user/device to the server registerDevice(UserInfo, registerSuccess, registerFail); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loginCompleted() {\n }", "function login() {\n self.isLoggedIn = true;\n }", "function onLogin() {}", "function processSuccessLogin(result) {\n // Success Login save the id and the loginId to the footer\n // Can't save to session or anything...
[ "0.76448536", "0.6951168", "0.68976545", "0.68782693", "0.67930317", "0.6772691", "0.67680377", "0.67315924", "0.6719814", "0.66701674", "0.6637969", "0.6613015", "0.65612966", "0.655495", "0.652538", "0.65249854", "0.6521088", "0.650381", "0.6496224", "0.64937305", "0.648692...
0.0
-1
Operational panel functions //////////////////////////////////////////////////
function set_pwd(value) { old_pwd = $('#I_GE1_WIDTH').val(); $('#I_GE1_WIDTH').val(value); if (!check_value("I_GE1_WIDTH")){ $('#I_GE1_WIDTH').val(old_pwd); $('#I_OPE_STEP2_GE1_PWD').val(old_pwd); return false; } commands = '"GEN C1:BSWV WIDTH,' + parseFloat(value) + '","GEN C1:OUTP?","GEN C1:BSWV?"'; to_refresh = generator_ch1_parameters input_disable(to_refresh, generator_ch1_buttons); laserServer(commands, to_refresh, 0, function() { input_enable(to_refresh, generator_ch1_buttons); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function PanelHelper() {\n\t}", "function LogicPanel(params){var width=params.width; // width for the whole row\n\tvar vis=params.visElement; // the node for whole vis\n\tvar panel=params.panelElement; // panel element\n\tvar cellSize=params.cellSize; // cell size for a particular subset indicator (circle)\n\tva...
[ "0.74158674", "0.6937558", "0.66936165", "0.66304797", "0.66304797", "0.6625742", "0.6581457", "0.6517481", "0.651188", "0.6504578", "0.64080423", "0.6366527", "0.63622344", "0.6327781", "0.63234264", "0.6313651", "0.62925214", "0.6292424", "0.629154", "0.62834483", "0.628186...
0.0
-1
Attenuator interface functions /////////////////////////////////////////////////
function set_db(value, data) { commands = ""; if (value == "field") { if (data) { value = data; } else if ($('#I_ATT_DB').val() == "") { alert("ERROR: Empty dB value"); return; } else { value = $('#I_ATT_DB').val(); } commands = '"STA OPE 0",' } commands = commands + '"ATT A' + Math.round(parseFloat(value)*100)/100 + '","ATT D"'; to_refresh = '"ATT_LAST","ATT_DB","ATT_PERCENT","ATT_POS"' input_disable(to_refresh, attenuator_buttons); laserServer(commands, to_refresh, 0, function() { input_enable(to_refresh, attenuator_buttons + "," + attenuator_fields); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Alerter() {}", "function Assoc(){}", "function ea(){}", "function IndividualAttestation() {}", "function IUIMenuBaseProcessor() {}", "function VIEWAS_aim_IMme(obj) {\n var anchor = myDocument.createElement('a');\n anchor.setAttribute('href', \"aim:goim?screenname=\" + obj.value + \...
[ "0.62196976", "0.6131821", "0.58408445", "0.58085287", "0.5683437", "0.5656472", "0.56421614", "0.562133", "0.5612589", "0.5587436", "0.55552125", "0.53921574", "0.53584594", "0.53532565", "0.53484136", "0.53453946", "0.5339503", "0.5330586", "0.53237593", "0.53137827", "0.52...
0.0
-1
Generator interface functions //////////////////////////////////////////////////
function load_default(channel) { input_disable(generator_parameters, generator_buttons); values = channel_defaults[channel]; for (var key in values) { $('#I_' + key).val(values[key]); } input_enable(generator_parameters, generator_buttons); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}", "function Generator() {}",...
[ "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "0.7807606", "...
0.0
-1
Managing elements readability //////////////////////////////////////////////////
function input_disable(values, extra_disable) { if (values) { var arrayValues = values.split(","); var arrayLength = arrayValues.length; for (var i = 0; i < arrayLength; i++) { $('[id=' + arrayValues[i].replace('"', '"I_') + ']').prop('disabled', true); } } if (extra_disable) { arrayValues = extra_disable.split(","); arrayLength = arrayValues.length; for (var i = 0; i < arrayLength; i++) { $('[id=' + arrayValues[i] + ']').prop('disabled', true); } } // Extra for coloring an update while on stages 2 or 3 $('[id^="I_OPE_STEP"]').prop('disabled', true); if (operational == 2) { $('[id="I_OPE_STEP2_GE1_FRQ"]').removeClass('uncompleted'); $('[id="I_OPE_STEP2_GE1_PWD"]').removeClass('uncompleted'); $('[id="I_OPE_STEP2_ATT_DB"]').removeClass('uncompleted'); } else if (operational == 3) { $('[id="I_OPE_STEP3_GE1_FRQ"]').removeClass('uncompleted'); $('[id="I_OPE_STEP3_ATT_DB"]').removeClass('uncompleted'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readElement(_element)\r\n{\r\n\r\n}", "element(element){\r\n element.setInnerContent(this.content);\r\n}", "function Elements() {\n}", "element(element) {\n const attributeToChange = element.getAttribute(this.name)\n\n // console.log(`Name: ${this.name}`)\n // console.log(`Incoming element...
[ "0.5704688", "0.5665996", "0.5547745", "0.54517716", "0.5433795", "0.54307806", "0.5415638", "0.53849494", "0.53634727", "0.53288925", "0.53286797", "0.5307545", "0.53017116", "0.5292224", "0.5291478", "0.528939", "0.5288277", "0.5278258", "0.5258134", "0.5256301", "0.52518",...
0.0
-1
Main laserServer interaction tool //////////////////////////////////////////////
function log_access() { $.getJSON('http://gd.geobytes.com/GetCityDetails?callback=?', function(data) { $.post("lib/laserAccess.php", { random: Math.random(), request: JSON.stringify(data, null, 2) }, /* Callback */ ); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() {\r\n this.serverInstance = new Server();\r\n this.firstLab = false; // Flag for whether the first lab command has been received\r\n }", "function Server() {}", "function Main(){\n\t/**\n\t * @property _http\n\t * @type http\n\t * @private\n\t */\n\tthis._http = require('http');\n\t\n\t/**...
[ "0.6596127", "0.6475046", "0.6358283", "0.63549477", "0.63181895", "0.62134886", "0.6182677", "0.61457354", "0.6034331", "0.6022438", "0.59755063", "0.59675527", "0.59551495", "0.5926308", "0.5904621", "0.5901326", "0.58987087", "0.5894966", "0.58764446", "0.5853212", "0.5851...
0.0
-1
The code supports the following hooks: dartPrint(message) if this function is defined it is called instead of the Dart [print] method. dartMainRunner(main) if this function is defined, the Dart [main] method will not be invoked directly. Instead, a closure that will invoke [main] is passed to [dartMainRunner].
function Isolate() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function print() { console.log('Hello') }", "function printHello(){\n console.log(\"Hello World\");\n}", "function printHello() {\n console.log( \"Hello, World!\");\n }", "function printHello(){\n console.log( \"Hello, World!\");\n}", "function print() {\n console.log('print'); \n}", "print() ...
[ "0.7041391", "0.6483073", "0.64380515", "0.64020544", "0.63678986", "0.6344778", "0.63120365", "0.629683", "0.6288885", "0.62705487", "0.62030035", "0.6201771", "0.61412853", "0.61379194", "0.61365175", "0.6077598", "0.6071957", "0.6062781", "0.60190004", "0.6003274", "0.5993...
0.0
-1
! SCOREBOARD ASSETS This is the function that runs to add scoreboard assets
function addScoreboardAssets(){ manifest.push({src:'assets/scoreboard/bg_scoreboard.png', id:'bgScoreboard'}); manifest.push({src:'assets/scoreboard/icon_replay.png', id:'iconReplay'}); manifest.push({src:'assets/scoreboard/icon_save.png', id:'iconSave'}); manifest.push({src:'assets/scoreboard/icon_scoreboard.png', id:'iconScoreboard'}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AddAssets()\n{\n\t//Add static background sprites\n\tbackColor = gfx.CreateRectangle(1, 1, 0xfffdad )\n\tgfx.AddGraphic( backColor, 0 , 0 )\n\tgfx.AddSprite( face, 0, 0.886, 1 )\n\tgfx.AddSprite( pasta, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( pastaIcon, 0.85, 0.08, 0.1 )\n\tgfx.AddSprite( paperIcon, 0.86, 0.1...
[ "0.665967", "0.618519", "0.6041548", "0.5946782", "0.590872", "0.58981675", "0.5803563", "0.57757103", "0.5715938", "0.56942326", "0.5668764", "0.5655068", "0.5628573", "0.5514279", "0.5502467", "0.5500538", "0.54809815", "0.5478778", "0.546091", "0.54503673", "0.53984475", ...
0.7803341
0
! SCOREBOARD CANVAS This is the function that runs to build scoreboard canvas
function buildScoreBoardCanvas(){ if(!displayScoreBoard){ return; } //buttons resultContainer.removeChild(replayButton); buttonReplay = new createjs.Bitmap(loader.getResult('iconReplay')); centerReg(buttonReplay); createHitarea(buttonReplay); saveButton = new createjs.Bitmap(loader.getResult('iconSave')); centerReg(saveButton); createHitarea(saveButton); scoreboardButton = new createjs.Bitmap(loader.getResult('iconScoreboard')); centerReg(scoreboardButton); createHitarea(scoreboardButton); resultContainer.addChild(buttonReplay, saveButton, scoreboardButton); //scoreboard scoreBoardContainer = new createjs.Container(); bgScoreboard = new createjs.Bitmap(loader.getResult('bgScoreboard')); scoreTitle = new createjs.Text(); scoreTitle.font = "80px bariol_regularregular"; scoreTitle.color = "#ffffff"; scoreTitle.text = scoreBoardTitle; scoreTitle.textAlign = "center"; scoreTitle.textBaseline='alphabetic'; scoreTitle.x = canvasW/2; scoreTitle.y = canvasH/100*14; scoreBackTxt = new createjs.Text(); scoreBackTxt.font = "50px bariol_regularregular"; scoreBackTxt.color = "#ffffff"; scoreBackTxt.text = scoreBackText; scoreBackTxt.textAlign = "center"; scoreBackTxt.textBaseline='alphabetic'; scoreBackTxt.x = canvasW/2; scoreBackTxt.y = canvasH/100*95; scoreBackTxt.hitArea = new createjs.Shape(new createjs.Graphics().beginFill("#000").drawRect(-200, -30, 400, 40)); scoreBoardContainer.addChild(bgScoreboard, scoreTitle, scoreBackTxt); var scoreStartY = canvasH/100*23; var scoreSpanceY = 49.5; for(scoreNum=0;scoreNum<=10;scoreNum++){ for(scoreColNum=0;scoreColNum<score_arr.length;scoreColNum++){ $.scoreList[scoreNum+'_'+scoreColNum] = new createjs.Text(); $.scoreList[scoreNum+'_'+scoreColNum].font = "35px bariol_regularregular"; $.scoreList[scoreNum+'_'+scoreColNum].color = "#ffffff"; $.scoreList[scoreNum+'_'+scoreColNum].textAlign = score_arr[scoreColNum].align; $.scoreList[scoreNum+'_'+scoreColNum].textBaseline='alphabetic'; $.scoreList[scoreNum+'_'+scoreColNum].x = canvasW/100 * score_arr[scoreColNum].percentX; $.scoreList[scoreNum+'_'+scoreColNum].y = scoreStartY; if(scoreColNum == 0){ //position $.scoreList[scoreNum+'_'+scoreColNum].text = scoreRank_arr[scoreNum-1]; } if(scoreNum == 0){ $.scoreList[scoreNum+'_'+scoreColNum].text = score_arr[scoreColNum].col; } scoreBoardContainer.addChild($.scoreList[scoreNum+'_'+scoreColNum]); } scoreStartY += scoreSpanceY; } scoreBoardContainer.visible = false; canvasContainer.addChild(scoreBoardContainer); $.get('submit.html', function(data){ $('#canvasHolder').append(data); buildScoreboardButtons(); toggleSaveButton(true); resizeScore(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showScoreBoard() {\n let title = level >= 15 ? 'Congrats, you won!' : 'Ah, you lost!',\n titleX = level >= 15 ? 152 : 220,\n titleY = 280,\n totalScore = level * 60 + GemsCollected.blue * 30 + GemsCollected.green * 40 + GemsCollected.orange * 50,\n scoreB...
[ "0.73607624", "0.70869297", "0.70739704", "0.70584774", "0.6974996", "0.6938553", "0.6934178", "0.6922656", "0.6910067", "0.6897704", "0.6890096", "0.68763286", "0.68348974", "0.67919546", "0.6740421", "0.6738843", "0.6728717", "0.6710097", "0.66862345", "0.66760695", "0.6633...
0.82207555
0
! TOGGLE SUBMIT SCORE BUTTON This is the function that runs to display submit score button
function toggleSaveButton(con){ saveButton.visible = false; if(con){ saveButton.visible = true; buttonReplay.x = canvasW/100 * 40; saveButton.x = canvasW/2; scoreboardButton.x = canvasW/100 * 60; buttonReplay.y = saveButton.y = scoreboardButton.y = canvasH/100*65; }else{ buttonReplay.x = canvasW/100 * 45; scoreboardButton.x = canvasW/100 * 55; buttonReplay.y = saveButton.y = scoreboardButton.y = canvasH/100*65; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitScore() {\n playerScore = playerScore + quizTimer; \n \n highscoresBtn.disabled = false;\n quizArea.classList.add(\"hide\");\n timerArea.classList.add(\"hide\");\n scoreInput.classList.remove(\"hide\");\n \n scoreHeader.innerHTML = \"Congratulations! Your score is \" + playerScore + \"!\";\...
[ "0.7403726", "0.7203572", "0.7027058", "0.6890308", "0.6847451", "0.682187", "0.68187296", "0.67482615", "0.6747704", "0.6709199", "0.6707848", "0.66887385", "0.667758", "0.66754323", "0.6670127", "0.6568055", "0.6558327", "0.6501015", "0.6493093", "0.6485444", "0.64812475", ...
0.0
-1
! SCOREBOARD BUTTONS This is the function that runs to build scoreboard buttons
function buildScoreboardButtons(){ $('#buttonCancel').click(function(){ playSound('soundSelect'); goScorePage(''); }); $('#buttonSubmit').click(function(){ playSound('soundSelect'); var typeString = 'quizgame' if(categoryPage){ typeString = category_arr[categoryNum]; } submitUserScore(typeString, playerData.score); }); scoreBackTxt.cursor = "pointer"; scoreBackTxt.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage(''); }); buttonReplay.cursor = "pointer"; buttonReplay.addEventListener("click", function(evt) { playSound('soundSelect'); if(categoryPage){ goPage('category'); }else{ goPage('game'); } }); saveButton.cursor = "pointer"; saveButton.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage('submit'); }); scoreboardButton.cursor = "pointer"; scoreboardButton.addEventListener("click", function(evt) { playSound('soundSelect'); goScorePage('scoreboard'); var typeString = 'quizgame' if(categoryPage){ typeString = category_arr[categoryNum]; } loadScoreboard(typeString); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createButtons() {\n // When the A button is pressed, add the current frame\n // from the video with a label of \"rock\" to the classifier\n buttonA = select('#addClassRock');\n buttonA.mousePressed(function() {\n addExample('Rock');\n });\n\n // When the B button is pressed, add the current frame...
[ "0.69475615", "0.6863367", "0.6840834", "0.6805191", "0.68026936", "0.67381406", "0.672422", "0.6720168", "0.6617027", "0.6563274", "0.65039325", "0.64585024", "0.64482474", "0.64416", "0.64400285", "0.64362717", "0.64337057", "0.6413039", "0.6410319", "0.63975495", "0.638806...
0.80036443
0
! DISPLAY TOP 10 SCOREBOARD This is the function that runs to display top ten scoreboard
function goScorePage(page){ var targetContainer; scoreBoardContainer.visible = false; $('#scoreHolder').hide(); switch(page){ case 'submit': targetContainer = null; $('#scoreHolder').show(); resizeScore(); break; case 'scoreboard': targetContainer = scoreBoardContainer; break; case '': targetContainer = null; break; } if(targetContainer != null){ targetContainer.visible = true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function printScoreBoard(scores) {\n console.log(chalk.bgYellow(\"___Top Scores___\"));\n scores.forEach((score) => {\n console.log(score.name, score.score);\n })\n}", "function displayScores(){\r\n\t\r\n\tvar t = \"<h1>Top 10 Players</h1>\\\r\n\t\t\t <table style='background-color: black; border-...
[ "0.7363857", "0.7139446", "0.70748156", "0.6969238", "0.69445103", "0.67901194", "0.6730064", "0.6616461", "0.6544919", "0.65332484", "0.65230167", "0.64692616", "0.6465121", "0.6456275", "0.64492875", "0.6420509", "0.6406408", "0.64025176", "0.6373816", "0.63457686", "0.6331...
0.0
-1
! RESIZE SCORE This is the function that runs to resize score
function resizeScore(){ $('.fontLink').each(function(index, element) { $(this).css('font-size', Math.round(Number($(this).attr('data-fontsize'))*scalePercent)); }); $('#scoreHolder').css('width',stageW*scalePercent); $('#scoreHolder').css('height',stageH*scalePercent); $('#scoreHolder').css('left', (offset.left/2)); $('#scoreHolder').css('top', (offset.top/2)); $('#scoreHolder .scoreInnerContent').css('width',contentW*scalePercent); $('#scoreHolder .scoreInnerContent').css('height',contentH*scalePercent); var spaceTop = (stageH - contentH)/2; var spaceLeft = (stageW - contentW)/2; $('#scoreHolder .scoreInnerContent').css('left', spaceLeft*scalePercent); $('#scoreHolder .scoreInnerContent').css('top', spaceTop*scalePercent); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScoreboard() {\n scoreboardGroup.clear(true, true);\n\n const scoreAsString = score.toString();\n if (scoreAsString.length === 1) {\n scoreboardGroup.create(assets.scene.width, 30, assets.scoreboard.base + score).setDepth(10);\n } else {\n let initialPosition = assets.scene.width - ((score...
[ "0.6918159", "0.66235214", "0.6431632", "0.6410671", "0.63819176", "0.6295828", "0.6294661", "0.62264955", "0.6119847", "0.6098467", "0.60890585", "0.6087336", "0.60847205", "0.6015591", "0.600963", "0.59730434", "0.59582454", "0.595048", "0.5935952", "0.5930025", "0.59141195...
0.75561607
0
sensei: pjfranzini Write a function that accepts a square matrix (N x N 2D array) and returns the determinant of the matrix. How to take the determinant of a matrix it is simplest to start with the smallest cases: A 1x1 matrix |a| has determinant a. A 2x2 matrix [ [a, b], [c, d] ] or |a b| |c d| has determinant: ad bc. The determinant of an n x n sized matrix is calculated by reducing the problem to the calculation of the determinants of n matrices ofn1 x n1 size. For the 3x3 case, [ [a, b, c], [d, e, f], [g, h, i] ] or |a b c| |d e f| |g h i| the determinant is: a det(a_minor) b det(b_minor) + c det(c_minor) where det(a_minor) refers to taking the determinant of the 2x2 matrix created by crossing out the row and column in which the element a occurs: | | | e f| | h i| Note the alternation of signs. The determinant of larger matrices are calculated analogously, e.g. if M is a 4x4 matrix with first row [a, b, c, d], then: det(M) = a det(a_minor) b det(b_minor) + c det(c_minor) d det(d_minor)
function determinant(m) { switch (m.length) { //handles empty matrix case 0: return 1; //exit condition && handles singleton matrix case 1: return m[0][0]; default: //detrmnnt will build array of terms to be combined into determinant //ex. a*det(a_minor) - b*det(b_minor)... let detrmnnt = [] //pos controls alternation of terms ('+' or '-') for (let i = 0, pos = 1; i < m.length; i++, pos *= -1) { //adds term, ex. +/- a * det(a_minor) detrmnnt.push(pos * (m[0][i] * determinant(nMinor(m, i)))) } return detrmnnt.reduce((accu, elem) => accu + elem) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function determinant(m) {\n if (m.length == 1)\n return m[0][0];\n function calc(matrix) {\n if (matrix.length == 2)\n return matrix[0][0] * matrix[1][1] - matrix[1][0] * matrix[0][1];\n let res = 0, sign = 1;\n for (let i = 0; i < matrix[0].length; i++) {\n ...
[ "0.74909025", "0.73743075", "0.7320607", "0.7210089", "0.7180129", "0.7121054", "0.7027388", "0.6933576", "0.67923373", "0.67677796", "0.6689784", "0.61586154", "0.60582674", "0.59964216", "0.597575", "0.59676594", "0.5915091", "0.5856863", "0.581085", "0.58018345", "0.571447...
0.75930524
0
functions creates n_minor from m
function nMinor (m, n) { let minor = [] //h = 1 to skip first row of matrix for (let h = 1; h < m.length; h++) { minor.push(m[h].filter((el, it) => it !== n)) } return minor }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function minor2x2() {\r\n if (selection_text_misc_2x2.textContent == \"Inverse\" || selection_text_misc_2x2.textContent == \"Co-factor\" || selection_text_misc_2x2.textContent == \"Adjoint\") {\r\n minor_array.push(Number(misc_array_1[3]));\r\n minor_array.push(Number(misc_array_1[2]))...
[ "0.6104964", "0.6036262", "0.5782669", "0.57583183", "0.5351479", "0.53313696", "0.53313696", "0.53313696", "0.5235025", "0.5235025", "0.50572795", "0.5027724", "0.50156075", "0.4935707", "0.48972484", "0.488601", "0.48772857", "0.47691962", "0.4761753", "0.47323486", "0.4722...
0.69566524
0
overwrtiting the base class method
set textContent(slot) { super.textContent = slot.symbol; this.element.style.backgroundColor = "white"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SuperclassBare() {}", "function SuperclassBare() {}", "function Derived() {} // private", "function inherited() { }", "function inherit(){}", "_init() {\n throw new Error('_init not implemented in child class');\n }", "_validate() {\n throw new Error('_validate not implemented in child ...
[ "0.658801", "0.658801", "0.6444007", "0.63787264", "0.62448585", "0.6161258", "0.6152798", "0.61477923", "0.6138755", "0.6083694", "0.60551834", "0.6012701", "0.5978831", "0.5976824", "0.59462583", "0.59222496", "0.59062105", "0.59062105", "0.59019303", "0.58654284", "0.58567...
0.0
-1
removes the default question and answer template from the index.html
function resetState () { while (answerButtonsEl.firstChild) { answerButtonsEl.removeChild(answerButtonsEl.firstChild); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderDefaultQuestions() {\n const questions = [\"What type of courses Esoft conduct ?\",\"Is Esoft government funding institute ?\",\"How many branches esoft has ?\",\"Is Esoft UGC Approved ?\"];\n let content = '';\n questions.forEach(function(ques) {\n content += '<div c...
[ "0.59955484", "0.5873079", "0.5767851", "0.5767851", "0.5767851", "0.5767851", "0.57677186", "0.5693977", "0.56838655", "0.56594306", "0.5641748", "0.5620396", "0.55827075", "0.55773056", "0.55520344", "0.55163145", "0.55137175", "0.5512406", "0.54976475", "0.5487846", "0.546...
0.0
-1
display the question and assigns buttons to the answers
function showQuestion(questionArray) { questionEl.innerText = questionArray.question; questionArray.answers.forEach(answer => { var button = document.createElement('button'); button.innerText = answer.text; button.classList.add("btn"); if (answer.correct) { button.dataset.correct = answer.correct; }; if (answer.correct == false ) { button.classList.add("incorrect"); }; button.addEventListener("click", selectAnswer); answerButtonsEl.appendChild(button); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion() {\n questionText.textContent = currentQuestionObject.question;\n for (i=0; i<4; i++) {\n answerButtons[i].textContent = currentQuestionObject.choices[i]\n }\n}", "function displayQuestions(question) {\n questionElement.innerText = question.question\n question.answers....
[ "0.8377368", "0.8140302", "0.80799204", "0.80794954", "0.806764", "0.8049341", "0.80475515", "0.80439633", "0.8043309", "0.80325294", "0.8023251", "0.7999934", "0.7987537", "0.79858375", "0.7984536", "0.79589915", "0.7956796", "0.7950418", "0.7949029", "0.7944118", "0.7943031...
0.74713093
61
Captures the click and determines if the answer does/does not have the dataset.correct = true
function selectAnswer (e) { var selectedButton = e.target; if (selectedButton.dataset.correct == "true") { const correctEL = document.createElement("correct"); correctEL.textContent = "Correct"; answerButtonsEl.appendChild(correctEL); } else { const wrongEL = document.createElement("wrong"); wrongEL.textContent = "Wrong"; answerButtonsEl.appendChild(wrongEL); if (secondsLeft < 5) { secondsLeft = 0; timerEl.innerHTML = secondsLeft; } else { secondsLeft -= 10; timerEl.innerHTML = secondsLeft; } } if (shuffledQuestions.length > currentQuestionIndex + 1) { setTimeout(nextQuestion, 500); } else { setTimeout(enterScore(), 500); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAnswerClick(1); }}", "function answerIsIncorrect () {\r\n feedbackForIncorrect();\r\n}", "function answerIsCorrect () {\r\n feedbackForCorrect();\r\n updateScore();\r\n}", "function choseAnswer(e) {\n const selectedButton = e.tar...
[ "0.7579413", "0.7311059", "0.72258425", "0.72008383", "0.71359575", "0.7104971", "0.70324665", "0.69513124", "0.6915632", "0.68759054", "0.6873346", "0.6834623", "0.6831694", "0.6822777", "0.68135947", "0.6807325", "0.6763811", "0.6736996", "0.6652514", "0.6600428", "0.658286...
0.0
-1
Enter Score that starts the ending screen
function enterScore () { questionContainerEl.classList.add("hide"); enterScoreEL.classList.remove("hide2"); clearInterval(startTime); if (secondsLeft < 0) { secondsLeft = 0 } finalScoreEL.textContent = "Your final score is " + secondsLeft; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "end(score=0) {\r\n this._mainTheme.pause();\r\n\twindow.cancelAnimationFrame(this.animationFrame);\r\n\r\n\tthis.offsetY = 0;\r\n\tthis._mode = \"failed\";\r\n\tcont.innerHTML = `<div class=\"loose_screen\">\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\tYOU LOSE\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div>\r\n\t\t\t\t\t\tYour sc...
[ "0.72276706", "0.7178877", "0.71736205", "0.7072301", "0.7034315", "0.7016307", "0.6974885", "0.68623686", "0.6849652", "0.68495196", "0.683184", "0.6826522", "0.68233377", "0.67996955", "0.677231", "0.67701626", "0.6769106", "0.67597103", "0.67529017", "0.6751491", "0.673095...
0.6788323
14
function prevents the localstorage being reset from var highScores = []; that was declared in the beginning
function getHighScores () { var getPastScores = localStorage.getItem("highscore"); if (getPastScores === null) { highScores = []; } else { highScores = JSON.parse(localStorage.getItem("highscore")); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function storedHighs() {\n localStorage.setItem(\"Scores\", JSON.stringify(highs));\n }", "function clearScore() {\n localStorage.setItem(\"highscore\", \"\");\n localStorage.setItem(\"highscoreName\", \"\");\n var allScores = localStorage.getItem(\"allScores\");\nallScores = JSON.parse(allScores);...
[ "0.8045468", "0.8006161", "0.797451", "0.7972429", "0.79716206", "0.7776171", "0.7736761", "0.7723185", "0.7712638", "0.77111447", "0.7690294", "0.7683815", "0.76812947", "0.767065", "0.7668651", "0.762816", "0.7620422", "0.7620355", "0.76109535", "0.76096016", "0.7598561", ...
0.8064676
0
bugs found during development
function test_identifier_resolution() { var x = foo->(); while(x) x++; do { x++; } while(x); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "transient private protected internal function m182() {}", "private public function m246() {}", "protected internal function m252() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static final private intern...
[ "0.7280872", "0.6806307", "0.6799944", "0.67960155", "0.6596679", "0.6545445", "0.6480211", "0.64103407", "0.6382251", "0.63307935", "0.6309032", "0.6264464", "0.6089724", "0.59815174", "0.59727657", "0.59639025", "0.589937", "0.5813442", "0.580698", "0.5751638", "0.5735708",...
0.0
-1
const bcrypt = require('bcryptjs'); const jwt = require('jsonwebtoken') const SALTROUNDS = 10; ALL QUESTIONS WITHOUT A 'CREATED BY' TAG WERE DOWNLOADED FROM OPEN TRIVIA DATABASE'S API ( WE CHOSE TO POPULATE OUR OWN DATABSE BECAUSE THE API WOULD HAVE BREAK EVERY SO OFTEN.
function createQuestion(req, res, next) { console.log('enter question!') db.none(`INSERT INTO new_questions (question, correct_answer, answerA, answerB, answerC, answerD, category, difficulty, created_by) Values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`, [req.body.question, req.body.correct_answer, req.body.answerA, req.body.answerB, req.body.answerC, req.body.answerD, req.body.category, req.body.difficulty, req.body.created_by]) .then(next()) .catch(error => next(error)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tokenConAlgoritmo(){\n const secretKey='secretKey';\n //secret key que será usada en el token\n\n const claims = {\n userName:'The user name'\n } // contenido del JWT playload\n\n\n const token =jwt.sign(claims,secretKey, {algorithm:'RS256'});\n console.log(token);\n}", "static ...
[ "0.6181677", "0.6095123", "0.5912715", "0.59001136", "0.5883616", "0.5873459", "0.57919645", "0.57747495", "0.5770917", "0.5702357", "0.567579", "0.56359124", "0.56306833", "0.56282026", "0.56204534", "0.5601367", "0.55994904", "0.5567897", "0.556433", "0.5547715", "0.5519197...
0.0
-1
Method to encrypt password
function encrypt(password) { var cryptLib = require('cryptlib'), iv = 'rv6Isv_BpSFBrB2V' //cryptLib.generateRandomIV(16), //16 bytes = 128 bit key = 'b16920894899c7780b5fc7161560a412' //cryptLib.getHashSha256('my secret key', 32), //32 bytes = 256 bits encryptedText = cryptLib.encrypt(password, key, iv); return encryptedText; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encryptWithPassword(something){\n return sjcl.encrypt(userPassword, something);\n}", "function encrypt(pwd)\n\t\t\t\t{\n\t\t\t\t\tvar pwd;\n\t\t\t\t\tvar encrypt;\n\t\t\t\t\tencrypt = \"\";\n\t\t\t\t\t\n\t\t\t\t\tfor(var i = 0; i < pwd.length-1; i++) //This code encrypts the password of the user so n...
[ "0.76149404", "0.75778526", "0.74944186", "0.74570376", "0.7374853", "0.7374853", "0.71472377", "0.7125782", "0.71183157", "0.702803", "0.7019693", "0.69415605", "0.687509", "0.6871541", "0.68300706", "0.6810715", "0.6776599", "0.67360896", "0.67202425", "0.6670661", "0.66617...
0.7111993
9
Path to the fixture file.
get FIXTURE() { return resolve(FIXTURE, 'test.txt') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fixturePath() {\n for (var _len = arguments.length, pathParts = Array(_len), _key = 0; _key < _len; _key++) {\n pathParts[_key] = arguments[_key];\n }\n\n return _path2.default.join.apply(_path2.default, [__dirname, '..', 'fixtures'].concat(pathParts));\n}", "function fixturePath(path, extension, ...
[ "0.7704921", "0.6518775", "0.6440356", "0.6153649", "0.60106796", "0.58949023", "0.5857106", "0.5853383", "0.57627285", "0.5690874", "0.5611548", "0.5584239", "0.5522971", "0.5452458", "0.53591", "0.53410643", "0.5321657", "0.52875394", "0.5273929", "0.5271327", "0.52455354",...
0.63638514
5
We're giving you this function. Take a look at it, you might see some usage that's new and different. That's because we're avoiding a wellknown, but sneaky bug that we'll cover in the next few lessons! As a result, the lessons for this function will pass and it will be available for you to use if you need it!
function createEmployeeRecord(array){ return{ firstName: array[0], familyName: array[1], title: array[2], payPerHour: array[3], timeInEvents: [], timeOutEvents: [] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "transient protected internal function m189() {}", "transient final protected internal function m174() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private i...
[ "0.62395704", "0.61227185", "0.6059905", "0.6038518", "0.5978909", "0.59690875", "0.5925256", "0.5879324", "0.57484204", "0.5731846", "0.57314694", "0.56979316", "0.5684633", "0.56527984", "0.56388783", "0.56274456", "0.56184494", "0.5584748", "0.5572903", "0.5569722", "0.556...
0.0
-1
Given a node it returns the Microsoft Word list level, returning undefined for an item that isn't a MS Word list node
function getMsWordListLevel (node) { if (node.nodeName.toLowerCase() !== 'p') { return } const style = node.getAttribute('style') const levelMatch = style && style.match(/mso-list/i) ? style.match(/level(\d+)/) : null return levelMatch ? parseInt(levelMatch[1], 10) : undefined }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLevel(node){\n\tif(node.properties.hasOwnProperty(\"Level\")){\n\t\treturn node.properties.Level;\n\t}else{\n\t\treturn -1;\n\t}\n}", "function getFakeBulletText(node, levels) {\n // Word uses the following format for their bullets:\n // &lt;p style=\"mso-list:l1 level1 lfo2\"&gt;\n // &lt;s...
[ "0.6671859", "0.6670137", "0.63771504", "0.621316", "0.61555356", "0.57949203", "0.57655865", "0.57128376", "0.5696541", "0.5672241", "0.5568159", "0.5547469", "0.55358106", "0.55073684", "0.5431245", "0.5384732", "0.5379493", "0.53498167", "0.5301591", "0.5284614", "0.526821...
0.84267855
0
Based on a node that is a list item in a MS Word document, this returns the marker for the list.
function msWordListMarker (node, bulletListMarker) { const markerElement = node.querySelector('span[style="mso-list:Ignore"]') // assume the presence of a period in a marker is an indicator of an // ordered list if (!markerElement || !markerElement.textContent.match(/\./)) { return bulletListMarker } const nodeLevel = getMsWordListLevel(node) let item = 1 let potentialListItem = node.previousElementSibling // loop through previous siblings to count list items while (potentialListItem) { const itemLevel = getMsWordListLevel(potentialListItem) // if there are no more list items or we encounter the lists parent // we don't need to count further if (!itemLevel || itemLevel < nodeLevel) { break } // if on same level increment the list items if (nodeLevel === itemLevel) { item += 1 } potentialListItem = potentialListItem.previousElementSibling } return `${item}.` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getListItemMetadata(node) {\n if (node.nodeType == 1 /* Element */) {\n var listatt = getStyleValue(node, MSO_LIST_STYLE_NAME);\n if (listatt && listatt.length > 0) {\n try {\n // Word mso-list property holds 3 space separated values in the following format: lst1...
[ "0.6383941", "0.5983728", "0.5825579", "0.57465446", "0.56685364", "0.5611878", "0.55966437", "0.54887724", "0.5485846", "0.5417776", "0.54173636", "0.541471", "0.54123527", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.54061615", "0.5...
0.7593762
0
Scroll to Our STORY
function scrollToStory() { storyText.scrollIntoView(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function work() {\n var scrollPos = $(\".case-studies\").offset().top - 80;\n TweenLite.to(window, 2, {scrollTo: {y: scrollPos}, ease: Power2.easeOut});\n }", "function goToWidget(id) {\n document.getElementById(id).scrollIntoView({\n behavior: 'smooth'\n });\n ...
[ "0.6868092", "0.66545063", "0.6495838", "0.64606917", "0.64475346", "0.64205945", "0.64086664", "0.63724476", "0.63724476", "0.6349916", "0.63439167", "0.63286847", "0.63221884", "0.63221884", "0.63221884", "0.63145316", "0.63108826", "0.6302561", "0.63000506", "0.6259576", "...
0.76658046
0
globals __VUE_SSR_CONTEXT__ IMPORTANT: Do NOT use ES2015 features in this file (except for modules). This module is a runtime utility for cleaner component module output and will be included in the final webpack user bundle.
function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Es(t,e,n,i,r,o,a,s){var u=(\"function\"===typeof n?n.options:n)||{};return u.__file=\"source.vue\",u.render||(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),u._scopeId=i,u}", "extend(config, ctx) {\n // if (process.server && process.browser) {\n if (...
[ "0.5848382", "0.572857", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", "0.57254887", ...
0.0
-1
Stores and maybe overrides an edge in this tiddler
insertEdge(tObj, edge, type) { const toTRef = this.tracker.getTiddlerById(edge.to); if (toTRef == null) { // null or undefined return; } // only use the name without the private marker or the namespace utils.setField(tObj, type.name, toTRef); return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get edge () { return this._edge; }", "function setEdge(edge){\n\t\t$.ajax({\n\t\t\turl:'/api/?setedge='+edge.toString(),\n\t\t\tsuccess:function(data){\n\t\t\t\tif(data.success==1){\n\t\t\t\t\t$('#setedge').removeClass('zero one two three four five').addClass(numtoname[data.edge]);\n\t\t\t\t\tlocation.reload...
[ "0.6465942", "0.6356465", "0.61815774", "0.60650307", "0.5993444", "0.59295934", "0.592179", "0.5826054", "0.5819139", "0.58050716", "0.57608664", "0.5736146", "0.5720413", "0.5665284", "0.56340754", "0.5631371", "0.56108606", "0.56108606", "0.56066597", "0.55967414", "0.5583...
0.6174179
3
Deletes an edge in this tiddler
deleteEdge(tObj, edge, type) { const toTRef = this.tracker.getTiddlerById(edge.to); if (toTRef == null) { // null or undefined return; } // only use the name without the private marker or the namespace utils.setField(tObj, type.name, undefined); return edge; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "removeEdge(g, e) { }", "removeEdge(g, e) { }", "removeEdge(edge) {\n let index = this.links.indexOf(edge);\n //Prevent multiple deletion on the same element causing bugs\n if (index != -1) {\n this.links.splice(index, 1);\n this.svgsManager.edgeManager.update();\n ...
[ "0.7873422", "0.7873422", "0.779132", "0.75574404", "0.74871176", "0.705967", "0.70426166", "0.6763776", "0.668116", "0.668116", "0.668116", "0.668116", "0.668116", "0.668116", "0.6513484", "0.64923596", "0.64727736", "0.64702016", "0.6438437", "0.6413313", "0.6401881", "0....
0.70733297
5
var j = 0;
function particle() { for (var i=0; i<50; i++) { var dir = new THREE.Vector3(2*Math.random()-1, Math.random()*4, 2*Math.random()-1); dir.multiplyScalar(6/dir.length()); var color = (Math.random() > 0.5) ? 0x333333 : 0x666666; var p = new Particle(obj.position, dir, color, 0.1); p.maxLife = 3; } /* j += 1; if (j < 5) { setTimeout(particle, 1); } */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function e$j(){return [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}", "function z(){this.i=0,this.j=0,this.S=new Array}", "function j(){}", "function j(){}", "function j(){}", "function re(){this.i=0,this.j=0,this.S=new Array}", "function a() {\n for(var i=0; i<10; i++){\n for(var j=0; j<10; j++){\n ...
[ "0.6916648", "0.657339", "0.6556979", "0.6556979", "0.6556979", "0.64466566", "0.641133", "0.6392126", "0.6392126", "0.63794315", "0.6375725", "0.6375725", "0.6309701", "0.6305316", "0.6305316", "0.6305316", "0.62911266", "0.62623817", "0.62623817", "0.62623817", "0.61422426"...
0.0
-1
return an Array that contain all of acceptable key
getAnswerKey() { var result = []; (this.text).split("").forEach(function(element){ if(!(result.includes(element))) { result.push(element.toLowerCase()); } }) return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "keys() {\n let keysArr = [];\n for (let i = 0; i < this.keyMap.length; i++) {\n if (this.keyMap[i]) {\n for (let j = 0; j < this.keyMap[i].length; i++) {\n if (!keysArr.includes(this.keyMap[i][j][1])) {\n keysArr.push(this.keyMap[i][j][1]);\n }\n }\n }\n ...
[ "0.68787193", "0.6815506", "0.67043084", "0.66145074", "0.6563455", "0.6413596", "0.6384232", "0.6379176", "0.6245468", "0.62219363", "0.6123341", "0.61029136", "0.6098591", "0.60450935", "0.6000911", "0.599229", "0.5978049", "0.595493", "0.5954633", "0.5945082", "0.59410894"...
0.57746065
40
get an array of keys when a valid answer is supply answerChar are assure by gameBoard to always supply the correct answer and give response to bad answer
getAnswerIndex(answerChar) { var tempText = this.text; var result = []; while(tempText.includes(answerChar)) { var foundIndex = tempText.indexOf(answerChar); result.push(foundIndex); tempText = tempText.replace(answerChar,"*"); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processChoice(key, answer, valid) {\n if (valid.indexOf(key) > -1) {\n validPicked.push(key);\n lettersPicked.push(key);\n lettersRemaining = (answerKey.length - validPicked.length) \n rebuildBoard(validPicked);\n } else {\n document.getElementById(\"lettersPicked\").textContent += \" \" ...
[ "0.7012983", "0.63013333", "0.62695575", "0.62284845", "0.62284845", "0.61676466", "0.61432225", "0.6088627", "0.6070105", "0.60391235", "0.6024035", "0.60220677", "0.60207564", "0.60188234", "0.59986264", "0.5997301", "0.59849507", "0.59667146", "0.5956831", "0.5934647", "0....
0.0
-1
var score = currentWord. display score
function displayFail() { if (fail > 1) { document.getElementById('score').textContent = fail; } else if (fail === 1) { var scoreBoardEle = document.getElementById('score-display'); while(scoreBoardEle.firstChild) { scoreBoardEle.removeChild(scoreBoardEle.firstChild); } var warnEle = document.createElement('span') var warnText = document.createTextNode("Be careful! You only have 1 try left") warnEle.appendChild(warnText) scoreBoardEle.appendChild(warnEle); } else if (fail === 0) { state = 1; var scoreBoardEle = document.getElementById('score-display'); while(scoreBoardEle.firstChild) { scoreBoardEle.removeChild(scoreBoardEle.firstChild); } var warnEle = document.createElement('span') var warnText = document.createTextNode("You have lost! ") warnEle.appendChild(warnText) scoreBoardEle.appendChild(warnEle); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrabbleScore() {\n console.log(`Currently using : ${scoringAlgorithms[2].name}`);\n\tconsole.log(`The score for your word, ${userWord}, is ${oldScrabbleScoreTotal(userWord)}!`);\n}", "function simpleScore() {\n return simpleScrabbleScorer(userWord);\n}", "function yourScore() {\n return fname + ...
[ "0.76759154", "0.7562457", "0.741675", "0.733921", "0.7164103", "0.71154153", "0.7046352", "0.7038931", "0.7019699", "0.7007606", "0.6973773", "0.69712704", "0.6969135", "0.6957746", "0.69251734", "0.69147706", "0.69136447", "0.68994874", "0.68867", "0.6885498", "0.68832546",...
0.0
-1
function to dynamically display the question on board
function displayWord(wordAnswerInst) { var questionEl = document.getElementById("question"); questionEl.textContent = wordAnswerInst.question; console.log("hello"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayQuestion() {\n\t\t\tstartTime30();\t\n\t\t\t$(\"#question\").html(eachone[count].question);\n\t\t\t$(\"#option1\").html(eachone[count].option1.answer);\n\t\t\t$(\"#option2\").html(eachone[count].option2.answer);\n\t\t\t$(\"#option3\").html(eachone[count].option3.answer);\n\t\t\t$(\"#option4\").html...
[ "0.76573485", "0.762619", "0.7450181", "0.7448028", "0.7436253", "0.742672", "0.73986614", "0.7368413", "0.7367368", "0.7367368", "0.73631614", "0.7351798", "0.73508483", "0.7331302", "0.7330321", "0.7315764", "0.7308022", "0.72923887", "0.7292088", "0.728525", "0.72816867", ...
0.0
-1
function to add character box on board
function displayBox(wordAnswerInst) { var answer = wordAnswerInst.text.split(''); console.log(answer); for (i=0;i<answer.length;i++) { var boxSpan = document.createElement('span'); var textInBox = document.createTextNode("_"); boxSpan.appendChild(textInBox); boxSpan.className = "h1"; boxSpan.setAttribute("id","box-text-"+i) var boxWrap = document.createElement('div'); boxWrap.style.height="70px"; boxWrap.style.width="70px"; boxWrap.className = "border bd-dark bg-white mx-3 d-flex justify-content-center align-middle "; boxWrap.appendChild(boxSpan); document.getElementById("answer-display").appendChild(boxWrap); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBoxes()\r\n{\r\n for(var i=0;i<word.length;i++)\r\n {\r\n var box=document.createElement(\"div\");\r\n var text=document.createTextNode(\"_\");\r\n box.classList.add(\"letter\");\r\n box.appendChild(text);\r\n wordDiv.appendChild(box);\r\n }\r\n}", "functi...
[ "0.6886482", "0.66848356", "0.6679635", "0.6599066", "0.65682465", "0.6531686", "0.6527432", "0.643013", "0.6408846", "0.6386122", "0.6307393", "0.63026726", "0.62909484", "0.62809265", "0.6268311", "0.62595916", "0.6258533", "0.6212745", "0.6212403", "0.6182016", "0.6146454"...
0.0
-1
aborts the execution with the specified error message
function abort(message) { util.error(message); process.exit(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abort() {\n }", "abort () {\n // ...\n }", "function abort(what) {\n if (Module['onAbort']) {\n Module['onAbort'](what);\n }\n\n what += '';\n out(what);\n err(what);\n\n ABORT = true;\n EXITSTATUS = 1;\n\n var output = 'abort(' + what + ') at ' + stackTrace();\n what = output;\n\n // T...
[ "0.73568654", "0.7273281", "0.66536456", "0.6487658", "0.64087343", "0.64084333", "0.64084333", "0.6369309", "0.6358718", "0.63555205", "0.6352029", "0.6352029", "0.6335197", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655", "0.6332655...
0.7767521
0
Trim 'node' and the script path.
function isOption(arg) { return (/^-/).test(arg); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "truncatePath(path) {\n\n // remove the project root\n if (path.startsWith(rootPath)) path = path.substr(rootPath.length+1);\n else if (path.startsWith(`file://${rootPath}`)) path = path.substr(rootPath.length+1+7);\n\n // check for node modules, remove that\n const index = path.l...
[ "0.588619", "0.57783306", "0.56163", "0.54969263", "0.54607624", "0.5459142", "0.5407623", "0.5398286", "0.5270211", "0.5252921", "0.5211208", "0.5211208", "0.52044696", "0.52044696", "0.5201744", "0.5201468", "0.5201468", "0.51980233", "0.5159523", "0.51580805", "0.515029", ...
0.0
-1
gets the extension of the specified filename
function getExtension(filename) { var i = filename.lastIndexOf('.'); return (i < 0) ? '' : filename.substr(i); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getExtension(filename){\n\treturn splitFromBack(filename, '.')[1];\n}", "function getExtension(filename) {\n const dot = filename.lastIndexOf('.');\n if (dot === -1) return '';\n return filename.substring(dot + 1, filename.length);\n }", "function getExtension(filename){\n v...
[ "0.9158451", "0.9026896", "0.89727604", "0.8954833", "0.89212495", "0.8825532", "0.88243985", "0.8823371", "0.8802874", "0.8801707", "0.8776765", "0.8739993", "0.8719651", "0.8713896", "0.86786854", "0.8656118", "0.8630418", "0.8596909", "0.8511837", "0.8511035", "0.84860224"...
0.8868673
5
run a test over the specified file
function test(filename) { console.log(' + ' + filename); try { if (options.ast) { return engines[4].run( filename , PHP ); } var extension = getExtension(filename); for(var i = 0; i<engines.length; i++) { if (engines[i].handles(filename, extension)) { if (engines[i].explode) { return engines[i].run( fs.readFileSync(filename).toString().split('\r\n') , filename , PHP ); } else { return engines[i].run(filename, PHP); } } } console.info('\n(i) IGNORED : unrecognized extension "'+getExtension(filename)+'" for ' + filename); return false; } catch(e) { util.error( (e.stack || e) + '\n' ); throw e; return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function runFile(test) {\n // load a test module from a file and pass in pep API as scope\n let file = Components.classes['@mozilla.org/file/local;1']\n .createInstance(Components.interfaces.nsILocalFile);\n file.initWithPath(test.path);\n let uri = gIOS.newFileURI(file).spec;\n \n // i...
[ "0.72810954", "0.70838", "0.6641919", "0.64004225", "0.63283724", "0.630544", "0.62578845", "0.61539394", "0.6091329", "0.5996837", "0.59594077", "0.59332865", "0.5927237", "0.59154767", "0.58949983", "0.5880468", "0.584527", "0.5790941", "0.57533413", "0.57286286", "0.565921...
0.5993082
10
This decodes the token so that we know the User Id
getUser() { return decode(this.getToken()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function decodeToken(token) {\n if (!token) {\n console.log(\"lol no token\");\n return;\n }\n \n const decodedToken = jwt_decode(token);\n \n const decodedUserId = decodedToken.userID;\n \n return decodedUserId;\n }", "getUser() {\n ret...
[ "0.79541045", "0.708371", "0.6994144", "0.695721", "0.67048854", "0.6647926", "0.65618944", "0.6538909", "0.648522", "0.642219", "0.64048713", "0.63971895", "0.63661623", "0.6244745", "0.623192", "0.6223631", "0.6220334", "0.6219588", "0.6217413", "0.6196416", "0.61935705", ...
0.6945972
4
Checks if we are login if there is a token in our local storage
loggedIn() { const token = this.getToken(); console.log("token:",token) return !(token == undefined); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isLogin() {\n if (localStorage.getItem('token')) {\n hasToken()\n }\n else {\n noToken()\n }\n}", "function checkAuth() {\n if (localStorage.access_token) {\n afterLogin();\n } else {\n loginMenu();\n }\n}", "function isLoggedIn() {\n\n return !!localStorage.getItem('token');\n ...
[ "0.8702405", "0.7859341", "0.78513086", "0.77677006", "0.7663741", "0.76546997", "0.76365036", "0.7571831", "0.75487036", "0.7541886", "0.75232697", "0.75077194", "0.75023484", "0.7475239", "0.7453794", "0.7453794", "0.74311674", "0.7422961", "0.73715734", "0.73389304", "0.73...
0.76438695
6
properties : data members constructor delecration with properties initalization
constructor(firstName,lastName,age,gender) { this.firstName = firstName; this.lastName = lastName; this.gender = gender; this.age = age; this.showData = function () { console.log("Hello , "+this.firstName +" "+ this.lastName); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(data = {}) {\r\n //super(data);\r\n for (const prop in data) {\r\n this[prop] = data[prop];\r\n }\r\n }", "constructor(data = {}) {\n //super(data);\n for (const prop in data) {\n this[prop] = data[prop];\n }\n }", "construct...
[ "0.73879063", "0.736205", "0.7156407", "0.70146096", "0.6884535", "0.67686105", "0.67516774", "0.6685522", "0.6611033", "0.6611033", "0.65074795", "0.65044653", "0.64681613", "0.64402443", "0.6401385", "0.6401385", "0.63734305", "0.6346693", "0.6298682", "0.6292652", "0.62889...
0.0
-1
methods : logic : memmber function
calcRetirement(){ if(this.age > 40) { return "You are retired !"; } return `You have ${40-this.age} more year to get retired !` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function miFuncion (){}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function Maisons(){\n \n }", "setFromMorph(morph) {\n//-----------\nthis.fourCCName = morph.getName();\nreturn this.amount = morph.getAmount();\n}", "function M(){}", "function MedFesEst...
[ "0.6202076", "0.60231537", "0.60231537", "0.60231537", "0.59536076", "0.5819242", "0.5804346", "0.5794958", "0.57574004", "0.57516783", "0.5648584", "0.5604006", "0.5466584", "0.545641", "0.542945", "0.5392069", "0.5356951", "0.53494775", "0.5308275", "0.5287893", "0.5283137"...
0.0
-1
es6 > getter & setter as properties
get _firstName(){ return this.firstName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(getter, setter) {\n this.getter = getter;\n this.setter = setter;\n }", "set(property, value) {\n return this[property] = value;\n }", "set property(){}", "static set property(){}", "get property(){}", "function defineProperty(target, name, getter, setter) {\n Object.definePrope...
[ "0.7231414", "0.70543134", "0.69122034", "0.69067824", "0.6903218", "0.6714992", "0.66771936", "0.661053", "0.66104156", "0.6568653", "0.65545654", "0.64884233", "0.6465203", "0.6459076", "0.64574397", "0.6427598", "0.64198065", "0.6404411", "0.6347456", "0.6331573", "0.62980...
0.0
-1
add handler function for 'share'
render() { const { id, title, label } = this.props; return ( <div className='Activity'> <h2 className='Activity__title'> <Link to={`/activity/${id}`}> {title} </Link> </h2> <article className='Activity__body group-row'> <div className='Activity__details item-triple'> <p className='Activity__label'> Label: {label} </p> </div> <div className='Activity__actions item group-column'> <button className='Activity__delete item' type='button' onClick={this.handleClickDelete} > {' '} Remove </button> </div> </article> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function facebookShare() {\n var s=s_gi(s_account);\n s.eVar2='fShare';\n s.events='event12';\n s.trackExternalLinks = false;\n s.linkTrackVars='eVar2,events';\n s.linkTrackEvents='event12';\n s.tl(this,'o','fShare');\n}", "sharePost() {\n this._qs(\"#share-post\").addEventListener(\"clic...
[ "0.68397206", "0.66849166", "0.6583566", "0.6463173", "0.644539", "0.64029604", "0.63970745", "0.63856465", "0.63848144", "0.6310953", "0.63060176", "0.6295506", "0.62695825", "0.6268571", "0.62677747", "0.6251741", "0.6233815", "0.6231797", "0.62148815", "0.6174795", "0.6136...
0.0
-1
Operate in Strict mode such that variables must be declared before used!
function ArmSegment(shader, name, xPivot, yPivot) { SceneNode.call(this, shader, name, true); // calling super class constructor var xf = this.getXform(); xf.setPosition(xPivot, yPivot); // now create the children shapes var obj = new CircleRenderable(shader); // The purple circle base this.addToSet(obj); obj.setColor([0.75, 0.5, 1, 1]); xf = obj.getXform(); xf.setSize(1, 2); // xf.setPosition(xPivot, 1 + yPivot); xf.setPosition(0, 0); obj = new SquareRenderable(shader); // The right green this.addToSet(obj); obj.setColor([0, 1, 0, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot, 1.75 + yPivot); xf.setPosition(0.375, 0); obj = new SquareRenderable(shader); // The left green this.addToSet(obj); obj.setColor([0, 1, 0, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot, 1.75 + yPivot); xf.setPosition(-0.375, 0); obj = new SquareRenderable(shader); // The top green this.addToSet(obj); obj.setColor([0, 0.85, 0.15, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot+0.5-0.125, yPivot+0.125); xf.setPosition(0, 0.375); obj = new SquareRenderable(shader); // The bottom green this.addToSet(obj); obj.setColor([0, 0.85, 0.15, 1]); xf = obj.getXform(); xf.setSize(0.25, 0.25); // so that we can see the connecting point // xf.setPosition(xPivot-0.5+0.125, yPivot+0.125); xf.setPosition(0, -0.375); obj = new CircleRenderable(shader); // The middle red circle this.addToSet(obj); obj.setColor([1, 0.75, 1, 1]); xf = obj.getXform(); xf.setSize(0.5, 0.5); // so that we can see the connecting point xf.setPosition(0, 0); this.mPulseRate = 0.005; this.mRotateRate = -2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forgettingDeclaringVariablesBeforeUseingDeclaresThemOnTheGlobalObject(){\n i = 1;//ReferenceError in strict mode.\n}", "function nonStrictMode() {\n let x = 34;\n\n //..\n 'use strict';\n //..\n }", "function strictly() {\n 'use strict';\n\n}", "function bar() {\n // this code is also ...
[ "0.7439366", "0.72830224", "0.67325795", "0.6653799", "0.66243833", "0.65988535", "0.6545069", "0.6464953", "0.64430505", "0.6431269", "0.62640107", "0.6212427", "0.6212427", "0.6107064", "0.60788345", "0.607138", "0.60205173", "0.60132337", "0.60086274", "0.5973908", "0.5961...
0.0
-1
Nothing more, Nothing less. ONLY that EXACT amount. Write a function that will return all the combinations of items that you can get with that exact amount. youre given a number as a total variable and have access to the menu with the name and price. you can arrange the given information in any data structure you'd like to access it return all the total possible combinations in an array items: Fruit Fries Salad Wings Stick Plate prices: 2.15 2.75 3.35 3.55 4.20 5.80 ex. total = 4.30 return ["Fruit, Fruit"]
function appetize(total){ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPrices(){\n\n\t\t//cost of shop items\n\t\tprice1=75.00; price2=116; price3=44; price4=5.25; price5=3.75; price6=12.75; price7=4.10;\n\n\t\t//ammount of items chosen\n\t\titem_1=0; item2=0; item3=0; item4=0; item5=0; item6=0; item6=0; item7=0;\n\n\t\t//sub-total for each item\n\t\tsubTot_1 = 0; subTot_...
[ "0.6401013", "0.63365066", "0.6183652", "0.6176914", "0.6049594", "0.5983058", "0.5919147", "0.5919147", "0.5919147", "0.5919147", "0.5868054", "0.58497393", "0.58272326", "0.57852566", "0.57798654", "0.577321", "0.5754901", "0.5754901", "0.5754901", "0.5754901", "0.5754901",...
0.0
-1
align modifiers like time signature for vertical staves with different key signatures / time signature xs This method should be static, but that makes using it with `any` usage more difficult.
formatBegModifiers(staves) { let maxX = 0; // align note start staves.forEach((stave) => { if (stave.getNoteStartX() > maxX) maxX = stave.getNoteStartX(); }); staves.forEach((stave) => { stave.setNoteStartX(maxX); }); maxX = 0; // align REPEAT_BEGIN staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getType() == Barline.type.REPEAT_BEGIN) if (modifier.getX() > maxX) maxX = modifier.getX(); }); }); staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, Barline.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getType() == Barline.type.REPEAT_BEGIN) modifier.setX(maxX); }); }); maxX = 0; // Align time signatures staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY); modifiers.forEach((modifier) => { if (modifier.getX() > maxX) maxX = modifier.getX(); }); }); staves.forEach((stave) => { const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, TimeSignature.CATEGORY); modifiers.forEach((modifier) => { modifier.setX(maxX); }); }); // Align key signatures // staves.forEach((stave) => { // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY); // modifiers.forEach((modifier) => { // if (modifier.getX() > maxX) maxX = modifier.getX(); // }); // }); // staves.forEach((stave) => { // const modifiers = stave.getModifiers(StaveModifier.Position.BEGIN, KeySignature.CATEGORY); // modifiers.forEach((modifier) => { // modifier.setX(maxX); // }); // }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set alignment(value) {}", "get alignment() {}", "function parseAlign(alignSpec) {\n const parts = alignSpecRe.exec(alignSpec),\n myOffset = parseInt(parts[2] || 50),\n targetOffset = parseInt(parts[4] || 50); // Comments assume the Menu's alignSpec of l0-r0 is used.\n\n return {\n myAlignmen...
[ "0.58732045", "0.53072876", "0.51479733", "0.5048906", "0.5013621", "0.49928164", "0.49863285", "0.4961542", "0.49455246", "0.49009168", "0.48984364", "0.48505536", "0.4820889", "0.48134044", "0.47912028", "0.47906253", "0.47906253", "0.47906253", "0.47906253", "0.47906253", ...
0.68977565
0
Coda & Segno Symbol functions
setRepetitionTypeLeft(type, y) { this.modifiers.push(new Repetition(type, this.x, y)); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Symbol() {\n}", "function SimpleSymbols(str) { \n}", "function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; }", "function Symbol(alph_index, scale, alphabet) {\n //variable prototype\n this.symbol = alphabet.get_letter(alph_index);\n this.scale = scale;\n this.colour = alphabet.g...
[ "0.6914385", "0.66739875", "0.65223515", "0.6520163", "0.64238113", "0.637195", "0.63079673", "0.6276075", "0.6205184", "0.6166091", "0.5978645", "0.5918355", "0.5857415", "0.585101", "0.5819994", "0.5801621", "0.57970124", "0.57946384", "0.5787929", "0.5775692", "0.57667786"...
0.0
-1
This returns the y for the center of a staff line
getYForLine(line) { const options = this.options; const spacing = options.spacing_between_lines_px; const headroom = options.space_above_staff_ln; const y = this.y + (line * spacing) + (headroom * spacing); return y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_line_y(c) {\n\treturn 94 + c * 75;\n}", "function getCenterY()/*:Number*/ {\n return this.getUpperY() + this.getMyHeight() / 2;\n }", "function get_point_y(c) {\n\treturn 94 + c * 75;\n}", "function getOriginY() {\n\t\treturn Math.min(this.originY, this.finalY);\n\t}", "function d4_svg_lin...
[ "0.73848116", "0.72168785", "0.700793", "0.6577882", "0.6486009", "0.6479815", "0.6423857", "0.6405464", "0.6405464", "0.6405464", "0.63861865", "0.63235414", "0.63163394", "0.6313648", "0.62426716", "0.6235886", "0.62303513", "0.62129", "0.6207007", "0.6193924", "0.61735964"...
0.7668172
0
This method adds a stave modifier to the stave. Note that the first two modifiers (BarLines) are automatically added upon construction.
addModifier(modifier, position) { if (position !== undefined) { modifier.setPosition(position); } modifier.setStave(this); this.formatted = false; this.modifiers.push(modifier); return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setStave(stave) {\n const line = this.getLine();\n\n this.stave = stave;\n this.setY(stave.getYForNote(line));\n this.context = this.stave.context;\n return this;\n }", "formatBegModifiers(staves) {\n let maxX = 0;\n // align note start\n staves.forEach((stave) => {\n if (stave.getN...
[ "0.68293375", "0.67875737", "0.6204283", "0.57987946", "0.5123566", "0.50214446", "0.49740985", "0.49626213", "0.49213332", "0.49162588", "0.49009582", "0.48623002", "0.4857693", "0.48015428", "0.4789123", "0.47206426", "0.46857688", "0.4668362", "0.4666836", "0.46518686", "0...
0.49203157
9
All drawing functions below need the context to be set.
draw() { this.checkContext(); this.setRendered(); if (!this.formatted) this.format(); const num_lines = this.options.num_lines; const width = this.width; const x = this.x; let y; // Render lines for (let line = 0; line < num_lines; line++) { y = this.getYForLine(line); this.applyStyle(); if (this.options.line_config[line].visible) { this.context.beginPath(); this.context.moveTo(x, y); this.context.lineTo(x + width, y); this.context.stroke(); } this.restoreStyle(); } // Draw the modifiers (bar lines, coda, segno, repeat brackets, etc.) for (let i = 0; i < this.modifiers.length; i++) { // Only draw modifier if it has a draw function if (typeof this.modifiers[i].draw === 'function') { this.modifiers[i].applyStyle(this.context); this.modifiers[i].draw(this, this.getModifierXShift(i)); this.modifiers[i].restoreStyle(this.context); } } // Render measure numbers if (this.measure > 0) { this.context.save(); this.context.setFont(this.font.family, this.font.size, this.font.weight); const text_width = this.context.measureText('' + this.measure).width; y = this.getYForTopText(0) + 3; this.context.fillText('' + this.measure, this.x - text_width / 2, y); this.context.restore(); } return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "draw(context) {\n //TO-DO\n }", "draw(context){\n context.fillStyle = this.color;\n context.globalAlpha = 0.3;\n context.fillRect(this.x,this.y,this.width,this.height);\n\n if(this.selected){\n context.strokeStyle = '#CC0000';\n context.lineWidth = 2;\n...
[ "0.8246711", "0.7399165", "0.71979636", "0.71395373", "0.7087667", "0.7036976", "0.7030962", "0.6951352", "0.6930964", "0.6918537", "0.6918537", "0.6918537", "0.6918537", "0.68930364", "0.68846", "0.6862648", "0.6862026", "0.6833648", "0.6831657", "0.6820405", "0.6820405", ...
0.0
-1
Draw Simple barlines for backward compatability Do not delete draws the beginning bar of the stave
drawVertical(x, isDouble) { this.drawVerticalFixed(this.x + x, isDouble); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBarVis(type) {\r\n const BINS = canvas.width / 3;\r\n const BAR_WIDTH = canvas.width / BINS;\r\n const HALF_CANVAS_HEIGHT = canvas.height / 2;\r\n\r\n let x_coord = 0;\r\n\r\n // Draw bars\r\n for (var i = 0; i < BINS; i++) {\r\n let barLength = Mat...
[ "0.64597493", "0.6372491", "0.6320486", "0.6312355", "0.63011384", "0.6283512", "0.6268852", "0.62001646", "0.6173345", "0.6172641", "0.61577135", "0.6131841", "0.6113987", "0.60873556", "0.6084845", "0.60604733", "0.60337156", "0.6032944", "0.5973234", "0.5948438", "0.594559...
0.0
-1
Create a new transaction
function saveTransactionAsync(transaction) { return transaction.save(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createTransaction(companyName, companyId, invoiceNum, vendorId, total, sheetId) {\n\tdb.Transaction.create({\n\t\tcompanyName: companyName,\n\t\tcompanyId: companyId,\n\t\tinvoiceNumber: invoiceNum,\n\t\tvendorId: vendorId,\n\t\ttotal: total,\n\t\tSheetId: sheetId\n\t}).then(function(result) {\n\t\tconsol...
[ "0.77916604", "0.77828574", "0.7620501", "0.74126035", "0.72822857", "0.701867", "0.68479973", "0.68366176", "0.6836187", "0.68292737", "0.6665209", "0.65262556", "0.64872", "0.6461477", "0.6415897", "0.6381472", "0.63809055", "0.6379248", "0.6365055", "0.6344089", "0.6339521...
0.0
-1
get transaction by id
async function getTransactionByIdAsync(_id) { return TransactionModel.findById(_id).populate('customer').exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getTransaction(id)\n {\n if (typeof(id) == \"object\")\n id = id.id\n\n return this.transactions.find(x => x.id == id) || null\n }", "function findById(id) {\n return db('transactions').where({ id }).first()\n}", "static async getTransactionById(req, res) {\n try {\n c...
[ "0.8405136", "0.75180894", "0.74384165", "0.72922325", "0.72678393", "0.7149744", "0.7147425", "0.6840716", "0.662878", "0.6530607", "0.6415989", "0.63990885", "0.6379487", "0.630685", "0.6306483", "0.6282821", "0.627833", "0.6261638", "0.6199537", "0.6188094", "0.6166831", ...
0.6903615
7
delete transaction by id
function deleteTransactionById(_id) { return TransactionModel.deleteOne({ _id }).exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteTransaction(id) {\n transaction.deleteTransaction(id)\n .then(res => loadTransactions())\n .catch(err => console.log(err));\n }", "function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}", "function deleteTran...
[ "0.87048256", "0.83477056", "0.8138373", "0.8123875", "0.8030812", "0.79025096", "0.789536", "0.77007", "0.7653753", "0.73849493", "0.7232468", "0.722017", "0.70500445", "0.704107", "0.6940432", "0.6928991", "0.6897247", "0.67960155", "0.67626005", "0.6711767", "0.6695826", ...
0.8468602
1
delete all transaction that relate to customer by customer id
function deleteAllTransactionsByCustomerId(customer_id) { return TransactionModel.deleteMany({ customer_id }).exec(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteTransaction(id) {\n transactions = transactions.filter( transaction => transaction.id != id );\n init();\n}", "async function clearCustomers() {\n try {\n const { result : { customers } } = await customersApi.listCustomers();\n if (customers) {\n for (const key in customers) {\n ...
[ "0.6873459", "0.66026664", "0.65450925", "0.6539166", "0.64093316", "0.63606864", "0.6349919", "0.62439823", "0.6242813", "0.6217943", "0.62073547", "0.6166351", "0.6119943", "0.60789025", "0.602603", "0.6015245", "0.5917384", "0.58527005", "0.5841049", "0.5835707", "0.581489...
0.8589326
0
Create a new canvas to the browser size
function setup() { createCanvas(windowWidth, windowHeight); // Clear with black on setup background(0); // Make the volume quieter Tone.Master.volume.value = volume; // Setup a synth with ToneJS synth = new Tone.Synth({ oscillator: { type: "sine", }, }); // Wire up our nodes: // synth->master synth.connect(Tone.Master); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createCanvas() {\n this.canvas = document.createElement('canvas');\n this.canvas.width = this.width * this.resolution;\n this.canvas.height = this.height * this.resolution;\n this.context = this.canvas.getContext('2d');\n }", "create(width, height) {\n document.body.appendChild(this.canvas);\n ...
[ "0.77052224", "0.7663082", "0.7487349", "0.7481034", "0.74640995", "0.7317779", "0.7315109", "0.72425556", "0.7183717", "0.71820194", "0.7173591", "0.71403533", "0.7131482", "0.7090071", "0.7030521", "0.701344", "0.70129985", "0.69937015", "0.6988763", "0.6976152", "0.6951747...
0.0
-1
On window resize, update the canvas size
function windowResized() { resizeCanvas(windowWidth, windowHeight); // Clear with black on resize background(0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windowResized() {\n resizeCanvas(canvasX, canvasY);\n}", "function windowResized() {\n resizeCanvas(canvasWidth, canvasHeight);\n}", "function windowResized() {\n resizeCanvas(width, height);\n}", "function windowResized() {\n resizeCanvas(innerWidth, innerHeight);\n}", "function windowResiz...
[ "0.84558463", "0.8454732", "0.84449136", "0.84412926", "0.84224933", "0.84224933", "0.8406103", "0.83992654", "0.83992654", "0.83965033", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.8378125", "0.83781...
0.0
-1
Render loop that draws shapes with p5
function draw() { const dim = Math.min(width, height); // Instead of drawing black, we draw with // transparent black to give a 'ghosting' effect const opacity = 0.085; background(0, 0, 0, opacity * 255); // If we have a mouse position, draw it if (mouse) { noFill(); stroke(255); strokeWeight(dim * 0.01); circle(mouse[0], mouse[1], dim * 0.2); // Clear position so we stop drawing it, // this will make it fade away mouse = null; } // Draw a 'play' button noStroke(); fill(255); polygon(width / 2, height / 2, dim * 0.1, 3); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\n stroke(this.layerColor)\n strokeWeight(this.randomWeight)\n noFill()\n push()\n translate(width / 2, height / 2)\n for (let i = 0; i <= this.numShapes; i++) {\n ellipse(this.position, 0, this.shapeSize, this.shapeSize)\n rotate(this.ang...
[ "0.77065647", "0.7554695", "0.7400974", "0.7222684", "0.7175581", "0.71698993", "0.71154195", "0.71147346", "0.71019745", "0.70888376", "0.70879453", "0.7056376", "0.700674", "0.7000129", "0.69764084", "0.69714475", "0.6967267", "0.6953379", "0.6935261", "0.6917497", "0.69103...
0.0
-1