query
stringlengths
9
34k
document
stringlengths
8
5.39M
negatives
listlengths
19
20
metadata
dict
Renders the AWS CloudFormation properties of an `AWS::WAFv2::WebACL.Cookies` resource
function cfnWebACLCookiesPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnWebACL_CookiesPropertyValidator(properties).assertSuccess(); return { MatchPattern: cfnWebACLCookieMatchPatternPropertyToCloudFormation(properties.matchPattern), ...
[ "function cfnDistributionCookiesPropertyToCloudFormation(properties) {\n if (!cdk.canInspect(properties)) {\n return properties;\n }\n CfnDistribution_CookiesPropertyValidator(properties).assertSuccess();\n return {\n Forward: cdk.stringToCloudFormation(properties.forward),\n Whitel...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Ascends upwards by 1 floor level
goUp() { this.setFloor(this.getFloor() + 1); }
[ "function floorUp() {\n\tif (currentFloor == 5) {\n\t\tcurrentFloor = 5;\n\t} else {\n\t\tcurrentFloor++;\n\t}\n\tcheckFloor();\n}", "floorDown() {\n if (this.floor >= 0) {\n this.floor--;\n }\n }", "moveUp() {\n this.currentFloor += 1;\n }", "function upStairs() {\n\tif(currentFloor < m...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks if any field not available is passed in the options fields array.
validateFieldOptions() { this.options.fields.forEach((f) => { let name = f; if (typeof f === 'object') { name = f.name; } if (this.availableFields.indexOf(name) === -1) { throw new Error(`Field ${name} not available. Make sure the fields array item has\ a string or ...
[ "function missingFields(fields){\n let isMissing = false\n fields.forEach(field => {\n if(!field){\n isMissing = true\n }\n })\n return isMissing\n }", "function isMissingField(obj, fields) {\n var missing = [];\n for(var k in fields) {\n if(fields[k] === 'instanceId' && obj.isA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
document.getElementById("href_next").href=""; dialogWindowFrame.document.getElementById("href_next").removeAttribute("href"); document.getElementById("href_last").href=""; dialogWindowFrame.document.getElementById("href_last").removeAttribute("href"); dialogWindowFrame.document.getElementById("F1").src = top.static_res...
$('#F2').removeClass("navItem"); $('#F2').removeAttr("onclick"); $('#F2').css("filter", "opacity(50%)"); } if (pagecounter == 1) { //document.getElementById("href_first").href="#"; //dialogWindowFrame.document.getElementById("href_first").removeAttribute("href"); ...
[ "function changeImage(action,_this){\r\n\tif(action == 1){\r\n\t\t$(_this).attr(\"src\",\"/tabs_lib/images/close.png\");\r\n\t\t$(_this).css({'width':'17x','height':'16px'});\r\n\t}\r\n\tif(action == 2){\r\n\t\t$(_this).attr(\"src\",\"/tabs_lib/images/disable-close.png\");\r\n\t}\r\n}", "function disableButtonson...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
fonction pour trier la colonne selectione
function trierColonne(colonne) { if(!tabIsEmpty){ var tabTrier = tableauColonneTrier(colonne); var selectColonne; switch (colonne){ case "activity": selectColonne = $("tbody td:nth-child(2)"); tabTrier.forEach(fun...
[ "function verificaColonia() {\n\tconsole.log('verificaColonia');\n\t\n\tcali= lstCol.value\n\tconsole.log('cali: ' + cali);\n\t\n\tvar cpO= cali.substr(cali.length - 5);\n\tconsole.log('cpO: ' + cpO);\n\n\tif (arrVals.indexOf(lstCol.value) !=(-1))\n\t{\n\t\tconsole.log('pasa verificación valor lstCol');\n\t\tmuestr...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
1 = cant be planted 0 = can not be planted return true if n number of flowers can be planted return false if not flowers can only be planted in 0s with 0s adjacent on both sides
function checkFlowerbed(flowerbed, num) { let flowerCounter = 0; for (let i = 0; i < flowerbed.length; i++) { if ((flowerbed[i] === 0) && (i === 0 || flowerbed[i-1] === 0) && (i === flowerbed.length - 1 || flowerbed[i+1] === 0)) { flowerCounter++; flowerbed[i] = 1; } ...
[ "function canPlant(garden, count) {\n let plantableSlots = 0;\n\n for (let i = 0; i < garden.length; i++) {\n if (!garden[i - 1] && !garden[i] && !garden[i + 1]) {\n plantableSlots++;\n i++;\n\n if (plantableSlots >= count) return true;\n }\n }\n\n return f...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use random base to prevent users hard code depending on this auto generated marker id.
function getRandomIdBase() { return Math.round(Math.random() * 9); }
[ "function _getRandomIdBase() {\n return Math.round(Math.random() * 9);\n }", "function newId() {\n return Math.floor((Math.random() * 900000) + 100000);\n }", "genId() {\n return \"id\" + (Math.random()+\"\").substring(2);\n }", "function createId(){\n return Mat...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Initializes the comm channel to the back end. Stores the generated channel in this.comm. Returns a Promise that should resolve when the channel's ready. But the nature of setting these up means that a nested Promise gets made by the Jupyter kernel frontend and not necessarily returned. Thus, it uses a semaphore lock. W...
initCommChannel() { const _this = this; _this.comm = null; const commSemaphore = Semaphore.make(); commSemaphore.add('comm', false); return new Promise((resolve) => { // First we check to see if our comm channel already // exist...
[ "async _initChannel() {\n if (this.channel) {\n return;\n }\n const conn = await this._getConnection();\n const ch = await conn.createChannel();\n this._channel = ch;\n }", "function initWorker() {\n if (typeof workerPromise === 'undefined') {\n workerPro...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
JSON de cliente Juridico
function clienteJuridicoToJSON() { var ol = JSON.stringify({ "customerIF": "999", "nombre": "POLICE", "direccion": "casa azul", "telCasa": "2290", "telOficina": "311221", "celular": "343324", "cedulaJuridica": "192211" }); alert(ol); return ol; }
[ "function clienteFisicoToJSON() {\n var ol = JSON.stringify({\n \"@type\":\"cuentaahorroautomatico\",\n \"isNULL\":false,\n \"cuenta\":\n { \"cliente\":{\n \"customerIF\":1234,\n },\n \"estadoCuenta\":true,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Send email via emailJS
function SendEmail() { emailjs .send('gmailAdmin', 'template_3WsqlJYJ', { from_name: document.getElementById('name').value, message_html: document.getElementById('message').value, from_email: document.getElementById('email').value, }) .then( //...
[ "sendEmail() {\n email([EMAIL], null, null, null, null);\n }", "function sendMail(testForm) {\n emailjs.send(\"gmail\", \"rosie\", {\n \"from_name\": testForm.name.value, //calls the \"from_name\" variable from emailJS template & assigns value of form name\n \"from_email\":...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset the Z80 to a known state.
reset() { this.regs = new z80_base_1.RegisterSet(); }
[ "reset() {\n this.setIrqMask(0);\n this.setNmiMask(0);\n this.resetCassette();\n this.keyboard.clearKeyboard();\n this.setTimerInterrupt(false);\n this.z80.reset();\n }", "function reset() {\r\n display.reset();\r\n for (var i = 0; i < 0x600; i++) { // clear ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
loop for fading in and out video controls and mouse during fullscreen
function fadeControls() { // initial loop to hide controls if no movement timer = setTimeout(function() { $vcontrols_container.fadeOut('slow'); $vplayer.css('cursor', 'none'); }, 3000); if ($video.attr('fs') == "true") { $overlay.mousemove(mouseMoveFn) $video.mousemove(mouseMoveFn) ...
[ "function player_fullscreen_mouse(event) {\n\tconst opacity = Math.min(Math.max((event.clientY / fullscreen_mouse_start - 1) / (fullscreen_mouse_end / fullscreen_mouse_start - 1), 0), 1);\n\tinterface.media.style[\"opacity\"] = opacity;\n}", "function videoFullScreen(e) {\n if (document.fullscreenEnabled |...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
DOING: 1.get rider id and delete the rider doc 2.based on rider id remove his posted ride also TODO: 1.Inform the user when admin removed the rider if rider post the ride that booked by user. NO of DB Delete:1 and more depend on no of ride posted
async function removeRiderById(req, res) { if (req.body.id) { let rider_id = req.body.id; let rider = await Rider.deleteOne({ _id: rider_id }); //remove ride also let ride = await Ride.deleteMany({ rider_id: rider_id }); if (rider) { res.json({ status: "success", ...
[ "async function removeRide(req, res) {\n if (req.body.id) {\n let ride_id = req.body.id;\n let ride = await Ride.deleteOne({\n _id: ride_id,\n });\n let booking = await Booking.deleteMany({\n ride_id: ride_id\n });\n //need to show rider if some thing bad for better use js in client sid...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
creat a constructor called song() with at least 5 property and 2 behavior and instantiate 3 times.
function song(name, duration, singer, writer, music){ this.name = name, this.duration = duration, this.singer = singer, this.writer = writer, this.music = music; start = function(){ console.log(this.name + "is sang by" + this.singer); } write = function(){ console.lo...
[ "function Song(){\n this.artist = artist,\n this.title = title,\n this.year = year\n}", "function Song(title,artist){\n this.title = title;\n this.artist = artist;\n}", "constructor(song, songAttributes) {\n // with fast JSON, attributes are nested\n this.id = song.id;\n this.title = s...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
This function receives an object, whose values will all be numbers, and returns the largest number in the object.
function max(object) { //create a variable for max value //loop through and look at values. If max value undefined or //if value of obj is bigger than max value update max value and return max value. //...spread syntax goes through each number and then returns the smallest number. // console.log(arrayOfvalues); cons...
[ "function max(object) {\n biggestNum = Object.values(object);\n return Math.max(...biggestNum);\n}", "function getMaximumValue(obj) {\n\n return Object.keys(obj).reduce(function (m, k) {\n\n return obj[k] > m ? obj[k] : m;\n }, -Infinity);\n}", "function max(object) {\n const values = Object.values(obje...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Accepts two cells and a string direction removes the wall in the diretion of the string by drawing over it
function destroyWall(cell1, cell2) { var canvas = document.getElementById("maze"); var context = canvas.getContext('2d'); cell1Center = {x:cell1.xPos+5, y:cell1.yPos+5}; cell2Center = {x : cell2.xPos+5, y:cell2.yPos+5}; context.beginPath; context.moveTo(cell1Center.x, cell1Center.y); context.lineTo(cell2Cente...
[ "writeAtCellRightToLeft(x, y, text) {\n for(var i=0;i<text.length;i++) {\n this.writeInCell(x-i, y, text.charAt(text.length - i - 1));\n }\n }", "changeDirection(newTarget, evt) {\n // console.log(newTarget, evt);\n const [changeDirection] = [ACROSS, DOWN].filter(dir => dir !== this.dire...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Parses a directory and returns content as array
function parseDirectory( path ) { return fs.readdirSync( path ) .map( function( file ) { var filePath = path + "/" + file; if ( isIncludeFile( filePath ) ) return parseFile( filePath ); else if ( isDirectory( filePath ) ) return...
[ "function getContent(dirpath) {\n let filesss = fs.readdirSync(dirpath);\n for (let i in filesss) {\n console.log(arr.push(i));\n }\n return filesss;\n}", "function walkContentDir() {\n\tlet paths = [];\n\n\treturn new Promise((resolve, reject) => {\n\t\tklaw(DIR.content)\n\t\t\t.on(\"data\", i => paths.pu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Push previous state id and container contents into the history cache. Should be called in conjunction with `pushState` to save the previous container contents. id State ID Number value DOM Element to cache Returns nothing.
function cachePush(id, value) { cacheMapping[id] = value cacheBackStack.push(id) // Remove all entries in forward history stack after pushing a new page. trimCacheStack(cacheForwardStack, 0) // Trim back history stack to max cache length. trimCacheStack(cacheBackStack, ...
[ "function cachePush(id, value) {\n cacheMapping[id] = value;\n cacheBackStack.push(id);\n\n // Remove all entries in forward history stack after pushing a new page.\n trimCacheStack(cacheForwardStack, 0);\n\n // Trim back history stack to max cache length.\n trimCacheStack(cacheBackStack, pjax.def...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
flatten course data forEach exam into itself and update _id to examId
function arrFlattenExam (exam) { let newExam = {...exam._doc}; //change exam._id to examId newExam.examId = newExam._id; delete newExam._id; //spread newExam and courseId to flatten course newExam = {...newExam, ...newExam.courseId._doc} //change cou...
[ "function reformatQuizData(courseData) {\r\n try {\r\n var quizzesData = courseData.map(quizzesData => {\r\n let transformedData = quizDataTransformer(quizzesData); // Uniformize Data\r\n return transformedData;\r\n });\r\n var questionsData = qu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get existing Delegated controller instance or initialize a new one
function getOrCreateDelegatedController(tag) { if (!Api.cache[tag]) { Api.cache[tag] = new ProxyDelegateController(tag, _Delegate) } return Api.cache[tag] }
[ "initializeController() {\n if (this.controller != null) return;\n this.controller = Controller.getInstance(this.multitonKey);\n }", "function controllerDecorator($delegate) {\n\t return function(expression, locals, later, ident) {\n\t if(later && typeof later === 'object') {\n\t var create = $del...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Loads all the sounds into SoundJs
function loadSound() { createjs.Sound.addEventListener("fileload", handleLoad); createjs.Sound.registerSounds(bgm); createjs.Sound.registerSounds(sfx); }
[ "async loadAll() {\n sounds.siren = new Howl({\n src: ['./sounds/siren.wav'],\n loop: true\n });\n\n sounds.powerSiren = new Howl({\n src: ['./sounds/power_pill.wav'],\n loop: true\n });\n\n sounds.gameStart = new Howl({\n src...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
/ Setup player 2.
function setupVideoPlayer2(){ new FWDEVPlayer({ //main settings useYoutube:"yes", useVimeo:"no", instanceName:"player2", parentId:"myDiv2", mainFolderPath:"content", skinPath:"hex_white", displayType:"responsive", autoScale:"yes", useHEXColorsForSkin:"yes", normalHEXButtonsColor:"#FF0000", se...
[ "_playerTwoInitiate () {\n this._choosenPlayer = 'Luigi'\n this._startGame()\n }", "function setupPlayer(playerid,playernumber)\n{\n if(!(playernumber==0 || playernumber>2))\n {\n if (playernumber == 1) {\n //alert('I am p1');\n me = player1;\n me.name='p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
whenever a key is pressed on the keyboard, draw a spider web centered on the current position of the mouse with a random size web each time
function keyPressed() { var size = random(0, width / 5); drawWeb(mouseX, mouseY, size); }
[ "function keyPressed() {\n x = random(100, 400);\n y = random(100, 400);\n size = random(0.1, 2);\n renderSpace();\n renderAstronaut(x, y, size);\n}", "function keyPressed() {\n\tvar size = random(0, width * 0.8);\n\tdrawNoodle(mouseX, mouseY, size);\n}", "function keyPressed() {\n var size = random(25,...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handles the silver tier
function silverHandler () { slowPage(silverTier); setTimeout(function() { dataCapper(silverTier); restrictAccess(silverRestrictedAccessList); }, 1); redirectHandler(silverRedirectList); censorHandler(silverTier); }
[ "function tierHandler (tier) {\n\n\tif (tier == platinumTier) {\n\t\tplatinumHandler();\n\t\treturn;\n\t}\n\n if (tier === silverTier) {\n silverHandler();\n } else if (tier == goldTier) {\n goldHandler();\n }\n\n}", "function goldHandler () {\n\tslowPage(goldTier);\n\n\tsetTimeout(function...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Generate junit xml report
static generateXMLReport(pathToJson, pathToXml) { const builder = new xml2js.Builder(); const jsonReport = require(path.resolve(pathToJson)); const xml = builder.buildObject(new JunitReport(jsonReport).build()); fs.writeFile(path.resolve(pathToXml), xml, (err) => { if (err...
[ "function report()\n\t{\n\t\tvar reportXml = TestRunner.getResults( YUITest.TestFormat.JUnitXML );\n\t\tif ( !reportXml )\n\t\t\treturn;\n\n\t\t!reportDir.exists() && reportDir.mkdir();\n\n\t\tvar useStamp = cmd.hasOption( 's' );\n\t\tvar stamp = new SimpleDateFormat('MM-dd-hh-mm-ss').format(new java.util.Date());\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Add in the range of years that can be selected for the annual line chart. The first year will range from the minimum year (1995) to the maximum year 1 (since there must be a minimum range of 2 years), and the last year will range from minimum + 1 (1996) to the maximum year, for the same reason. The ranges are added onl...
function addYearRangeOptions() { var min = minDate.getFullYear(); var max = maxDate.getFullYear(); var optionsStart = ""; var optionsEnd = ""; for (year = min; year <= max - 1; year++) { optionsStart += "<option>"+ year +"</option>"; } for (year = min + 1; year <= max; year++) { ...
[ "function incrementYearRange() {\n yearRangeMin += 12;\n yearRangeMax += 12;\n }", "generateYearRange() {\n const remainder = this.year % YEARS_TO_DISPLAY;\n const floor = this.year - remainder;\n const ceil = floor + YEARS_TO_DISPLAY;\n this.yearRange = this.generateRange(floor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
a helper function to the interpolation function idea is this: you have two PSI hob/ranges sets. one is lower than the other and is thus "outer" when graphed. the other is higher. outer_index is the index of a given point on "outer" PSI range. we imagine a line from that point to 0,0. now we want to find which two point...
function getInterpolatedPosition(inner_psi,outer_psi,outer_index) { var inner_index = 0; //we start from index zero (HOB = 0) and move "up." the choice of a starting index and the method of traversig the index could be optimized. while(linesIntersect( 0, 0, rngs[outer_psi][outer_index], ho...
[ "function findIntersection(){\n\n var flag1= false;\n var p1 = {x: 0, y: 0},\n p2 = {x: 0, y: 0},\n p3 = {x: 0, y: 0},\n p4 = {x: 0, y: 0};\n\n // intersection with x(0) or y axis. y should lie in y(2) to y(5.5) to fall inside\n p1.x = x(0);\n p1....
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Handler for global theme change event (triggered by shared.js). Remeasures row height.
onThemeChange({ theme }) { this.measureRowHeight(); this.trigger('theme', { theme }); }
[ "onThemeChange({\n theme\n }) {\n this.measureRowHeight();\n this.trigger('theme', {\n theme\n });\n }", "onColumnResized() {\r\n this.gridApi.resetRowHeights();\r\n }", "setRowsHeight() {\n const isNew = theme.currentTheme.id && (theme.currentTheme.id.indexOf('uplift') > -1 ||...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load users from the store and set them to the users variable.
loadUsers() { this.users = this.store.getValue('user-settings'); }
[ "loadUsers() {\n this.users = this.store.getValue('users');\n }", "function loadUsersData() {\n if (!getStorage(\"users\")) {\n setStorage(\"users\", data.users);\n } else {\n data.setUsers(getStorage(\"users\"));\n }\n}", "function loadUsers() {\n API.getUsers()\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
`v` is the Variable that these indices are meant to index. `ind` can be: single value, array, vector, logical variable, scalar variable (other variables turned scalar). Returns the indices as an array of the positions we are interested in, with `NaN`s in for any "missing" indices.
function normalizeIndices(v, ind) { var allNegOrZero, someNegatives; if (ind instanceof Variable && ind.mode() === 'logical') { if (!v.sameLength(ind)) { throw new Error('incompatible lengths'); } ind = ind.which(); // to scalar variable } ind = normalizeValue(Variable.oneD...
[ "function vecIndex(iv_expr, iv) {\n var args = [];\n for (var i = 0; i < vectorWidth; i++) {\n var expr = util.clone(iv_expr);\n args[i] = stepIndex(expr, iv, i);\n }\n return util.call(vectorConstructor, args);\n }", "function sc_vectorRef(v, pos) {\n\n\n r...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Adds a shape to the draw list. shapetype 0 = box 1 = sphere, artworkUrl is the texture url.
function addShape(shapeType, artworkUrl) { drawables.push(new drawable(shapeType, artworkUrl)); }
[ "addShape(shape) {\n this.shapes.push(shape);\n this.draw();\n }", "addShape(shape) {\n this.shapes.push(shape);\n }", "function addShape(s) {\n shapes.push(s);\n}", "add(shape) {\n shape.pane = shape.pane || this.defaultPane;\n // See if shape already has an index ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Merender node ke donelistcontainer
function renderDoneHtmlNode(node) { const doneListContainer = document.getElementById("done-list-container") doneListContainer.appendChild(node) }
[ "function completeitemfunc(){\n var linode=this.parentNode.parentNode;\n var parent=linode.parentNode;\n var id=parent.id;\n parent.removeChild(linode);\n if(id==='todo'){\n completedlist.insertBefore(linode,completedlist.childNodes[0]);\n\n }\n else{\n todolist.insertBefore(linod...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Prevent the user from selecting an element with the mouse.
function makeUnselectable(element) { // Based on Evan Hahn's advice: // http://evanhahn.com/how-to-disable-copy-paste-on-your-website/ // Relies on the existence of this CSS rule: // .unselectable { // -webkit-user-select: none; // -khtml-user-drag: none; // -khtml-user-selec...
[ "function disableSelection(element) {\n element.onselectstart = function () {\n return false;\n };\n element.unselectable = 'on';\n element.style.MozUserSelect = 'none';\n element.style.cursor = 'default';\n }", "function preventSelection() \r\n{\r\n document.addEventListener('mousedown', ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Runs "garbage collection" on the bot and all commands. Various information is cached that may no longer be necessary, and this causes the bot to go through all its information and delete references that may no longer be necessary but also can't be held by weak references. (Specifically, this culls unnecessary global co...
garbageCollect() { // Q: Can we delete keys from the map while iterating over it? // A: The ECMA spec states that yes, keys may be deleted during forEach. // It is less clear for iterators. let deleteBefore = new Date().getTime() - MAX_GLOBAL_COOLDOWN; this._cooldowns.forEach((value, key) => { ...
[ "function garbageCollector() {\n\n clearTimeout( garbageId );\n\n garbageId = setTimeout(garbageIteration , garbageTime);\n }", "function cleanup()\n {\n if(chan.timer) clearTimeout(chan.timer);\n chan.timer = setTimeout(function(){\n chan.state = \"gone\"; // in case ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
modify the ast to flow any disconnected xml/html
function xmlFlow( ast){ visit( ast, unflowedTest, function( node, parents){ console.log("WALK", node) const closeTest= closeTests[ lastTag] let values= [] for( let w of walkUntil( node, parents, closeTest)) { console.log({w}) values.push( w.value) } node.value= values.join("") console.log("walk ...
[ "function astToHtmlAst(ast) {\n if (ast == null) {\n return []\n }\n if (typeof (ast) !== 'object') {\n // This should never happen\n return []\n }\n function appendText(accum ,htmlAst ,otext) {\n // MD Single spacing\n // FIXME do this in parser\n // let text = otext.replace(/^\\n +/ ,'\\n')...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Remove a mark (or a mark of the given type) from the node at position `pos`.
removeNodeMark(pos, mark) { if (!(mark instanceof Mark$1)) { let node = this.doc.nodeAt(pos); if (!node) throw new RangeError("No node at position " + pos); mark = mark.isInSet(node.marks); if (!mark) return this; } this.step(new RemoveNodeMarkStep(pos, mark)); re...
[ "removeAt(pos) {\n\t\t//empty node\n\t\tif (this.isEmpty()) return;\n\t\telse {\n\t\t\t//pos = 0;\n\t\t\tif (pos === 0) {\n\t\t\t\tlet node = this.getAt(0);\n\t\t\t\tthis.head = node.next;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (pos === this.size()) pos = pos - 1;\n\t\t\tlet prev = this.getAt(pos - 1);\n\t\t\tprev = p...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load more elements when pagination is infinite
function loadMore() { if (vm.paginationHelper['nextPage'] || vm.paginationHelper['nextPageQueries']) { var queryArray = []; //Building the query array with any existing query queryArray = queryArray.concat(vm.queryArray); ...
[ "function loadMoreItems() {\n loadDataFunction(startIndex, pageSize);\n startIndex += 1;\n }", "function loadMore() {\n if (!$scope.paginate.searchImgTxt && !isFirstShow && !isResettingCurrentPage) {\n $scope.paginate.currentPage += 1;\n }\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Responds to the call to display older punches in the punches management view
function displayOlderPunches() { var currentDate = $('#punches-options-date').text(); currentDate = new XDate(currentDate); currentDate.addDays(-1); setPunchesRange($.cookie('punches'),currentDate); }
[ "function displayNewerPunches() {\n var currentDate = $('#punches-options-date').text();\n currentDate = new XDate(currentDate);\n \n // Security to prevent viewing dates in the future\n var now = new XDate();\n if (currentDate.getFullYear() === now.getFullYear()\n && currentDate.getMonth()...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Checks a list of objects for key duplicates and returns a boolean
function doesObjectListHaveDuplicates(l) { var mergedList = l.reduce(function (merged, obj) { return obj ? merged.concat(Object.keys(obj)) : merged; }, []); // Taken from: http://stackoverflow.com/a/7376645/1263876 // By casting the array to a Set, and then checking if the size of the array ...
[ "function doesObjectListHaveDuplicates(l) {\n const mergedList = l.reduce((merged, obj) => (\n obj ? merged.concat(Object.keys(obj)) : merged\n ), []);\n\n // Taken from: http://stackoverflow.com/a/7376645/1263876\n // By casting the array to a Set, and then checking if the size of the array\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
here, first of all I need to query the backend for the actual writing detail (using the slug from the URL ideally) then I will get the body of the writing and I can print it
async function fetchWritingDetail() { const res = await fetch(`${baseUrl}/api/writings/${writingSlug}/`); res .json() .then(res => setWritingDetail(res)) .catch(err => setErrors(err)); }
[ "function getSlugDetails(data,callback){\n\tcheckForExistance({body:{id:data.slug.toUpperCase().trim(),stale:\"NONE\"}},function(stat){\n\t\tif(stat.exists && stat.result[0] && stat.result[0].id){\n\t\t\tCouchBaseUtil.getDocumentByIdFromContentBucket(stat.result[0].id,function(recRes){\n\t\t\t\tif(recRes.error){\n\...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function to get and parse the JSON variable from the spark API
function getResponse(variable){ var JSONResponse = UrlFetchApp.fetch("https://api.spark.io/v1/devices/" + device_ID + "/" + variable + "?access_token=" + access_token); var response = JSON.parse(JSONResponse.getContentText()); return response.result; }
[ "function getResponse(variable){\n\tvar JSONResponse = UrlFetchApp.fetch(\"https://api.spark.io/v1/devices/\" + device_ID + \"/\" + variable + \"?access_token=\" + access_token);\n\t\n\tvar response = JSON.parse(JSONResponse.getContentText());\n\treturn response.result;\t\t\n}", "static parse(json) {\n\n }", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
=================================================================== from vm/instructions/Literal.java =================================================================== Needed early: Instruction
function Literal( arg ) { }
[ "Literal() {\n switch (this._lookahead.type) {\n case 'NUMBER':\n return this.NumericLiteral();\n case 'STRING':\n return this.StringLiteral();\n case 'true':\n return this.BooleanLiteral(true);\n case 'false':\n return this.BooleanLiteral(false);\n case 'null...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Picks and sets a random cell with specified value. Returns true if successfull.
function setRandCell(value) { if (totalEmptyCells > 0) { var rand = Math.floor(Math.random() * 16); var row = Math.floor(rand * 0.25); var col = rand % 4; while (!isCellEmpty(row,col)) { rand = Math.floor(Math.random() * 16); row = Math.floor(rand * 0.25); col = rand % 4; } setGridNumRC(row, col, ...
[ "function randomCell() {\n return _.random(0, 1) === 1 ? cell.alive : cell.dead;\n}", "function handleRandomCell() {\n return cells[Math.floor(Math.random() * cells.length)];\n }", "getRandCell() {\n var x = Math.floor(Math.random() * this.rows);\n var y = Math.floor(Math.random() * this.colu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
opens a dialog for editing the link of a column
function openEditLinkDialog(column, $header, templates, idPrefix) { if (templates === void 0) { templates = []; } var t = "<input type=\"text\" size=\"15\" value=\"" + column.getLink() + "\" required=\"required\" autofocus=\"autofocus\" " + (templates.length > 0 ? 'list="ui' + idPrefix + 'lineupPatternList"' : ...
[ "function openEditLinkDialog(column, $header, templates) {\n\t if (templates === void 0) { templates = []; }\n\t var t = \"<input type=\\\"text\\\" size=\\\"15\\\" value=\\\"\" + column.getLink() + \"\\\" required=\\\"required\\\" autofocus=\\\"autofocus\\\" \" + (templates.length > 0 ? 'list=\"lineupPatternL...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
If a leg is a roundtrip, it considers as twice half the distance
function distance_round_trip(legs) { let dist = distance(legs); if(is_round_trip(legs)) { return [dist/2, dist/2]; } else { return [dist]; } }
[ "calculateDistance() {}", "function calculateDistance() {}", "static get MIN_DISTANCE_TOLERANCE() { return 1.0e-8; }", "tallyDist(distance, length) {\n this.d_buf[this.last_lit] = distance;\n this.l_buf[this.last_lit++] = (length - 3);\n let lc = DeflaterHuffman.Lcode(length -...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Print BlockStatement, collapses empty blocks, prints body.
function BlockStatement(node, print) { this.push("{"); if (node.body.length) { this.newline(); print.sequence(node.body, { indent: true }); if (!this.format.retainLines) this.removeLast("\n"); this.rightBrace(); } else { print.printInnerComments(); this.push("}"); } }
[ "function BlockStatement(node, print) {\n this.push(\"{\");\n if (node.body.length) {\n this.newline();\n print.sequence(node.body, { indent: true });\n if (!this.format.retainLines) this.removeLast(\"\\n\");\n this.rightBrace();\n } else {\n print.printInnerComments();\n this.push(\"}\");\n }...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Use only for NPC commands that you are not giving your own custom script attribute. Commands must be an order to a single NPC in the form verbobject.
function NpcCmd (name, hash) { Cmd.call(this, name, hash); if (!this.cmdCategory) this.cmdCategory = name; this.script = function (objects) { const npc = objects[0][0]; if (!npc.npc) { failedmsg(lang.not_npc(npc)); return world.FAILED } let success = false; if (obj...
[ "function NpcCmd(name, hash) {\n Cmd.call(this, name, hash);\n if (!this.cmdCategory) this.cmdCategory = name;\n this.script = function(objects) {\n const npc = objects[0][0];\n if (!npc.npc) {\n failedmsg(lang.not_npc, {char:game.player, item:npc});\n return world.FAILED; \n }\n let succes...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
deleteLink deletes the inheritance link between role: name1 and role: name2. aka role: name1 does not inherit role: name2 any more. domain is a prefix to the roles.
async deleteLink(name1, name2, ...domain) { if (domain.length === 0) { domain = [DEFAULT_DOMAIN]; } else if (domain.length > 1) { throw new Error('error: domain should be 1 parameter'); } const allRoles = loadOrDefault(this.allDomains, domain[0], new Roles...
[ "deleteLink(name1, name2, ...domain) {\n return __awaiter(this, void 0, void 0, function* () {\n if (domain.length === 1) {\n name1 = domain[0] + '::' + name1;\n name2 = domain[0] + '::' + name2;\n }\n else if (domain.length > 1) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
TODO: create reqIsSocket policy TODO: add ChatOperatorPolicy TODO: addLoggedInPolicy Allows an operator to close a conversation with a user.
operatorCloseConversation(req, res) { socketID = req.param('socket') LiveChat.destroy(socketID).exec(function (err) { if (err) { return res.json({ status: 500, message: 'Error closing conversation, maybe its already closed?' }) } return res.json({ st...
[ "_handleOperatorConnection(socket) {\n const onDisconnect = () => {\n delete this.customerConnections[socket.id];\n };\n this.operatorConnections[socket.id] = new OperatorConnectionHandler(\n socket,\n this,\n onDisconnect\n );\n }", "_handleOperatorConnection (socket) {\n cons...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Helper function that capture all the event in spreadsheet.
function getSheetEvents_(sheet, sheetIdx) { // Create an events array to store all the event. let events = []; // Find the header row, which is defined by a specific background color. let headerRow = getHeaderRow_(sheet); // Find the column that contain the info of the calendar events. let infoCol = ge...
[ "function exportEvents() {\n var sheet = SpreadsheetApp.getActiveSheet(),\n range = sheet.getDataRange(),\n data = range.getValues(),\n calId = CALENDAR_ID,\n calendar = CalendarApp.getCalendarById(calId);\n \n exportEvent(calendar, data);\n \n range.setValues(data);\n}", "async function ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Updates the status on the chosen bicycle to "In Repair", and saves and order confirmation as a PDF.
orderRepair() { repairService.updateStatus(this.props.match.params.id, bicycle => { this.FrameType = bicycle.Frametype; this.BrakeType = bicycle.Braketype; this.Wheelsize = bicycle.Wheelsize; }); var pdf = new jsPDF(); var comment = '' + document.getElementById('commen...
[ "function\nSendConfirmation(e)\n{\n var send = false;\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var sheet = ss.getActiveSheet();\n var stop = sheet.getRange(e.range.getRow(), 1, 1, (Global().n_data_columns)).getValues()[0];\n var notes = stop[Global().c_driver_notes - 1];\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
The loadBox function is a callback function for the gameBox.php getJSON function. It loads all the game and game box links. It loads all the game box images. It also initializes the BD18.gm.trayCounts array if it is undefined or empty.
function loadBox(box) { BD18.bx = null; BD18.bx = box; if (typeof(box.links) !== 'undefined' && box.links.length > 0) { loadLinks(box.links); } $.getJSON("php/linkGet.php", 'gameid='+BD18.gameID,function(data) { if (data.stat === "success" && typeof(data.links) !== 'undefined' && data.links.l...
[ "function loadBox(box) {\n BD18.bx = null;\n BD18.bx = box;\n if (typeof(box.links) !== 'undefined' && box.links.length > 0) {\n loadLinks(box.links);\n }\n $.getJSON(\"php/linkGet.php\", 'gameid='+BD18.gameID,function(data) {\n if (data.stat === \"success\" && typeof(data.links) !== 'undefined' \n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function validator Checks if guess is valid integer within range (1100 default) If guess not valid, return false; If guess valid, return true
function validator(guess){ // return true if guess is a valid integer within range if (guess > 0 && guess < 101) return true; // otherwise, guess is not valid. Return false. else return false; // Close Function Definition }
[ "function validator(guess) {\n\tif (guess > 0 && guess < 101) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function guessValidator(guess) {\n\t if (guess > 1 && guess < 101) {\n\t\t return true;\n\t }\n\t else {\n\t\t return false;\n\t }\n }", "function validGuess(guess) {\n return isNormalI...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Task creates the new assets.json file
function createAssetFile() { const assetGlobs = []; // Genertes the assetGlobs based on the includes // We use the assetGlobs to find all files we may // include in our assets.json include.forEach(({ from, extensions, includeSubDirs }) => { const globPath = getGlobPath( path.join(projectRoot, from), ...
[ "writeAssetsFile() {\n const filePath = this.manifestOutputPath;\n const fileDir = path.dirname(filePath);\n const json = JSON.stringify(this.manifest, null, 2);\n try {\n if (!fs.existsSync(fileDir)) {\n fs.mkdirSync(fileDir, { recursive: true });\n }\n } catch (err) {\n if (er...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if score is === to randGoal and if it is Win or Loose
function checkScore() { if (score === randGoal) { wins++; $("#wins").html(wins); //Resets game after wins or looses greenGem = Math.floor(Math.random() * 11) + 1; redGem = Math.floor(Math.random() * 11) + 1; purpleGem = Math.floor(Math.random() * 11) +...
[ "function randGoal() {\n goalScore = Math.floor(Math.random() * (120 - 19)) + 19;\n console.log(\"Score to win: \" + goalScore);\n $(\"#goal\").html(\"Score to win: \" + goalScore);\n }", "function checkWin() {\n if (runningScore === randomTargetNum) {\n winner();\n } else if (running...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Atualizar Contatos do responsavel
function atualizarContatosResponsavel(responsavelUpdateContatos, usuario, res) { connection.acquire(function(err, con) { con.query("update Responsavel set telefoneResponsavel = ?, emailResponsavel = ? where idusuario = ?", [responsavelUpdateContatos.telefoneResponsavel ,responsavelUpdateContatos.emailRespon...
[ "function atualizarFabricante() {\n apiService.post('/api/fabricante/atualizar', $scope.novoFabricante,\n atualizarFabricanteSucesso,\n atualizarFabricanteFalha);\n }", "function atualizarMarca() {\n apiService.post('/api/Marca/atualizar', $scope.novoMarca,\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Objectives Create a function that prints/logs all the integers from 1 to 20.
function print1to20(){ for (let i = 1; i < 21; i++) { console.log(i) } }
[ "function displayNrFrom1to20() {\n console.log('====================== \\n Numbers from 1 to 20: \\n======================');\n \n for (let i = 0; i < 20; i++) {\n console.log(i+1);\n }\n}", "function printToTwenty(){\n for(i = 0; i <= 20; i++){\n console.log(i);\n }\n}", "functi...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Get a list of prerelease version IDs for a specific app.
function getAllPrereleaseVersionIDsForApp(api, id, query) { return api_1.GET(api, `/apps/${id}/relationships/preReleaseVersions`, { query, }) }
[ "function listAllPrereleaseVersionsForApp(api, id, query) {\n return api_1.GET(api, `/apps/${id}/preReleaseVersions`, { query })\n}", "function getAllResourceIDsForPrereleaseVersionsForBuild(api, id) {\n return api_1.GET(api, `/builds/${id}/relationships/preReleaseVersion`)\n}", "function getAllBuildIDsFo...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Options can be any of port: integer number (default: a random port) listen: String of address to listen start_callback: (err, url_base) after server start handlers: an array of handlers, each gets called with (req, res, pathname). A handler returns 'unhandled' iff it is not interested in a request. If not specified, a ...
function server(options) { options = options || {}; const port = options.port || 0; const listen = options.listen || '::1'; const handlers = options.handlers || [static_handler.file_handler('/', ROOT_DIR)]; const serv = http.createServer((req, res) => { req.socket.setNoDelay(true); const pathname = url.parse...
[ "function configure(_options) {\n\tvar options = {\n\t\tautoInstall: true\n\t};\n\tfor (var key in _options) {\n\t\toptions[key] = _options[key];\n\t}\n\n if (!options.autoInstall) {\n\t\thttp.Server.prototype.listen = listenAndMaybeInstall;\n\t}\n}", "function startServer(options) {\n\n options = initOptions...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Callback used by aggrid colDef.editable
function isColumnEditable(args) { // skip pinned (footer) nodes if(args.node.rowPinned) return false; // if read-only and no r-o columns if($scope.model.readOnly && !$scope.model.readOnlyColumnIds) return false; var rowGroupCols = getRowGroupColumns(); for (var i = 0; i < rowGroupCols.l...
[ "function onEdit(e) {\n checkCurrentColumn();\n}", "getCellEditable(ind, col_ind) {\n let col = this.columns[col_ind]\n let rec = this.records[ind]\n if (!rec || !col) return null\n let edit = (rec.w2ui ? rec.w2ui.editable : null)\n if (edit === false) return null\n if ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
represents the rules associated with an object property
function PropertyRuleSet(name, id){ this.name = name; //all properties must have a name, even if it's 'jsocs' and doesn't refer to an actual property this.id = id || null; //TODO - ensure it always start with '_' this.description = ""; //describe what this set of rules is meant for this.reference=null; //defa...
[ "get rule() {\n return this.prop.rule;\n }", "validateProperties() {\r\n for (var pro in this.rules) {\r\n var conf = this.rules[pro];\r\n for (let i in conf) {\r\n let r = conf[i];\r\n if (r == 'require' && this[pro] !== 0 && !this[pro]) {\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
makes the layout of 'plans' responsive at a certain window width
function plansLayout() { const mq = window.matchMedia( "(max-width: 950px)" ) var root = document.documentElement var plans = document.getElementById("plans") var cp = document.getElementById("codevert-premium") var cd = document.getElementById("plans-trial") var getHeightCP = cp.offsetHeight ...
[ "function setlayout() {\n\n window_width = window.innerWidth || document.documentElement.clientHeight || document.body.clientHeight;\n\n if (window_width <= masonrySettings.sm.width) {\n\n masonary(masonrySettings.sm.columns);\n\n } else if (window_width <= masonrySettings.md.width) {\n\n masonary(masonryS...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate the host address portion of email addresses
function validHost(hostaddr) { // Valid host portion of email address (the part of the email after the '@') /* 1. Must not be empty 2. Must be between 1 and 253 characters 3. May contain Uppercase and Lowercase Latin letters A to Z and a to z 4. May contain Digits 0 to 9 5. May contain ...
[ "emailIsValid(email) {\n return /\\S+@\\S+\\.\\S+/.test(email);\n }", "function validateEmail(addr, required) {\naddr = addr.toLowerCase();\n\n// empty address is invalid\nif (!required && addr == '')\n return true;\n\n// validate: invalid characters\nvar invalidChars = '\\/\\'\\\\ \";:?!()[]\\{\\}^|';\nfor...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
used to determine the class of the fieldset within which this field exists
function getParentFieldsetClass(formRow) { try { return $(formRow).parents('fieldset').attr('class'); } catch (e) { return false; } }
[ "function getFieldSet (element) {\n return $(element).closest('.bv-fieldset');\n }", "getContainerClass() {\n const inline = this.getInline();\n const containerClass = inline\n ? 'tag-edit-field__container tag-edit-field__container-inline'\n : 'tag-edit-field__container';\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Given an input Array, loop backwards over the Array and print its values using console.log().
function printArrayValuesInReverse(array) { // YOUR CODE BELOW HERE // //START: last indexed value //STOP: index 0 //UPDATE: -1 for (var j = array.length-1; j >= 0; j--) { //console-logging reversed values inside the array console.log(array[j]); } // YOUR CODE ABOVE HERE // }
[ "function printArrayValuesInReverse(array) {\n // YOUR CODE BELOW HERE //\n \n // Loop backwards through the array and log the values to the console\n for (var i = array.length - 1; i>= 0; i--) {\n \n console.log(array[i]);\n }\n \n \n // YOUR CODE ABOVE HERE //\n}", "function printArrayValuesInReve...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Load and display the exercise buttons in Assignment, they vary depending on the assignmentNr and addExerciseImage is called and it loads the correct button for each exercise
function addExercises(assignmentNr) { if(assignmentNr === 0 || assignmentNr === 1) { addExerciseImages('mus', 'musGlow', exerciseBtnPosArray[assignmentNr], 3, assignmentNr, 0); addExerciseImages('robot', 'robotGlow', exerciseBtnPosArray[assignmentNr], 3, assignmentNr, 3); } else if(assig...
[ "function addExercises(assignmentNr)\n{\n if(assignmentNr === 0 || assignmentNr === 7 || assignmentNr === 8)\n {\n if(nextPage[assignmentNr]){\n addExerciseImages('jellyfish', 'jellyfish', exerciseBtnPosArray[assignmentNr], 1, assignmentNr, 15);\n addExerciseImages('starfish', 'st...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
pseudo random hash generator based on block hashes.
async function prngHash (seed, blockHashes) { // let sum = blockHashes(numBlocks) let sum = await web3.utils.soliditySha3(blockHashes, seed) // console.log('prngHash', sum) return (sum) }
[ "generateHash() {\n let hashData = `${this.previousHash} ${this.nonce} ${JSON.stringify(this.data)}`;\n let blockHash = crypto.createHash('sha1').update(hashData).digest('hex');\n while (!this.isHashValid(blockHash)) {\n this.nonce += 1;\n hashData = `${this.previousHash} ${this.nonce} ${JSON.str...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Reset Population This function will not vary with scenario, check scenario parameters instead to make this function suit your needs Resets Population
resetPopulation() { this.avgEpisodeDuration = 0; this.activeIndividuals = Array.from( { length: this.scenarioParameters.populationSize }, (_, i) => i ); for (var i = 0; i < this.scenarioParameters.populationSize; i++) { this.population[i].score = 0; neat.population[i].score = 0; ...
[ "function resetPopulation()\n{\n\t// create population from start \n\tpopulation = new Population(populationSize);\n\t\n\t// zero back all the meta parameters \n count = 0;\n\thowManyWon = 0;\n\thowManyCrashed = 0;\n\tgeneration++;\n\tchartDataCenterMass = [];\n\tchartDataCenterMassVar = [];\n}", "function res...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Write a function which accepts a letter as an argument and returns its numerical value, both as position in the alphabet and as unicode.
function letterToNumber(letter) { let alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; let position = alphabet.indexOf(letter) + 1; let uni = letter.charCodeAt(0); console.log(uni); return 'Alphab...
[ "function position(letter){\n //Write your own Code!\n return \"Position of alphabet: \" + (letter.charCodeAt()-96)\n }", "function getIndexFromLetter(letter) {\n var letterCode = letter.toLowerCase().charCodeAt(),\n refCode = \"a\".charCodeAt();\n\n return letterCode - refCode;\n}", "fu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Test a route to see if toApply has been applied or not
function testRoute (route, targetApplied, cb) { request.get({ uri: 'http://localhost:' + testPort + route }, function (err, res, body) { var obj = JSON.parse(body); _.isEqual(obj, targetApplied).should.equal(true); cb(); }); }
[ "hasRoute () {\n return this.route instanceof Route;\n }", "shouldAttach(route) {\n return false;\n }", "shouldReuseRoute(future, curr) {\n return future.routeConfig === curr.routeConfig;\n }", "function isRouteRedirect(route) {\n\n // If there is no action, then the route i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Debo tomar el segundo argumento y compararlo con cada uno de los sub elementos del primer argumento y acumularlos
function contarOcurrencias(param1, param2){ var elementoArecorrer = arguments[0]; var contador=0; for(var i=0; i< elementoArecorrer.length; i++){ if(elementoArecorrer[i] === arguments[1]){ contador ++; } } return contador; }
[ "function comparar(datos) {\n let arrayPrecios = [];\n datos.forEach((element) => {\n arrayPrecios.push(parseInt(element.Precio));\n arrayPrecios.sort((a, b) => {\n return b - a;\n });\n });\n console.log(\"=====================\");\n console.log(\"Vehículos ordenados ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
postorder iterative method to visit nodes of a tree
function postOrder_iterative(tree, index) { var stack = []; var lastNodeVisited = null; var node = tree[index]; while (stack.length > 0 || !isUndefined(node)) { if (!isUndefined(node)) { stack.push(index); index = left(index); node ...
[ "function fnTraversal(root, node, preorder, postorder) {\n\t\tnode.childnodes.forEach((child, i) => { //iterate over next deep level\n\t\t\tpreorder(root, node, child, i) && fnTraversal(root, child, preorder, postorder); //preorder = cut/poda\n\t\t\tpostorder(root, node, child, i);\n\t\t});\n\t\treturn self;\n\t}",...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
decode and store base64 strings to image, used for the album art
function base64_decode(base64Image, file) { base64Image = base64Image.substring(2, base64Image.length - 1) base64Image += "data:image/jpeg;base64," fs.writeFile(file, Buffer.from(base64Image, 'base64'), function (err) { if (err) { console.log("image write error") } else {...
[ "function base64_decode(base64str, file) {\n // krijon ni buffer object me base64\n var bitmap = new Buffer(base64str, 'base64');\n // e shkrun bufferin ne file\n fs.writeFileSync('./public/profilePhotos/'+file+\".jpg\", bitmap);\n}", "function imageToBase64(string, callback, width, height){ \n\t\tdec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Schedule next frame of letter animation.
function scheduleNextAnimateLettersTick() { if (letterAnimationsInProgressCount > 0 && !nextLetterAnimationScheduled) { nextLetterAnimationScheduled = true window.requestAnimationFrame(animateLettersTick) } }
[ "function _nextFrame() {\n\n\t\t// Increment (or decrement) the frame counter based on animation direction\n\t\t_frame += _direction;\n\n\t\t// Test if requested frame lies outside specified array of frames\n\t\tif (_frames.length > 1 && (_frame >= _frames.length || _frame < 0)) {\n\n\t\t\t// Varies depending on de...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
validate if the client is good or not used by: /token returns true if validated false otherwise
isClientValid(clientID,clientSecret){ return true }
[ "isvalidToken(token) {\n const realtoken = this.realtoken(token);\n if (realtoken) {\n if (\n (realtoken.iss =\n \"http://127.0.0.1:8000/api/auth/login\" ||\n \"http://127.0.0.1:8000/api/auth/register\")\n ) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Highlevel stage methods: find, fix, verify Find stage. Finds patches according to the user's need (e.g., shortenable, misspelled, etc.)
function findPatches(paragraph_index, findFixVerifyOptions, rejectedWorkers) { var find_hit = requestPatches(paragraph_index, findFixVerifyOptions); var patches = []; /* wait to get at least one patch out of the system --- if there's not enough agreement, ask for more people */ while (true) { ...
[ "function joinPatches(find_hit, paragraph_index, findFixVerifyOptions, rejectedWorkers) {\r\n\tvar status = mturk.getHIT(find_hit, true)\r\n\tprint(\"completed by \" + status.assignments.length + \" of \" + findFixVerifyOptions.find.minimum_workers + \" turkers\");\r\n\tfindFixVerifyOptions.socket.sendStatus(Socket...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
On component mount, add a listener for determining the placement of the intro content block.
componentDidMount() { window.addEventListener("resize", this.resizeIntro, false); setTimeout(() => this.resizeIntro(), 300); this.resizeIntro(); var el = document.getElementById( `${this.props.currentModel.id}_introContent` ); el.addEventListener( "touchmove", _.debounce(this...
[ "repositionBanner() {\n this.addListener();\n }", "init() {\n let config = {\n content: [{\n type: \"stack\",\n isClosable: false,\n content: [\n {\n t...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
accept Year Select Element Delete
function acceptYearDelete(){ var element = document.getElementById("accept_year"); var length = element.length; accept.year = 0; for(var i = 0; i < length - 1; i++){ element.removeChild(element.lastChild); } acceptMonthDelete(); }
[ "function removeYear() {\n\tvar index = plan.years.length - 1;\n\t$('#year' + index).remove();\n\tplan.years.pop();\n\t\n\t// update sidebar requirements\n\tdrawRequirementsView();\n\tcheckRequirements();\n}", "removeYearRange() {\n delete this.filterList['Year(s)'];\n this.updateFilterList();\n }", "fun...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Writing files for react framework. First copying all files from original client subgenerator then copying files from our own blueprint generator. PLEASE be sur copying original files first to avoid overwriting yours.
function writeFiles() { this.writeFilesToDisk(reactFiles, this, false, ORIGINAL_REACT_TEMPLATE_PATH); // always originals first this.writeFilesToDisk(files, this, false, CURRENT_REACT_TEMPLATE_PATH); }
[ "function createFiles(next) {\n var files = common.directories.normalize(\n common.mixin({}, flatiron.constants.DIRECTORIES, { '#ROOT': root }),\n JSON.parse(fs.readFileSync(path.join(scaffold, 'files.json'), 'utf8'))\n );\n\n function copyFile(file, nextFile) {\n app.log.info('Writing file ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Request the layer for 'Jurisdicciones'
static requestJurisdicciones() { return GeoServerAPI.requestWFSBiotablero('jurisdicciones_low'); }
[ "function requestDoodle() {\n loadJSON(\"/getTraining\", gotDoodle);\n}", "read_layer_interr_sed(){ /*using : Layer: SED*/\n return serviceURL + \"Interrupciones/PO/MapServer/0?f=json&token=\" + token.read();\n }", "read_layer_interr_sed(){ /*using : Layer: SED*/\n return serviceURL + \"Interrupci...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
getting a song object from an song id
function getSongObjectById(id){ let song = player.songs.filter(songObject => { if(songObject.id === id){ return songObject; } }) if(song.length == false){ throw "undefined id"; } song = song[0]; return song; }
[ "function getSong(songId, state) {\n return state.songs.filter(function (x) {\n return x.id === songId;\n })[0];\n}", "async function getSongDetailsById(id) {\n\n const song = await getSongById(id);\n return song;\n}", "function getSong(videoId){\r\n for(var i = 0; i < data.songs.length; ++i){\r\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a value implements the `Location` interface.
isLocation(value) { return Path.isPath(value) || Point.isPoint(value) || Range.isRange(value); }
[ "isValidLocation(loc) {\n return true;\n }", "function is_location(tsid){\n\treturn in_array(tsid, this.get_locations());\n}", "validateLocation(_location) {}", "function hasLocationObjectInStorage() {\n var a = Store.getSession( constants.KEY_LOCATION );\n return a !== null && a !== undefin...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
splits apart the numerator from the denominator
function split_fraction(fraction) { // numerator numerator[input_index] = fraction.split("/")[0]; console.log("numerator: "+numerator[input_index]); // denominator denominator[input_index] = fraction.split("/")[1]; console.log("denominator: "+denominator[input_index]); }
[ "function divideOut(numerator, denominator){\n numerator = numerator.slice()\n denominator = denominator.slice()\n var max = Math.max(numerator.length, denominator.length)\n for (var j = 0; j < max; j++) {\n var nj = numerator[j]\n var dj = denominator[j]\n var min = Math.min(nj, dj) || 0\n numerato...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Make sure the current stored marks or, if that is null, the marks at the selection, match the given set of marks. Does nothing if this is already the case.
ensureMarks(marks) { if (!Mark$1.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) this.setStoredMarks(marks); return this; }
[ "addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }", "allowsMarks(marks) {\n if (this.markSet == null)\n return true;\n for (let i = 0; i < marks.length; i++)\n if (!this.allowsMarkType(marks[i].type))\n return false;\n...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Default readyfunc that shows the widget.
function isready() { p_widget.show(); }
[ "function displayWidget () \n{\n\tif(!window.TGS || !TGS.IsReady())\n\t{\n\t\treturn;\n\t}\n\n\tinitWidget();\n}", "show() {\n this.container.className = this.display;\n this.callback();\n }", "rendered(callback) {\n\t\t\tthis.ready = callback;\n\t\t}", "rendered(callback){\n this.ready ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if the string is a valid [ISO 31661 alpha3]( officially assigned country code.
function isISO31661Alpha3(value) { return typeof value === 'string' && validator_lib_isISO31661Alpha3__WEBPACK_IMPORTED_MODULE_1___default()(value); }
[ "function isISO31661Alpha3(value) {\n return typeof value === \"string\" && validator.isISO31661Alpha3(value);\n}", "function isISO31661Alpha3(value) {\n return typeof value === \"string\" && validator__WEBPACK_IMPORTED_MODULE_1___default.a.isISO31661Alpha3(value);\n}", "function isISO31661Alpha3(value) {...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Known fragment names A GraphQL document is only valid if all `...Fragment` fragment spreads refer to fragments defined in the same document.
function KnownFragmentNames(context) { return { FragmentSpread: function FragmentSpread(node) { var fragmentName = node.name.value; var fragment = context.getFragment(fragmentName); if (!fragment) { context.reportError(new _error.GraphQLError(unknownFragmentMessage(fragmentName), [...
[ "function KnownFragmentNames(context) {\n return {\n FragmentSpread: function FragmentSpread(node) {\n var fragmentName = node.name.value;\n var fragment = context.getFragment(fragmentName);\n if (!fragment) {\n context.reportError(new _error.GraphQLError(unknownFra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
load configuration from cookie
function LoadConfiguration() { var cookievalue = Get_Cookie('mapconfig'); if (cookievalue) { // TODO: load settings from cookie msg('Configuratie inladen', 'Configuratie is ingeladen.'); } else { msg('Configuratie inladen', 'Geen configuratie gevonden...'); } }
[ "function loadSettings() {\n\t\t// prepare the object that will keep the panel statuses\n\t\tpanelsStatus = {};\n\n\t\t// find the cookie name\n\t\tvar start = document.cookie.indexOf(PANEL_COOKIE_NAME + \"=\");\n\t\tif (start == -1)\n\t\t\treturn;\n\n\t\t// starting point of the value\n\t\tstart += PANEL_COOKIE_NA...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Much like redux `mapStateToProps` and `mapDispatchToProps` the object returned from the "collect" function will be assigned to the Drag Source item's props
function dragSourceCollect (connect, monitor) { return { connectDragSource: connect.dragSource(), connectDragPreview: connect.dragPreview(), isDragging: monitor.isDragging() } }
[ "beginDrag (props) {\n return {\n sourceIndex: props.index,\n sourceCollectionId: props.collectionId\n };\n }", "function sourceCollect(connect, monitor) {\n // What's returned will be passed as props to the wrapped component\n return {\n connectDragSource: connect.dragSource(), // turns wra...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Controller to download the analysis.
function FileDownloadController() { var vm = this; vm.getZipFile = function (id) { var iFrameId = 'hiddenDownloader'; var hiddenIFrame = document.getElementById(iFrameId); if (hiddenIFrame === null) { hiddenIFrame = document.createElement('iframe'); hiddenIFrame.id = iFrameId;...
[ "function view_download() {\n\tvar self = this;\n\tself.view('download');\n}", "@action downloadFiles() {\n this.args.downloadFiles();\n }", "function download() {\n if (isStopped) {\n return;\n }\n\n if (isNaN(representationController.getCurrentRepresentation())) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Insert attachment template function.
function TinyMCE_advanced_getInsertAttachmentTemplate() { var template = new Array(); template['file'] = 'attachment.htm'; template['width'] = 300; template['height'] = 150; // Language specific width and height addons template['width'] += tinyMCE.getLang('lang_insert_a...
[ "function insertTemplate() {\n switch (scope.feed[scope.currentTopic].items[scope.currentItem][scope.currentSubItem].type) {\n case \"full-with-badge\" :\n tickerPrimary.html(getFullWithBadgeTemplate());\n break;\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
the following methods are used to handle overflowing modals todo (fat): these should probably be refactored out of modal.js
_adjustDialog() { const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; if (!this._isBodyOverflowing && isModalOverflowing) { this._element.style.paddingLeft = `${this._scrollbarWidth}px`; } if (this._isBodyOverflowing && !isModalOverflowing) { ...
[ "_adjustDialog() {\n const isModalOverflowing =\n this._element.scrollHeight > document.documentElement.clientHeight;\n\n if (!this._isBodyOverflowing && isModalOverflowing) {\n this._element.style.paddingLeft = `${this._scrollbarWidth}px`;\n }\n\n if (this._isBodyOverflowing && !i...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Function calls on error for product details.
function productDetailsError(error) { kony.application.dismissLoadingScreen(); alert ("Unable to fetch BestBuy Stores"); }
[ "handleAddProductError(error) {\n if (\n error &&\n error.response &&\n error.response.data &&\n error.response.data.errors.length !== 0 &&\n error.response.data.errors[0] &&\n error.response.data.errors[0].code\n ) {\n if (\n error.response.data.e...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Check if a second player was mentioned in the tweet. If so, add them to the players array and get the plots. Finally, send a tweet to each player in the players array to let them know what their plots are.
function buildReply(tweet) { // Build the array of players var players = [tweet.user.screen_name]; _.find(tweet.entities.user_mentions, function(user) { if (user.screen_name !== config.me) { players.push(user.screen_name); } }); // Get the plots for the players. va...
[ "function runBot() {\n console.log(\" \"); // just for legible logs\n\n preMadeReplies = [\n \"Hello! \" + \" I hope you \" + \"enjoy\" + \" this animal picture!\",\n \"How's it going! You seem like you could use more animal\" + \" pictures\" + \" in your life\",\n \"Who \"...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
parsePattern :: String > Regex|Null
function parsePattern(val) { return void(0) === val ? null : new RegExp(val); }
[ "match_regex(pattern) {\n const match = pattern.exec(this.template.slice(this.index));\n if (!match || match.index !== 0)\n return null;\n return match[0];\n }", "match(pattern, start) {\n pattern.lastIndex = start;\n const raw = pattern.exec(this.str);\n if (raw !== null) {\n ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Retrieve information for a specific repository.
function getrepoinfo(repo, callback) { _get('getrepoinfo', `?r=${repo}`, callback); }
[ "function getRepoInfo(repo) {\n github.getRepoData(repo, 'REPO_INFO')\n .then(res => {\n console.log(res.data)\n })\n .catch( reason => {\n console.log(`Request rejected: (${reason})`)\n })\n}", "function getRepositoryInfo(username, repoName, callback) {\n var request = new XMLHttpRequest();\n re...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
was the bot tagged
function botTag(botId) { botTagResponse = 'try #auburn basketball for a gif\ntry $bac for a stock price'; botTagResponseLog = 'I was tagged by: ' + sendingUser; botResponse = botTagResponse; specificLog = botTagResponseLog; postMessage(botResponse, botId); }
[ "tagged(tag) {\n return this._tag[tag] === true;\n }", "hasTag(tag) {\n return tag in this.frameTags;\n }", "function checkTAG(message, TAG, mackey=''){\n\tif(TAG === Buffer.from(blake2b(message,mackey), 'hex').toString('base64')){\n\t\treturn true\n\t}\n\telse{\n\t\treturn false\n\t}\n}", ...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
findInObj its accept some array, key, and searcValue we wanna filter a value at specific key when its same as the search value we will acces this at index [0]
function findInObj(arr, key, searchValue) { return arr.filter(function(val) { return val[key] === searchValue; }) [0]; }
[ "function findInObj(arr, key, searchVal){\n return arr.filter(curVal => curVal[key] === searchVal)[0];\n}", "function findByKey (array, key, value,outkey) {\n\t \treturn array.filter(function (obj) {\n\t \t\treturn obj[key] === value;\n\t \t})[0];\n\t }", "function findInObj(array, key, searchValue) {\n\tretu...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
nueva funcionalidad modal MODAL 2
function CompradoresModal(){ $("#aceptarmodal3").attr("onClick", "javascript:BuscarCompradoresModal();return false;"); $('#myModal3').modal('show'); //$("#listresultados3").html(""); handleListarUsuariosModal(); }
[ "function ventanaModal()\n {\n \n }", "function mensajes_modal2(texto)\n{\n crear_modal2(texto);\n $(\"#modal_mensaje2\").modal(\"show\");\n}", "function form_slipgaji(){\n\n\t$('#modal_form_slip').modal();\n}", "function modal_cambiartipoemision(){\r\n $(\"#modal_tipoemision\").modal(\"show...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
Calculate the division calculation of the 2 random numbers that are generated 1 Display the page numbers randomly generated 2 Create a handle on the submit answer button 3 Do the calculation, then call the function to check the user's answer
function divide(){ // To make the division easier, we want the first number to be bigger than the second. if (number1 < number2){ var tempNum = number1; number1 = number2; number2 = tempNum; } setPageNumbers("/"); var answer = document.getElementById("submitAns"); answer.onclick = function() { var userA...
[ "function createResultPage() {\n let choice = $(\"[type='radio']:checked\").val();\n let correctAnswer = `${STORE[questionNumber].answer}`;\n if (choice === correctAnswer) {\n $('.answerPage').html(renderCorrect());\n countScore();\n }\n else\n {\n $('.answerPage').html(renderIncorrec...
{ "objective": { "paired": [], "self": [], "triplet": [ [ "query", "document", "negatives" ] ] } }